Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Web

# Typecheck and run the web test suite with the 100% engine-coverage gate.
# The threshold lives in web/vite.config.ts, so test:coverage fails the build if
# any pure-engine statement, branch, function, or line is left uncovered.
on:
push:
branches: [main]
paths:
- 'web/**'
- '.github/workflows/web.yml'
pull_request:
paths:
- 'web/**'
- '.github/workflows/web.yml'

jobs:
test:
name: Typecheck and coverage gate
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: web/package-lock.json
- run: npm ci
- run: npm run typecheck
- run: npm run test:coverage
221 changes: 221 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"test": "vitest run"
"test": "vitest run",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"react": "^19.2.7",
Expand All @@ -20,6 +21,7 @@
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.2",
"@vitest/coverage-v8": "^4.1.9",
"tailwindcss": "^4.3.1",
"typescript": "^6.0.3",
"vite": "^8.0.16",
Expand Down
3 changes: 3 additions & 0 deletions web/src/engine/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export function power(baselineRate: number, mde: number, nPerArm: number, alpha
const p1 = baselineRate
const p2 = Math.min(Math.max(baselineRate + mde, 0), 1)
const se = Math.sqrt((p1 * (1 - p1)) / nPerArm + (p2 * (1 - p2)) / nPerArm)
// Defensive: se is always > 0 here, because the guard above forces baselineRate
// into (0,1), so p1(1-p1) > 0. Kept as a safety net; unreachable by construction.
/* v8 ignore next */
if (!(se > 0)) return 0
const zAlpha = normalQuantile(1 - alpha / 2)
const z = Math.abs(mde) / se - zAlpha
Expand Down
Loading
Loading