fix: build SSE snapshot from a single read transaction #14

Closed
opened 2026-07-03 12:38:37 +00:00 by a73x · 1 comment
a73x commented 2026-07-03 12:38:37 +00:00 (Migrated from git.a73x.sh)

[claude 2026-07-03] Fixes a788e7f9. store.Snapshot() reads hosts + AllocatedByHost + VMs in one tx (querier interface shares scan logic with the standalone reads); SSE marshalSnapshot builds from that trio so a concurrent epoch bump can't produce a mixed payload. GET /hosts and /vms endpoints unchanged. TDD: TestSnapshotReadsAllThreeConsistently (build-fail RED, then green). make ci green.


Migrated from git-collab patche 4b953aa23321902892a6ba8656e0a93da12d6320.

Original author: a73x dev@a73x.sh.

Fixes git-collab issue a788e7f9

Historical merged patch. The original head and merge commits were not recorded. Forgejo cannot display a pull request without a head commit, so this record is preserved as a closed issue. The original diff is unavailable; no commit was guessed.

Original branches: fix/sse-snapshot-tx → main.

[claude 2026-07-03] Fixes a788e7f9. store.Snapshot() reads hosts + AllocatedByHost + VMs in one tx (querier interface shares scan logic with the standalone reads); SSE marshalSnapshot builds from that trio so a concurrent epoch bump can't produce a mixed payload. GET /hosts and /vms endpoints unchanged. TDD: TestSnapshotReadsAllThreeConsistently (build-fail RED, then green). make ci green. --- Migrated from git-collab patche `4b953aa23321902892a6ba8656e0a93da12d6320`. Original author: a73x <dev@a73x.sh>. Fixes git-collab issue `a788e7f9` **Historical merged patch.** The original head and merge commits were not recorded. Forgejo cannot display a pull request without a head commit, so this record is preserved as a closed issue. The original diff is unavailable; no commit was guessed. Original branches: `fix/sse-snapshot-tx` → `main`.
a73x commented 2026-07-03 12:51:31 +00:00 (Migrated from git.a73x.sh)

Original review: comment (revision not recorded)

[claude 2026-07-03] Fresh-context reviewer verdict: ready to merge; one Important test-quality finding — the test pinned equivalence, not single-tx atomicity (a no-tx Snapshot passed it). Applied in follow-up commit: concurrent-mutator test deriving alloc from the snapshot's own vms (mutation-checked — naive three-call version fails on snapshot 0; real impl race-clean), plus the reviewer's GET /hosts skew follow-up fixed inline by reading via Snapshot. Reviewer confirmed: SetMaxOpenConns(1)+WAL makes the tx safe (no deadlock/starvation; same pattern as DesiredForHost); Commit-vs-Rollback equivalent for read tx; registry reads correctly outside the tx (different clock domain). make ci green. Merging per session goal.

**Original review: comment** (revision not recorded) [claude 2026-07-03] Fresh-context reviewer verdict: ready to merge; one Important test-quality finding — the test pinned equivalence, not single-tx atomicity (a no-tx Snapshot passed it). Applied in follow-up commit: concurrent-mutator test deriving alloc from the snapshot's own vms (mutation-checked — naive three-call version fails on snapshot 0; real impl race-clean), plus the reviewer's GET /hosts skew follow-up fixed inline by reading via Snapshot. Reviewer confirmed: SetMaxOpenConns(1)+WAL makes the tx safe (no deadlock/starvation; same pattern as DesiredForHost); Commit-vs-Rollback equivalent for read tx; registry reads correctly outside the tx (different clock domain). make ci green. Merging per session goal.
Sign in to join this conversation.
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
a73x/eitri#14
No description provided.