Skip to content

test(email): fail when the npm client's schema version drifts from contract.py - #6913

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
wasiulhaque:test/email-contract-version-parity
Nov 7, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
wasiulhaque:test/email-contract-version-parity

Conversation

@wasiulhaque

Copy link
Copy Markdown
Contributor

Summary

Adds two checks to hub/agents/email/python/tests/test_doc_consistency.py that fail when the npm client's contract version drifts from contract.py's SCHEMA_VERSION: one for the SCHEMA_VERSION constant in npm/src/types.ts, and one for the version the intro of npm/SPEC.md says 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:

  • That test is describe.skipIf(!python): when Node can't resolve a Python with gaia_agent_email installed (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 reads types.ts from the Python lane, so there is no interpreter lookup to skip on.
  • Nothing checked the prose claim at the top of npm/SPEC.md ("This client pins SCHEMA_VERSION 2.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 runs hub/agents/email/python/tests/ and triggers on changes to hub/agents/email/python/** and hub/agents/email/npm/**, so a PR touching either side runs them.

Linked issue

Closes #2922

Changes

  • test_npm_client_pins_the_contract_version: reads export const SCHEMA_VERSION = "…" from npm/src/types.ts and compares it with contract.SCHEMA_VERSION.
  • test_npm_spec_states_the_contract_version: reads the version from the npm/SPEC.md intro sentence and compares it the same way.
  • Each fails with an explicit message if its pattern stops matching, so rewording the source can't turn the check into a silent pass.
  • Failure messages follow the shape in the issue: schema version split: contract.py = 2.16, npm/src/types.ts = 2.15. Bump both in the same change.
  • No version is synced automatically, per the issue's constraints. The checks only report.

Test plan

  • Both files at 2.15 (current main): pytest hub/agents/email/python/tests/test_doc_consistency.py → 8 passed, 1 skipped. The skip is the existing email-integration.mdx case, unrelated.
  • The fix(email): scoped 'anything suspicious?' query no longer dumps the full triage report #2910 case, bumping only contract.py to 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 in src/gaia/utils/awake_clock.py:47 and src/gaia/utils/terminal.py:109, which this PR doesn't touch.

Evidence

  • Agent exposed in the Agent UI: N/A, test-only change.
  • MCP tools / servers: N/A, test-only change.
  • CLI: the check run passing on a matched pair, then failing after bumping only the Python constant:
$ pytest hub/agents/email/python/tests/test_doc_consistency.py -k npm
2 passed, 7 deselected

# contract.py: SCHEMA_VERSION = "2.16"  (types.ts and SPEC.md left at 2.15)
$ pytest hub/agents/email/python/tests/test_doc_consistency.py -k npm
E   AssertionError: schema version split: contract.py = 2.16, npm/src/types.ts = 2.15. Bump both in the same change.
E   AssertionError: schema version split: contract.py = 2.16, npm/SPEC.md says 2.15. Update the SPEC.md intro too.
2 failed, 7 deselected
  • HTTP API / REST: N/A, test-only change.

Checklist

  • I have linked a GitHub issue above (Closes #N / Fixes #N / Refs #N).
  • I have described why this change is being made, not just what changed.
  • I have run linting and tests locally (python util/lint.py --all, pytest tests/unit/).
  • I have attached real-world evidence matched to the surface I changed (see Evidence above), or marked each surface N/A.
  • I have updated documentation if user-visible behavior changed (see CONTRIBUTING.md).

…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
@github-actions github-actions Bot added the agent::email Email agent changes label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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 evidence

N/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 details

Checks

  • I checked both regexes against the current files. types.ts:75 is export const SCHEMA_VERSION = "2.15" as const;. The pattern has no end anchor, so the as const suffix doesn't matter. SPEC.md:5 contains This client pins `SCHEMA_VERSION` **2.15**. Both match, and both agree with contract.SCHEMA_VERSION.
  • I couldn't run pytest here because the runner has no pytest installed. The pass/fail claims come from the PR's test plan.
  • Both tests reuse the existing _declared_schema_version() helper and the existing _NPM_ROOT path, so they follow the conventions already in the file.
  • The PR doesn't change any documented behaviour, so I skipped the documentation-drift check.

Strengths

  • If a source line gets reworded, the test fails with its own message instead of passing, so a refactor can't quietly turn off the guard.
  • The failure messages tell the author exactly which file to bump.
  • The docstring explains why the check sits in the Python lane, given that the npm parity test already exists.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 7, 2026
Merged via the queue into amd:main with commit 030dbe5 Nov 7, 2026
39 of 41 checks passed
@kovtcharov-amd kovtcharov-amd mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(email): nothing checks that the Python and npm contract versions agree — a split ships green

2 participants