You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci(fidelity): wire strict fidelity check into lint.yml (#72)
Enforces strict upstream parity for mapped core files in CI. Closes#53.
- scripts/verify_test_fidelity.py: --strict mode (default) fails on any missing test, --update-baseline writes the file with dynamic ts_parity from UPSTREAM_PARITY
- Fails cleanly when upstream checkout is missing (no silent skip-and-exit-0)
- Validates baseline ts_parity against UPSTREAM_PARITY to catch drift after upstream bumps
- lint.yml: clones vercel/chat@4.26.0 to /tmp/vercel-chat then runs --strict; clone step is required (no continue-on-error)
- fidelity_baseline.json: empty, ships at zero-missing for mapped core files (8 of 17 packages/chat/src/*.test.ts)
- Follow-ups: #78 (MAPPING expansion), #79 (SHA pin clone), #80 (fuzzy matcher hyphen)
Copy file name to clipboardExpand all lines: docs/UPSTREAM_SYNC.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,38 @@ tests. If upstream tests lock in inconsistent behavior, choose one of:
72
72
-**Preserve parity** and document the inconsistency in the non-parity section below
73
73
-**Intentionally diverge** and document the divergence in the non-parity section
74
74
75
+
### Test fidelity (strict mode)
76
+
77
+
`scripts/verify_test_fidelity.py` runs in CI (`.github/workflows/lint.yml`) pinned
78
+
to `vercel/chat@4.26.0` (matches the `UPSTREAM_PARITY` constant in
79
+
`src/chat_sdk/__init__.py`). **CI runs `--strict`** — the repo ships at 0
80
+
missing *for mapped core files* as of `0.4.26.2` and the baseline
81
+
(`scripts/fidelity_baseline.json`) is empty. Scope is defined by the
82
+
`MAPPING` dict in the script: 8 of 17 `packages/chat/src/*.test.ts` files
83
+
today (extending to the remaining 9 is tracked as a follow-up). Unmapped
84
+
files are not checked — tightening scope requires editing `MAPPING` and
85
+
re-running `--strict`.
86
+
87
+
Infra guardrails:
88
+
89
+
- The workflow's `Clone upstream vercel/chat at pinned parity tag` step does
90
+
**not** use `continue-on-error` — a failed clone aborts the job loudly.
91
+
- The script itself fails with exit 1 if any mapped TS file is missing under
92
+
`TS_ROOT` (defense in depth against silent skips).
93
+
94
+
Workflows:
95
+
96
+
| Goal | Command |
97
+
|------|---------|
98
+
| Port a missing test | Write the Python test and land it; CI rejects anything that re-introduces a gap |
99
+
| Add a Python-only divergence (intentional skip) | Document in [Known Non-Parity](#known-non-parity-with-typescript-sdk), then `--update-baseline` and switch the workflow back to non-strict default for that file if truly unavoidable |
100
+
| Upstream sync | After pulling new upstream, run `--strict` — newly-added TS tests appear as missing and CI fails until ported |
101
+
| Final parity check | Same as CI: `TS_ROOT=/tmp/vercel-chat uv run python scripts/verify_test_fidelity.py --strict`|
102
+
103
+
Baseline mode (the default without `--strict`) is retained for local
104
+
development where a few ports land in flight. Regenerate the baseline via
105
+
`--update-baseline` rather than hand-editing.
106
+
75
107
## Divergence Policy
76
108
77
109
Every divergence from upstream has a cost: merge conflicts on future syncs,
"_comment": "Ratchet-down baseline for scripts/verify_test_fidelity.py. This repo ships at strict fidelity for mapped core files (0 missing) against chat@4.26.0, so the baseline is empty. Scope: the MAPPING dict in scripts/verify_test_fidelity.py is the authoritative list of TS files checked; it currently covers 8 of the 17 packages/chat/src/*.test.ts files. Default CI mode runs --strict via .github/workflows/lint.yml; this file is retained for local workflows that want to opt back into baseline mode (e.g. during an upstream sync where several ports land in flight). To baseline genuinely-divergent tests, run scripts/verify_test_fidelity.py --update-baseline after documenting the divergence in docs/UPSTREAM_SYNC.md.",
0 commit comments