Repository navigation
test(email): fail when the npm client's schema version drifts from contract.py - #6913
Conversation
…ntract.py Check npm/src/types.ts SCHEMA_VERSION and the version npm/SPEC.md says the client pins against contract.SCHEMA_VERSION, from the Python lane, naming both versions on a mismatch. Closes amd#2922
|
Verdict: Approve This PR adds two tests that fail when the npm email client's contract version stops matching the Python sidecar's. One checks the constant in the TypeScript types and one checks the version the npm SPEC states in its intro. Each failure names both versions and says what to update. This closes the gap that let #2910 ship a version split with CI green. The existing TypeScript parity test can skip without warning, but these run in the Python lane and have nothing to skip on. I found no blocking issues. Real-world evidenceN/A: this PR only changes tests, and no evidence bundle was produced. The verdict rests on static review. The PR description shows the author's run: both tests pass with the versions matched at 2.15, and both fail with clear messages after bumping only the Python side to 2.16. 🔍 Technical detailsChecks
Strengths
|
Summary
Adds two checks to
hub/agents/email/python/tests/test_doc_consistency.pythat fail when the npm client's contract version drifts fromcontract.py'sSCHEMA_VERSION: one for theSCHEMA_VERSIONconstant innpm/src/types.ts, and one for the version the intro ofnpm/SPEC.mdsays the client pins. Both name the two versions in the failure message.Why
#2910 bumped the Python contract to 2.13 and left the npm client on 2.12 with CI green. Since this issue was filed, #3787 (for #2746) added a TypeScript parity test in
npm/test/query-integration.test.ts, which covers the constant when it runs. Two gaps remain:describe.skipIf(!python): when Node can't resolve a Python withgaia_agent_emailinstalled (and always on Windows), it skips silently, which is the failure mode fix(email-npm): tests hardcode schema 2.4 against a 2.10 sidecar, hidden by a silently-skipped suite #2746 was about. The new check readstypes.tsfrom the Python lane, so there is no interpreter lookup to skip on.npm/SPEC.md("This client pinsSCHEMA_VERSION2.15, matching the sidecar's current contract"), which the issue lists as a second place the version can rot.Both checks run in
test_email_agent_unit.yml, which already runshub/agents/email/python/tests/and triggers on changes tohub/agents/email/python/**andhub/agents/email/npm/**, so a PR touching either side runs them.Linked issue
Closes #2922
Changes
test_npm_client_pins_the_contract_version: readsexport const SCHEMA_VERSION = "…"fromnpm/src/types.tsand compares it withcontract.SCHEMA_VERSION.test_npm_spec_states_the_contract_version: reads the version from thenpm/SPEC.mdintro sentence and compares it the same way.schema version split: contract.py = 2.16, npm/src/types.ts = 2.15. Bump both in the same change.Test plan
main):pytest hub/agents/email/python/tests/test_doc_consistency.py→ 8 passed, 1 skipped. The skip is the existingemail-integration.mdxcase, unrelated.contract.pyto 2.16: both new tests fail, naming both versions (output under Evidence). Restoring 2.15 makes them pass again.python util/lint.py --all: Black, isort, Flake8 and Test Lane Coverage pass. The only failure is two existing Pylint E1120 errors insrc/gaia/utils/awake_clock.py:47andsrc/gaia/utils/terminal.py:109, which this PR doesn't touch.Evidence
Checklist
Closes #N/Fixes #N/Refs #N).python util/lint.py --all,pytest tests/unit/).