Harden test determinism and restore frontend CI gating#135
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens test determinism across backend and frontend suites and restores required frontend test gating in CI, while preserving the existing full locale coverage.
Changes:
- Inject backend test environment variables deterministically from
example.envvia a JestsetupFileshook (including non-default secret/password values). - Refactor frontend
longFormatDatetests to avoid brittle exact-string assertions while keeping the full locale matrix, and run frontend tests underTZ=UTC. - Update CI workflow to remove
.envbootstrapping, setTZ=UTC, and run both backend and frontend test suites as part of the required gate.
Reviewed changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds cross-env lock entry for cross-platform TZ=UTC script support. |
| package.json | Runs frontend tests with TZ=UTC via cross-env; adds cross-env to devDependencies. |
| jest.backend.config.ts | Wires new backend Jest setup file into setupFiles while preserving preset setup files. |
| src/tests/backend/setup-env.ts | New Jest setup file to load/inject env from example.env with deterministic secret/password values. |
| src/tests/backend/secrets.test.ts | Removes hard failure on missing .env; replaces with non-blocking onboarding warning. |
| src/tests/frontend/frontend-utilities.test.ts | Replaces brittle locale prose assertions with deterministic Intl-based structural/equality checks across full locale matrix. |
| .github/workflows/netlify-api-test.yml | Removes .env bootstrap, sets TZ=UTC, and restores frontend test gating alongside backend tests. |
| README.md | Updates test instructions to reflect deterministic backend env injection and frontend TZ=UTC contract. |
| docs/plans/phase-03-test-determinism-and-ci-hardening.md | Expands Phase 03 plan with explicit scope decisions and determinism strategy. |
| docs/plans/phase-03-checklist.md | Adds completed Phase 03 checklist mapping to implemented work items. |
| docs/norms/implementation.md | Adds “run yarn run fix before opening a PR” convention. |
| docs/archive/phase-02-backend-correctness-and-cors.md | Archives Phase 02 checklist documentation. |
| docs/archive/phase-01-5-ci-stabilization-and-test-gating.md | Archives Phase 01.5 CI stabilization/test gating documentation. |
| docs/archive/phase-01-5-checklist.md | Archives Phase 01.5 checklist documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 03: test determinism and CI hardening.
This PR completes checklist items C01-C11 and restores required frontend test gating in CI while preserving full locale coverage.
What changed
Backend test env determinism
src/tests/backend/setup-env.tssetupFilesinjest.backend.config.tsexample.envand inject deterministic non-default values for*SECRET*/*PASSWORD*.src/tests/backend/secrets.test.ts:.envfile existenceFrontend locale/date determinism (full matrix preserved)
src/tests/frontend/frontend-utilities.test.ts:TZ=UTC:package.jsonyarn.lock(addedcross-env)CI hardening and gating
.github/workflows/netlify-api-test.yml:.envbootstrap command (node ./scripts/createTestEnv.mjs) from backend test pathTZ=UTCfor test executionyarn test:frontendin required workflowDocumentation
docs/plans/phase-03-checklist.mddocs/plans/phase-03-test-determinism-and-ci-hardening.mddocs/norms/implementation.md(yarn run fixbefore PR).envon diskTZ=UTCValidation
yarn test:backend(with.envpresent)yarn test:backend(with.envtemporarily removed)yarn test:frontendyarn testyarn run fixthenyarn testagainAll suites pass locally after changes.
Scope notes