Repository navigation
feat(db): per-transaction sync mode and chunk size: TxOptions and begin_write_with (#871) - #882
Merged
Merged
Conversation
…nc mode (#871) WalWriter no longer stores a SyncMode: each append is given the mode of the transaction that commits it, so a per-transaction mode cannot leak into later transactions. The lost-sync test fault now cuts the WAL back to its last successful sync, dropping unsynced Normal entries as a real lost fsync would, and a test-only power-loss model ends a handle with the unsynced WAL tail cut off. Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
…nd power-loss models (#871) Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
… modes (#871) Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
…ction (#871) Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
Configuration, durability and README text for the per-transaction options, the CHANGELOG entry, the test-coverage section, and a dated note in the #862 design recording that the WAL guard of a large transaction is always synced. Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
…s in the mixed fault matrix (#871) The begin_write_with example now runs in memory on every target, and the TxOptions file example is compiled only off wasm32, as the other file-database examples are. The mixed-mode fault matrix now requires a lost sync of a Full commit to drop the unsynced entries before it, and a Normal commit to make no sync at all. Part of #862. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf
adityamukho
force-pushed
the
feat/871-tx-options
branch
from
November 10, 2026 04:11
f551f74 to
cb02e54
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Implements #871. Part of #862 (design:
docs/superpowers/specs/2026-11-06-862-override-audit-design.md§6, PR 3).What
TxOptions(#[non_exhaustive],Clone + Debug + Default + PartialEq + Eq; fieldssynchronous: Option<SyncMode>,chunk_facts: Option<usize>; buildersnew,synchronous,chunk_facts), exported from the crate root andminigraf::db.Minigraf::begin_write_with(TxOptions).begin_write()isbegin_write_with(TxOptions::default());Nonemeans the database value. Same errors asbegin_write(INT-001,API-014).synchronousdecides whether that transaction's WAL entry is synced. AFullcommit syncs the whole WAL, so earlierNormalentries become durable too. No effect on a transaction that becomes large (it commits as a checkpoint; its WAL guard header is always synced: a deviation from Audit which OpenOptions settings should be overridable per query (and which already are) #862 §6, recorded there with a dated note) or on an in-memory database.chunk_factsreplacestransaction_chunk_factsfor that transaction, with the same clamp (1..=1,000,000). The thread-local test hook still takes precedence.WalWriterkeeps no sync mode: eachappend_entryis given its transaction's, so a mode cannot leak into later transactions.Tests
Normalentries survived it), and a test-onlyMinigraf::power_lossends a handle with the unsynced WAL tail cut off. Both are test-only code.src/tx_options_tests.rs(17): API and errors; sync per database mode × transaction mode; no mode leak (commit, rollback, drop, a rolled-back largeNormaltransaction);Normal/Fullsequences with a kill and a power loss after each, checked record by record viafact_log; largeNormaltransaction durable after power loss; auto-checkpoint unchanged; in-memory;chunk_factsbehaviour, clamp, scope and test-hook precedence; committed data independent of the options.src/fault_matrix.rs: three mixed-mode operations, every fault at every write and sync, prefix-guarantee reopen check.tests/crash_kill_test.rs: aPerTxSyncvariant (notest-hooksneeded), run per PR and in the nightly 100-round workflow without a workflow change.Docs
docs/CONFIGURATION.md,docs/DURABILITY.md,README.md,CHANGELOG.md,docs/TEST_COVERAGE.md,CLAUDE.md. Docs site: project-minigraf/minigraf-docs#94.Size
Dist binary −144 B versus
v3locally (nightly 1.101: 1,266,408 → 1,266,264 B); gate unchanged at 1,240 KiB.🤖 Generated with Claude Code
https://claude.ai/code/session_01H2a7QouMzKp3tAWxgVsxRf