Skip to content

feat(api): accept ?release= as a snapshot anchor on detail reads - #8

Merged
haksungjang merged 1 commit into
mainfrom
feat/release-anchor-on-detail-reads
Aug 4, 2026
Merged

feat(api): accept ?release= as a snapshot anchor on detail reads#8
haksungjang merged 1 commit into
mainfrom
feat/release-anchor-on-detail-reads

Conversation

@haksungjang

Copy link
Copy Markdown
Contributor

Pinning a past snapshot required its scan UUID, which a caller has no way to know in advance. Answering "what shipped in 4.0" meant listing releases, matching the label client-side, then re-requesting with the id — two round-trips, and no URL you could write down. The fourteen detail endpoints now also accept ?release=4.0, so /notice?release=4.0 is a permanent address for a version. It works because a label identifies exactly one live snapshot (#4).

The label is resolved once in a shared FastAPI dependency, not threaded through fourteen endpoints and the ten services behind them. The translation — turn a label into the scan id the endpoint already handles — is identical everywhere, so putting it in fourteen places would only multiply the chances of the precedence rule drifting. Services keep their existing snapshot_scan_id contract and never learn labels exist.

scan_id wins when both are given: it names one immutable snapshot, while a label names whichever snapshot currently holds it, and the more specific should not be overridden by the looser. An unknown label returns the same existence-hiding 404 an unusable scan_id gets, so neither reveals whether the other exists — that needed a SnapshotScanNotFound handler in core.errors, since a dependency raises before the routers' local try/except.

The anchor follows a moved label: rescanning 4.0 supersedes the earlier claim, and ?release=4.0 resolves to the winner rather than the snapshot that used to hold it. Covered by a test, along with cross-project isolation and the precedence rule.

Third and last of the follow-ups after #6 and #7. Nine local test failures are all reproducible on main (accumulated rows in my dev database).

Pinning a past snapshot needed its scan UUID, which a caller cannot know:
answering "what shipped in 4.0" meant listing releases, matching the label,
then re-requesting. Fourteen detail endpoints now also take ?release=, so
/notice?release=4.0 is a permanent address for a version.

Resolved once in a shared FastAPI dependency rather than threaded through
fourteen endpoints and the services behind them — the translation is the
same everywhere, and the services keep their scan-id contract. scan_id wins
when both are given; an unknown label 404s exactly like an unusable id.
@haksungjang
haksungjang merged commit 0595aa2 into main Aug 4, 2026
24 checks passed
@haksungjang
haksungjang deleted the feat/release-anchor-on-detail-reads branch August 4, 2026 08:30
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