Build durable Pantry committed-state transactions - #114
Open
fproulx-boostsecurity wants to merge 2 commits into
Open
Build durable Pantry committed-state transactions#114fproulx-boostsecurity wants to merge 2 commits into
fproulx-boostsecurity wants to merge 2 commits into
Conversation
fproulx-boostsecurity
requested review from
SUSTAPLE117 and
Talgarr
and
a lite review from Copilot
August 5, 2026 17:30
There was a problem hiding this comment.
Pull request overview
This PR introduces a persistence-first pantry.CommittedState transaction boundary that commits exactly one durable snapshot per logical write, advances a monotonic Pantry revision, and publishes a single typed ChangeSet to observers. It updates Kitchen write paths (analysis import, purge, known-entity upsert, metadata sync) to route through this committed boundary, upgrades schema to 3.0, and adapts GraphHub to consume the new change stream.
Changes:
- Added
CommittedStatewith snapshot validation, serialization, atomic persistence, stable live-state replacement, and typedChangeSetpublication. - Replaced Pantry mutation-time versioning/observer callbacks with committed revisions, snapshot-based serialization, and defensive-copy semantics for returned graph data.
- Updated Kitchen handlers, GraphHub, and DB persistence adapter to use the committed snapshot store and revision-based graph versioning (schema 3.0).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pantry/observer.go | Consolidates observer callbacks into a single OnPantryChange(ChangeSet) notification path. |
| internal/pantry/graph.go | Adds revision tracking, snapshot-based JSON (un)marshal, defensive-copy helpers, and committed writer gate + live replacement. |
| internal/pantry/graph_test.go | Removes legacy observer-behavior tests; keeps graph/property behaviors. |
| internal/pantry/filter.go | Propagates committed revision into derived subgraphs. |
| internal/pantry/committed_state.go | Implements durable committed-state transactions with snapshot diffing + publication contract. |
| internal/pantry/committed_state_test.go | Adds coverage for durability, rollback, cancellation, concurrency, defensive copy, and large-graph scenarios. |
| internal/kitchen/server.go | Removes shutdown-time best-effort Pantry save path. |
| internal/kitchen/purge.go | Routes purge mutations through committed Pantry updates with request context. |
| internal/kitchen/purge_test.go | Verifies purge commits a revision and persists the committed snapshot. |
| internal/kitchen/handlers.go | Adds cached committed-state wiring and replaces SavePantry with committed snapshot persistence. |
| internal/kitchen/graph.go | Switches graph snapshot versioning from Version() to committed Revision(). |
| internal/kitchen/graph_ws.go | Updates websocket payload version types from int64 to uint64. |
| internal/kitchen/graph_hub.go | Adapts hub to ChangeSet (granular deltas vs committed-state marker snapshots). |
| internal/kitchen/graph_hub_test.go | Adds tests validating ChangeSet translation and committed-state marker behavior. |
| internal/kitchen/db/schema_test.go | Adds rejection test for schema 2.x with purge guidance messaging. |
| internal/kitchen/db/pantry.go | Replaces SavePantry with PantrySnapshotStore and copies bbolt bytes defensively on load. |
| internal/kitchen/db/pantry_test.go | Adds tests for persisted revision re-open and snapshot-store byte ownership. |
| internal/kitchen/db/db.go | Bumps Kitchen schema to 3.0. |
| internal/kitchen/committed_pantry_test.go | Validates Kitchen routes known-repo writes through committed Pantry and restores revision on restart. |
| internal/kitchen/analyze.go | Commits analysis graph replacement via CommittedState.Replace and commits metadata sync updates via Update. |
| internal/kitchen/analyze_test.go | Updates tests to use committed paths and asserts revision persistence. |
| internal/kitchen/analyze_perf_test.go | Updates perf harness to measure committed import/inventory paths instead of legacy save. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #107
Summary
Stack
This PR is stacked on #113 and targets
plan/analysis-ingestion-implementation. It should be reviewed and merged by the maintainers in stack order.Verification
go test -race ./internal/pantry ./internal/kitchen/db ./internal/kitchenmake testmake lint