feat(board): SEA-1728 part 4a — durable issue projection + live issue=16 fan-out - #174
Merged
Merged
Conversation
…=16 fan-out IssueProjection: PG-rehydrated board issue cache fronting the store of record, fanning upserts onto SubscribeEvents as the issue=16 variant. Holds the sole proto<->store mapping edge (issueToProto/protoToForgeFields). PublishIssueUpdate commits+reads-back committed truth outside the lock, records+publishes under it. Snapshot/Rehydrate are the surface part 4b's ListBoardIssues handler reads. Co-Authored-By: Matt Wilkinson <matt@sealedsecurity.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 4a of the SEA-1728 board projection: the durable issue projection and its live
issue=16fan-out. Matt ruled the connect-time snapshot is delivered the comms way (boundary frame +ListBoardIssuesread RPC) — that is part 4b, gated on the compass-repo proto PR (#172). This PR is the buildable-now core: the live upsert fan-out, the PG-rehydrated durable cache, and theSnapshot()/Rehydrate()surface 4b reads.What lands
go/internal/board/issue_projection.go—IssueProjection, sibling to the sessionProjection:PublishIssueUpdate(ctx, *Issue)— the part-3 ingestion sink. Maps proto →store.IssueForgeFields,UpsertIssueForgeFields(durable commit → stable id),GetIssuereads back the full committed row, maps back, records in the cache +Publishes theSubscribeEventsResponse_Issue(issue=16) variant. The DB round-trip runs outside the projection mutex (mirrorsPublishSessionStatuslock discipline); only the map-record + non-blockingPublishare under the lock. The read-back is load-bearing: it makes a prior human-set lifecycle state visible on the wire, so a forge re-poll fans committed truth, not a clobbered state (the 3a no-clobber property, now observable).Snapshot()— every issue, all states incl.ARCHIVED(the Done view needs archived), sorted by id, each a deep clone the caller owns. The surface 4b'sListBoardIssueshandler reads.Rehydrate(ctx)— loads the durable board from Postgres into the cache at boot (DL-019: the store is truth, the projection is a read-through cache). Does not publish.issueToProto/protoToForgeFields— the sole proto↔store mapping edge (this is the only place importing bothstoreandcompassv1; the store package imports no generated code). The forge-only input carries no lifecycle/machinery field, the compile-time guarantee the forge upsert cannot clobber state.Depends on parts 3a + 3 (both merged)
4a imports
store.Issue/UpsertIssueForgeFields/GetIssue/ListIssuesfrom part 3a (#167) and is the projection sink for part 3 ingestion (#168) — both merged tomain, so this PR targetsmaindirectly. No serve.go wiring here — constructing the projection +Rehydrateat boot + wiring it as the part-3 ingestion sink lands with 4b.Review
One adversarial review pass (
overall_correctness: correct, 0 high, 2 medium, 4 low). All fixed or noted:cloneIssuewas a manual field-by-field copy that silently omittedTracker/Prs(nil today, a drift hazard on evolution) → replaced withproto.Clone, which tracks the message definition automatically.Forge.Host+Labels[0]and assert the cache is untouched (the sub-message/slice deep-copy is the load-bearing half).TestPublishInvalidIssueErrorsWithoutRecordingOrFanning— an empty coordinate returns the wrapped store error and records/fans nothing (trailing-sentinel proves the negative fan-out).PublishIssueUpdate(the commit-order-vs-lock-order window is harmless while one poller owns each coordinate).UpsertIssueForgeFieldsthenGetIssue); folding to one would change the frozen 3a store API (RETURNING *) — tracked as a store-layer follow-up, out of scope here.Verification
golangci-lint run --config .golangci.yml ./internal/board/...= 0 issues;go build ./... && go vet; default-lanego test; andgo test -tags pgtest -race ./internal/board/...— 6 projection cases (fan-out, committed-state read-back, sorted deep-clone Snapshot, Rehydrate durability, empty board, invalid-issue error path) + every existing board test, green, no race.Refs SEA-1728.