Repository navigation
Reject a change the log refuses for itself, keeping the user's file, instead of stopping sync - #1309
Merged
Merged
Conversation
added 4 commits
November 28, 2026 22:08
callumalpass
force-pushed
the
native-append-refusal-rejects-head
branch
from
November 28, 2026 11:28
cab7ad8 to
4c0c5dc
Compare
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.
Refs #1952
Rebased on
b6393857a(#2021). A simple disk edit shares one literal between the observed document and its identical applied result. An edit that still exceeds the sealed-entry limit retains its local bytes and raises anedit_refusednotice.Replica timeout investigation
Both cancelled jobs in Actions run 46123120379 reached the cargo test step. GitHub recorded a 20-minute timeout for each and retained no per-test log. On the original head, the refusal test failed in 0.05 seconds and printed a 1,000,010-character assertion line. Literal sharing allowed its 1,000,000-byte edit to fit. The corrected test gives the edit a 64 KiB base, checks the confirmed and local bytes through restart, and bounds the assertion output.
The fake disk also compared every known path against a list of all paths and rehashed every file on every commit. It now updates the acknowledged paths and revisions, including moves and deletions. The two 4,000-file cases retain their original sizes and assertions. The 1,360-test replica library took 358.39 seconds before the test changes and 85.00 seconds afterward on the same builder. The cancelled jobs' individual blocking tests are unknown.
Verification on the rebased branch
pnpm ci:localpassed.a27b57d4cb9c978725922af25928bb4242eb9580fa502815ea75993bbe92fe20, 4,135,951 bytes. All three runtime method-contract tests passed.Earlier implementation and verification
This closes the planning-time overwrite. A change the log refuses for itself (
too_largeitem_bytes/refs) becomes a rejection plus a per-record refused fence that keeps the user's disk bytes. Before, it either stopped sync (an Integrity stop, terminal for the daemon and re-hit on every reopen) or let a later publish overwrite the user's file.What changed
resolve_rejectedwith the log's code and reason. The files the rejected change touched are fenced (replica.refusedmeta, in the rejection's commit): materialize, restart reconciliation and attachment reconciliation publish nothing there. The next user edit lifts the fence and is planned from the local view. A confirmed remote change to a fenced record becomes a conflict hold (mine: the disk bytes). Planning-time rejections (sealed entry over 1 MiB) and disk edits the planner refuses are fenced the same way. The daemon shows each fenced file as anedit_refusednotice.too_largeitem_bytes/refs reject one change; everyinvalidreason still stops. The breaker is gone. One predicate (refused::fences(source, problem, has_files)) decides which rejected rows keep their bytes: disk edits always; an app's write only on a store with files and only when the change itself was refused. Revocation, access and conflict rejections revert as before. On a store without files (browser, hosted) the log's refusal of an app write still stops the append and the row stays pending (refused::rejects_log_refusal). Fence targets come from the change's own ops, never the planner's link rewrites. A fence keeps the refused change's base, and is released in the capture's or acknowledgement's own commit.apiwrites) refused for item reasons now fence the resource path.an_app_refusal_over_a_refused_disk_edit_keeps_the_users_fence.validation: Nonefield Follow the collection's validation level at submit; let a write set its own #1308 added toSubmitParamsin this branch's three new disk tests. 62ec124 re-pins the runtime WASM on the merged tree. 3c2041f merges main again (Report stale Private setup reviews as one clear refusal (#1293) #1306; pin files only conflicted) and 421a26d re-pins on that tree.validated_at == Errorno longer marks an app's submission. An app writing atwarnoroffcounted as the user's edit. Its refused write replaced a fence over the user's refused disk edit (the user's bytes left the hold), and its corrected write after its own refusal became a spurious conflict hold (files and resources stayed fenced).PendingRownow recordssubmitted: device-local, never on the wire, and appended to the row's local bytes only when true. It is set by submit, app attachment uploads, collection setup and API unindexed captures, and false for disk captures, resource observations, hold resolutions and native moves. Older rows read as captured, as older fence meta does.refused_targetsandrelease_refusedtake it instead of readingvalidated_at. Addsa_warn_level_app_refusal_over_a_refused_disk_edit_keeps_the_users_fenceanda_warn_level_app_fix_after_its_refusal_reaches_diskplus codec round-trips. 28dbb77 updates the legacy-bytes codec test to use a captured row. d4c585c re-pins.submittedis set only there (&& self.store.has_files()at the five app-row sites). Browser and hosted pending rows, and their retained copies, keep byte-identical encodings, so a hosted Worker rollback or an app pinned back to an older SDK WASM never meets an unreadable row. Addsa_submitted_row_without_files_keeps_its_earlier_bytes, restores the attachment codec test to its earlier form (its store has no files) and corrects thePendingRow::submitteddoc. e318037 re-pins.Integrity sites that still stop sync
These planning-time refusal sites are unchanged and still raise an Integrity stop:
native_move_restore_helddisk.rsunencodableWritten notes, not code
Under Callum's stop rule these narrow crash or race cases stay as notes:
refused_applieduntil restart.refused.rsowner lookup (cosmetic).Release channel
desktop-release.yml).mdbn-replicais compiled intoapp-runtime.wasm, so this ships in the SDK viapublish-sdk-npm.ymland the weekly app repins. The pin is refreshed in this PR.mdbn-hosted-workerdepends onmdbn-replicaand runs its append path, so thetoo_largebatch handling changes there: a refused multi-item batch now probes the head row once instead of settingmax_items = 1for good. Fencing itself doesn't reach hosted (no files;rejects_log_refusalkeeps the stop for app writes). It ships with the next integrated Workers release (release-workers.yml).submittedflag, set only on stores with files) as corrupt, until that row is appended or resolved. Captured rows, and every hosted and browser pending row, keep their earlier bytes, so Worker rollbacks and older SDK WASM pins are unaffected.Why the pin was built locally
The builder VM has no Node, and
rcargodoesn't forward env ornode_modules, so the pin can't be produced there. As in #1303,cargo xtask wasm-appran locally at the pinned 1.94.0 toolchain with the publication workflow's path remapping (checkout ->/source, cargo home ->/cargo, local rust-src ->/rustc/4a4ef493e3a1488c6e321570238084b38948f6db, needed because the local toolchain has rust-src and CI's doesn't), thennode scripts/sdk-publication.mjs pin-runtime.New runtime pin (main a87dd0a merged, with the provenance fix): sha256
50d2489a0dc7a0e09e37a5e31188a7ff5f28e4e85c7cb8eea27cbdaea9fced56, 3840909 bytes. If main moves before merge and "Publish source-built SDK / build" fails on a byte mismatch, merge main in and re-pin.Tests
Run with main a87dd0a merged in and the provenance fix (head e318037):
rcargo test -p mdbn-replica: all binaries ok, 1266 passed, 0 failed (lib:test result: ok. 1182 passed; 0 failed). Disk tests: 78 passed, includinga_warn_level_app_refusal_over_a_refused_disk_edit_keeps_the_users_fence,a_warn_level_app_fix_after_its_refusal_reaches_diskandan_app_refusal_over_a_refused_disk_edit_keeps_the_users_fence; engine includesa_submitted_row_without_files_keeps_its_earlier_bytes;--test interfacescovers the codec round-trips.rcargo test -p mdbn-store-file: 129 passed.rcargo test -p mdbn-daemon --no-fail-fast: 555 passed, 3 failed:a_foreign_registration_is_never_opened,runtimes_follow_the_paired_account(account_runtime) andlocalhost_link(link), allpath must be shorter than SUN_LENfrom the builder's long socket path. CI's "native tests (daemon)" runs and passes them.rcargo clippy -p mdbn-replica -p mdbn-daemon --all-targets -- -D warnings: clean.cargo fmt --check: clean.