fix(storage): harden project store authority and resolution - #506
Open
HashemKhalifa wants to merge 17 commits into
Open
fix(storage): harden project store authority and resolution#506HashemKhalifa wants to merge 17 commits into
HashemKhalifa wants to merge 17 commits into
Conversation
Consolidation normalizes private session snapshots while holding the enclosing profile's exclusive maintenance lease. Map only its reserved staging directory to that profile authority, and keep append-only hook telemetry outside immutable confirmation fingerprints without dropping its bytes.
Reserve profile maintenance authority for the two session snapshots created by consolidation. Other files under the staging directory keep their independent database identity.
🦋 Changeset detectedLatest commit: a818fcd The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Branch-scoped stores must not inherit repository-wide dirty state from sibling worktree syncs. Reuse Database::open's read-only validation to avoid a second full recovery scan.
Dirty zero-length databases must fail before writable initialization so recovery bytes and markers remain available for offline repair.
Contributor
Author
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 043a047e03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Treat unreadable auxiliary state as a conflict, validate the serving branch before identity repair, and recheck cached writable connections during dirty recovery.
Establish every bounded inventory health signal before populated graph or session data may authorize exact-root selection.
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.
Summary
Root cause
Project resolution treated store comparison as an inventory operation even on authoritative and conflict-reporting paths. Preserved candidates therefore caused expensive graph and session-table diagnostics before ordinary graph tools could run. Branch-scoped stores could also be misclassified because health checks opened the root graph rather than the serving branch graph. An explicit selector for the already-active project opened the same store a second time, re-entering resolution and amplifying the delay.
A separate hot path remained in session correlation: ordinary requests traversed large correlation tables for diagnostic counts. During restart, scheduler shutdown could also wait indefinitely for writer administration, and watcher shutdown awaited one task before aborting the rest. The process could remain alive while the listener stopped making progress.
Crash recovery also validated the same non-empty database twice: the lifecycle performed a read-only preflight, then
Database::openperformed its own WAL-aware read-only validation before writable pragmas and migrations. Branch syncs additionally published a repository-wide legacy dirty marker, allowing one sibling worktree to trigger recovery in another branch graph. Dirty zero-length stores required an explicit guard because the ordinary open path correctly treats a zero-length database as fresh outside recovery.Behavior after this change
count_mode: presence_onlyValidation
cargo check --workspacecargo fmt --checkgit diff --checkOne-time transcript catch-up and stale-index refresh remain cold-start work; they are separate from the repeated recovery scans fixed here.
commitlintwas unavailable in this checkout (commitlint: command not found); all commit subjects follow the repository's conventional format.