fix(workers): single-source contract version for the v3 result envelope (ADR 0113 V5) #1263

Merged
chris merged 1 commit from fix/v3-contract-version-stamps into main 2026-10-16 19:54:18 +02:00
Owner

Summary

Fixes the failure of the first live G4 run (job 8ae71e61, 2026-10-16): Core rejected the semisupervised-v3 result submission with 400 clusteringContractVersion mismatch: expected 2, got 1.

Root cause: two stamp sites, two truths. The per-candidate _stamped helper derived the contract version from the method (v3→2), but the result-ENVELOPE stamp in main.py hardcoded SEMISUPERVISED_CONTRACT_VERSION (=1) for every single-pass method. The v3 worker suite pinned candidate stamps and the job-settings validation but never the envelope stamp — exactly the gap.

Fix:

  • clustering.py: new contract_version_for_method() as the single source of truth (v1/v2→1, v3→2, unknown→1 = pre-0113 default so a future method that forgets to extend the map degrades to the old contract, never invents a new one); _stamped uses it.
  • main.py: envelope stamp uses the same helper.
  • Tests: envelope-stamp assertions on the v3@2 handler run (the exact live failure), a v2-envelope-stays-at-1 regression, and a direct helper-matrix test.
  • KNOWN_ISSUES.md: ISSUE-164 (resolved).

Test plan

  • PYTHONPATH=workers/people/src .venv/bin/python -m pytest workers/people/tests/ -q → 362 passed, 1 skipped (pre-existing heif), 99 subtests — v1/v2/v3 + registry + prototype suites all green.
  • After merge+deploy the G4 live measurement is re-triggered on the owner domain (currently set to semisupervised-v3).
## Summary Fixes the failure of the first live G4 run (job `8ae71e61`, 2026-10-16): Core rejected the `semisupervised-v3` result submission with `400 clusteringContractVersion mismatch: expected 2, got 1`. **Root cause:** two stamp sites, two truths. The per-candidate `_stamped` helper derived the contract version from the method (v3→2), but the result-ENVELOPE stamp in `main.py` hardcoded `SEMISUPERVISED_CONTRACT_VERSION` (=1) for every single-pass method. The v3 worker suite pinned candidate stamps and the job-settings validation but never the envelope stamp — exactly the gap. **Fix:** - `clustering.py`: new `contract_version_for_method()` as the single source of truth (v1/v2→1, v3→2, unknown→1 = pre-0113 default so a future method that forgets to extend the map degrades to the old contract, never invents a new one); `_stamped` uses it. - `main.py`: envelope stamp uses the same helper. - Tests: envelope-stamp assertions on the v3@2 handler run (the exact live failure), a v2-envelope-stays-at-1 regression, and a direct helper-matrix test. - `KNOWN_ISSUES.md`: ISSUE-164 (resolved). ## Test plan - `PYTHONPATH=workers/people/src .venv/bin/python -m pytest workers/people/tests/ -q` → **362 passed, 1 skipped (pre-existing heif), 99 subtests** — v1/v2/v3 + registry + prototype suites all green. - After merge+deploy the G4 live measurement is re-triggered on the owner domain (currently set to `semisupervised-v3`).
fix(workers): single-source contract version for the v3 result envelope (ADR 0113 V5)
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Run scoped PR tests (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
8708308479
The live G4 run (job 8ae71e61, 2026-10-16) failed submission: Core
rejected the v3 result envelope with 400 'clusteringContractVersion
mismatch: expected 2, got 1'. The per-candidate _stamped helper derived
the version from the method (v3→2), but the envelope stamp in main.py
hardcoded SEMISUPERVISED_CONTRACT_VERSION (=1) for every single-pass
method. The v3 worker suite pinned candidate stamps and job-settings
validation but never the envelope stamp.

- clustering.py: new contract_version_for_method() single source of
  truth (v1/v2→1, v3→2, unknown→1 = pre-0113 default); _stamped uses it.
- main.py: envelope stamp uses the same helper (with WHY comment).
- tests: envelope-stamp assertions on the v3@2 run, a v2 envelope
  stays-at-1 regression, and a direct helper-matrix test.
- KNOWN_ISSUES: ISSUE-164 (resolved).

Full worker suite: 362 passed, 1 skipped (pre-existing heif), 99 subtests.
chris merged commit a75fe28671 into main 2026-10-16 19:54:18 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1263
No description provided.