Skip to content

fix(drift): membership test, robust to backfills and API throttling#17

Merged
jcschaff merged 2 commits into
mainfrom
fix/drift-membership
Jul 3, 2026
Merged

fix(drift): membership test, robust to backfills and API throttling#17
jcschaff merged 2 commits into
mainfrom
fix/drift-membership

Conversation

@jcschaff

@jcschaff jcschaff commented Jul 3, 2026

Copy link
Copy Markdown
Member

Problem

check-drift and doctor flagged false drift on virtualcell/vcell (issue #16): GitHub's latest release 8.0.0.06 was archived on Zenodo, yet the monitor reported drift.

Root cause: the check compared the latest GitHub release tag against public_latest_version — the concept's newest version by created. That proxy breaks after a backfill. vcell was backfilled on 2026-07-02 with historical per-release records and curated major rollups (7.2 … 8.0); all got created=today, so the 8.0 rollup (label 8.0, built from 8.0.0.01) became the newest-by-created version. 8.0.0.06 != 8.0 → false drift, even though 8.0.0.06 has its own archived record.

Fix

Ask a membership question instead: is a version labeled exactly the latest release tag published in the concept?

Implemented as a single tokenless searchq=conceptrecid:<id> AND metadata.version:"<tag>" — deliberately not an enumerate-all-versions scan. The unauthenticated records API is rate-limited to 30 req/min; paging vcell's ~490 versions (25/page → 20 pages) 429s mid-scan and would silently undercount into false drift. The phrase match is exact (verified: "8.0" does not match 8.0.0.06; "8.0.0" and "8" return 0), so one request answers precisely and deterministically.

Shared helper latest_release_archived wired into both check-drift and doctor section C, so they can't diverge. Removed public_latest_version (unused, and it embodied the exact buggy notion).

Trade-off

Matches on the version label, which the per-release archiver sets to the source tag. A release captured only inside a relabeled curated rollup (label ≠ tag, no per-release record) wouldn't be found — acceptable: the archiver's default labels a record by its tag, and erring toward flagging drift is the intended loud-on-failure behavior.

Verification

  • ruff + mypy --strict clean; 26 unit tests pass (added hits_total total-shape parsing).
  • Live: vcell now IN SYNC deterministically (was flaky 407–467 "tags" under throttling with the enumeration approach I first tried); vcell-solvers / pyvcell in sync; a mismatched repo/concept pair still DRIFTs with exit 2; doctor section C shows ✓.
  • Reusable drift.reusable.yml and monitor.yml drive the check-drift CLI (interface unchanged) — no workflow edits needed.

Closes the class of false positive behind #16.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BZx7w9BexQc9wWU5JoHYaF

jcschaff and others added 2 commits July 3, 2026 06:11
check-drift and doctor compared the latest GitHub release tag against
`public_latest_version` (the concept's newest version by `created`). That
proxy breaks after a backfill: backfilled records — historical releases and
curated major rollups alike — are created *today*, so an old rollup becomes
the newest-by-`created` version and the tag never equals its label, producing
false drift (e.g. virtualcell/vcell: GitHub 8.0.0.06 vs rollup label 8.0,
though 8.0.0.06 was in fact archived).

Replace with a membership test: is a version labeled exactly the latest
release tag published in the concept? Implemented as a single tokenless
`metadata.version:"<tag>"` search (public_tag_archived), NOT an
enumerate-all-versions scan — the unauthenticated records API is capped at
30 req/min, so paging a large concept (vcell has ~490 versions) 429s mid-scan
and would silently undercount into false drift. The phrase match is exact, so
one request answers the question precisely and deterministically.

- api: add hits_total, public_tag_archived, latest_release_archived
- api: drop now-unused (and bug-embodying) public_latest_version
- cli: wire both check-drift and doctor section C to the shared helper
- tests: hits_total total-shape parsing (int vs {"value": n})
- README: describe the membership-based drift check

Verified live: vcell now IN SYNC deterministically (was flaky 407-467 tags
under throttling); a mismatched repo/concept still DRIFTs with exit 2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZx7w9BexQc9wWU5JoHYaF
…imits

- Add the two previously-undocumented commands: list-owned (#13) and bootstrap.
- Reword check-drift to describe the membership semantics from this branch.
- Add an API gotcha: the public records API is 30 req/min and caps size at 25,
  so query one tag rather than enumerating all versions tokenlessly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZx7w9BexQc9wWU5JoHYaF
@jcschaff jcschaff merged commit 1533b9e into main Jul 3, 2026
1 check passed
@jcschaff jcschaff deleted the fix/drift-membership branch July 3, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant