Skip to content

fix(core): keep the file budget when a refused store is replaced - #2408

Merged
aicayzer merged 2 commits into
mainfrom
fix/refused-store-file-budget
Oct 25, 2026
Merged

aicayzer merged 2 commits into
mainfrom
fix/refused-store-file-budget

Conversation

@aicayzer

@aicayzer aicayzer commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Core::replace_refused now gives the new store the file budget setting the refused store recorded. The setting lives in the store's meta table and went with the old store, so every app had to keep the person's budget elsewhere to restore it after a schema replacement. The Swift and Node bindings get the fix with no change of their own.

Changes

  • Reads the one file_budget meta row of the refused store with raw SQL, through the same read-only open that decides whether the store is refused, and writes it into the new store. Only a byte count or "keep every file" is carried.
  • Where the row is absent, the table is missing, the store cannot be read, or the value is not a setting, the new store has the default budget and the replacement still succeeds.
  • Contract: device/replace-refused-budget-kept and device/replace-refused-budget-default.

Testing

  • Core: a byte count, zero and keep-all carried exactly and read again after a reopen; no setting gives the default; a setting held only in the write-ahead log is carried; a missing meta table, a value that is no setting and a negative count give the default and no error. Seen failing before the change. The whole marfa-core library suite passes (1066 tests), with clippy and fmt.
  • Conformance through the Node binding: the byte count and keep-all are kept; a value that is no setting gives the default. The carry test was seen failing without the change. The contract generator tests pass.
  • Not tested: a failure to write the carried setting into the new store. It is ignored and leaves the default, because reporting it would tell the caller a replacement that is done had failed. It cannot be forced without a fault hook.

Notes for reviewers

Low risk: it reads one row of a store that is being replaced anyway, and every failure falls back to today's behavior. Follow-ups: withmarfa/marfa-swift#375 and withmarfa/docs#643; a Swift test of the carry follows the core pin moving past this change.

Checklist

  • The title is a scoped Conventional Commit.
  • New behavior has a test that was seen failing first, or no test was needed and the reason is above.
  • Docs, comments and the contract still say what is true after this change.

@aicayzer

Copy link
Copy Markdown
Contributor Author

Reviewed by withmarfa-reviewer (Sonnet): no blocking finding. Binding doc comments updated after review to say a replaced store keeps its file budget. docs#643 merges after the Marfa and Swift SDK releases that ship this.

@aicayzer
aicayzer merged commit 905a4a6 into main Oct 25, 2026
30 checks passed
@aicayzer
aicayzer deleted the fix/refused-store-file-budget branch October 25, 2026 15:38
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