Key rotation re-seals items' stored bytes, so it can't grow over the quota (#996) #36
Loading…
Reference in a new issue
No description provided.
Delete branch "board/996-6d4dad"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part 2 of #996 (rotations over the quota). Part 1 (a vault's charge moving without a quota check) waits on a product decision and is not in this PR.
What changes
Vault::rotate(core/src/vault.rs) now opens each item's stored blob with the current key and re-seals those exact bytes under the new key, instead of re-serialising the parsedItem. A rotated blob is now byte-for-byte the same length, sopush_within_quota(after.0 > before.0) and the stage allowance (all <= items) hold with equality, and removing a member keeps working over the quota as DESIGN promises. It also keeps fields this client doesn't know. If a blob can't be opened (it shouldn't, sincerotaterequires no pending changes), it falls back to the old re-serialisation.MAX_BLOB.Test:
storage_quotaplants an item sealed more compactly than this client would serialise it (nokind/title, 256 bytes padded vs 512 for ours). Over the quota,revokesucceeds and the stored blob stays 297 bytes. Against the oldrotate, the same test fails at the revoke with 507.Known gaps (in DESIGN.md): rotations by older clients still re-serialise items. The rotation's manifest is still serialised anew, so a vault name another client wrote more compactly could still cross a step.
🤖 Generated with Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.