Algorithm verification
Every algorithmic change requires meaningful automated tests. Tests use synthetic data and independently check intended behavior, not merely mirror implementation lines. Run formatting, TypeScript, unit/API tests, a production build and affected browser flows before deployment. CI runs these checks and a dependency audit.
| Area | Required evidence |
|---|---|
| Bayesian trend | Hand-derived posterior and Student-t quantile; gaps, constants, shrinkage, bounds, duplicate dates |
| Multivariable regression | Orthogonal-design reference posterior; proper-prior behavior under collinearity; coefficient units; credible vs predictive widths |
| Forecast evaluation | Synthetic known generating relation; strict chronological embargo; unchanged earlier predictions when held-out outcomes change; matched baseline rows |
| Correlations | Pearson/rank references, tied ranks, constants, nonfinite values, calendar lags, first differences and linear detrending |
| Bootstrap | Reproducible seed, known perfect-correlation interval, insufficient blocks/pairs and degenerate replicates |
| Feature transforms | Complete rolling windows, missing calendar dates, categorical unknown/zero distinctions, cyclic clock encoding |
| Import/export | Full-format round trips, selective merge, notes preservation, Unicode/CSV quoting, duplicate dates, invalid schemas, unknown keys, formula mitigation |
| API and administration | Real SQLite queries, owner isolation, revision conflicts, body/selection bounds, account-switch guard, explicit admin grants and denied forged roles |
| Accounts | Hash verification, session expiry/versioning, concurrent one-use recovery, legacy-ID migration, throttling and account deletion |
| Motion | Viewport-triggered reveals, delayed SVG layers, cleanup, fixed chart geometry, live reduced-motion cancellation and missing browser APIs |
| Appearance | Sunrise/sunset boundaries, polar conditions, light/manual fallback, denied permission/storage |
| Demo workspace | Reproducible schema-valid fixture and SQL seed; immutable baseline; fixed-owner public reads and denied private reads; leap-day projection; null/rest distinctions; isolated CRUD/import/export; cancelled loads, retry, public deep links, mobile layout and authenticated redirects |
| Release packaging | Strict file boundary, symlink rejection, reference SHA-256 digests, version/tag consistency, preserved production bindings and extracted-archive browser tests |
Vitest runs the mathematical and SQLite-backed API suites. Playwright runs the compiled application against local Wrangler/D1 and the actual AuthService Durable Object, including a strict authentication server. It covers registration/recovery, journal CRUD, selective export/import, labels, analysis Web Workers, model downloads, themes, mobile layout and public author information.
CI builds a clean committed checkout and runs the browser suite against the extracted Cloudflare release archive with npm run release:test. Source development uses npm run test:e2e. Both modes use the same browser assertions and isolated synthetic stores. See Releases for package contents, provenance and publication gates.
Browser fixtures use isolated .wrangler/e2e* directories that are reset at startup. Real development or production databases are not test fixtures. Screenshots/traces are ignored and are not uploaded to public CI. Production verification uses short-lived synthetic accounts and removes their data afterward.
Tests demonstrate implementation properties, not clinical validity. Synthetic prediction accuracy does not establish real-user accuracy. Changes to model semantics require a model-version change and updated mathematical documentation; deployed SQL migrations are append-only.
Account-form regression tests reproduce a mobile short-password submission, assert field errors and focus without an API request, and verify correction, mismatched passwords, privacy acknowledgement, recovery-code format, duplicate-email responses, loading state and throttling messages. Shared credential tests cover exact length boundaries and normalization without changing passwords.
Workspace regressions verify stale-tab writes and streamed exports against a second account, authenticated account-operation guards, historical-only journal discovery, session-outage retry, visible account/check-in validation, blocked navigation during a pending save, recovery-code copy/navigation failures, complete demo backups, and analysis-worker failure feedback. Tests exercise 320 px and 390 px layouts using synthetic records.
Localization and activity contracts
Catalog tests require every language namespace, message key, interpolation and rich-text slot. Runtime tests check numeric/date locale selection, Polish plural categories, metadata and validation rendering, and canonical record round trips with original Unicode notes and case-preserving custom labels. Geography fixtures cover supported cities, oceans, invalid coordinates, holes and disconnected polygons. Browser tests visit every major demo view in all six languages at mobile widths, exercise permission-controlled defaults, and preserve drafts while switching activity labels. Every activity ID is validated through the journal schema.
Interval evaluation tests check hand-calculated width and tail penalties, equal-boundary observations, signed errors, scale/translation equivariance and invalid/empty inputs. Extended-horizon tests verify calendar alignment, missing targets, posterior invariance for trend extrapolation, widening trend intervals and leakage-free 14/28-day holdouts. Browser checks cover compact mobile navigation, chart resizing, held-out plots, source links, long horizons, result shortcuts and localized range spacing.
Habit tests cover canonical identity, original Unicode names, missing versus zero, repeated/partial times, midnight circular components, feature continuity, selective-note round trips, private library isolation, import triggers and stale revisions, old-client protection and deletion cascades. Historical-review tests cover reference thresholds, variance floors, insufficient data, source/HRV compatibility, future exclusion, actual calendar lags, detrending, unstable associations and unchanged observations. Browser scenarios exercise custom activity creation/reuse/archive on mobile, public demo isolation and confirmation invalidation after editing. Migration tests reproduce the synthetic habit extension and enforce demo immutability.
Personalization contracts
Preference tests cover strict identifiers, original custom names, deterministic recency/frequency tie-breaking, independent field merges, zero-versus-null visibility, blank routine templates, archived definitions, sport field capabilities and demo isolation. API tests verify expected-owner/origin checks, concurrent per-setting writes, SQL counter increments, no-store responses and deletion cascades. The SQLite test adapter serializes batches like D1 and returns rows from RETURNING statements.
Browser tests exercise immediate settings without saving observations, reloads and date changes, existing hidden-field values, blank recurring habits, saved source/method metadata, conditional sport fields, demo reset, retry ordering, searchable collapsed definitions and mobile layout.