Skip to content

refactor(global-db): run configuration and rollup writes as jobs - #4252

Merged
ScriptedAlchemy merged 7 commits into
masterfrom
refactor/storage-global-db-config-jobs
Oct 18, 2026
Merged

ScriptedAlchemy merged 7 commits into
masterfrom
refactor/storage-global-db-config-jobs

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Step 5i-3 of the storage plan: global-db gets RegisteredGlobalDb::transact and its configuration and observability rollup writes become writer jobs.

API. RegisteredGlobalDb::transact(body) runs body as one job over Database::transact and returns Result<Result<R, E>>. The body gets a RegisteredGlobalDbWriteTx, which implements QueryExecutor and Executor, so the existing &impl Executor helpers run in it unchanged. The write scope is checked before queueing. The runtime verifies the same authority at COMMIT, so a scope that ends mid-body rolls the job back. RegisteredGlobalDbWriteTx is exported (approved).

Sites converted. Configuration store (initialize, daemon source binding, registry-shape convergence, component activation, profile commit_direct), control (save_plan, commit_direct, commit_protected, dry_run_rollback, apply_rollback), revision (save_change_plan, commit), and the rollup rebuild, dirty-day claim and release, empty-day frontier initialize, claim and release, and compaction. The configuration mutation-scope probe is now a direct require_active_write_scope check instead of begin-and-rollback.

Behavior kept. A rollup rebuild that finds its stored receipt still ends by rolling back (RebuildAbort::Replayed), so replay does not advance graph_transaction_generation. Bodies are Fn, so each site clones its inputs into the closure. Job failures report one failed to <operation> error where the interactive path reported begin, commit and close separately.

Proof. transact_rolls_back_when_scope_ends_before_commit and copied_transact_handle_cannot_write_after_scope_drop_inside_the_body cover the primitive. A mutation that removed the wrapper's own commit-time scope check left both green, because the runtime already verifies authority at commit. The check is deleted and the decision recorded in decisions.tsv.

Verification (Bazel). global-db unit_test and its five integration targets, rustfmt_check_2024 and --config=clippy on global-db, tracedecay-application unit_test and application_suite, and tracedecay daemon_suite, mcp_suite and session_suite pass. session_suite failed once with 39 schema-init lease timeouts while the host load average was near 500 and passed on a rerun.

Not in this PR: the other global-db sites (stack delivery, observation projection, analytics, LCM and the rest), the old RegisteredGlobalDbWriteTransaction, and the interactive API deletion.


Devin Review

@changeset-bot

changeset-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 52b02a9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ScriptedAlchemy
ScriptedAlchemy merged commit 23ad07d into master Oct 18, 2026
11 of 20 checks passed
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