Skip to content

fix(off_record): a room save moves the room secrets its rows name into vault custody (FIX ROOM-LOCAL-CUSTODY 3/3) - #10004

Merged
olety merged 6 commits into
mainfrom
opus-fix-custody/room-local-custody-save
Nov 20, 2026
Merged

olety merged 6 commits into
mainfrom
opus-fix-custody/room-local-custody-save

Conversation

@olety

@olety olety commented Nov 20, 2026

Copy link
Copy Markdown
Member

FIX ROOM-LOCAL-CUSTODY, PR 3 of 3 (stack: kept -> handle scope -> this PR). Ruling: see PR 1.

This PR: saving the room moves each secret a saved row names into the vault's normal custody, and only then does the known-value index learn its fingerprint.

A room keeps a fresh key in its own custody and a row there holds its room handle; a message said in the room may quote it. A save replayed the room's rows into base as written, so a saved row named a room handle that names nothing outside the room.

  • batch/secret_scan/mask/room_carry.rs (new): carry_room_secrets_in_txn. In the save's own transaction, each [secret rN] in a fresh row the save writes (each text of a Put's MessagePack body, map keys included) takes the handle of a base custody record holding the value: the one this save moved it to, else the record base custody already holds it in (the writer's known-value index), else one minted now through the vault's door (seal_whole_part_in_txn, named as found in the saved row, with the wall's reason from the room; the owner's found-key notice comes with it). Only that mint teaches the index the fingerprint. A row base holds already keeps its bytes (the replay compares them; a retry never mints again). A row that is no one MessagePack value, or a room handle the room keeps nothing under, stays as written.
  • off_record/promote.rs: FloorWrites::promote and copy_append carry the replay ops before seal_promoted_message_ops_in_txn, on a floor saving out of a room (FloorWrites::saving).
  • A room secret no saved row names is not moved: it stays in the room and its close wipes it.

Stored change: keep (a saved row names a base custody handle, as before).

Tests (... --test room_custody_save; red commit 732c461 on PR 2's tip, pin opus-fix-custody/room-local-custody-save-red):

  • a_save_moves_a_room_secret_into_vault_custody_and_only_then_fingerprints_it (red at PR 2: the saved MESSAGE keeps the room handle; base holds no record and no fingerprint): the saved MESSAGE names a base handle whose record holds the key, no row holds the room handle or the key, the index knows the key, and a second save naming the same room handle takes the same record;
  • guard: a_save_naming_no_room_handle_moves_nothing.

Not in this stack (filed, mine, next): saved notes/claims/shells ([ROOM-CUSTODY-SAVED-ARTIFACTS]), a room's on-record writes ([ROOM-CUSTODY-ON-RECORD-CARRY]), reply bodies ([ROOM-CUSTODY-REPLY-BODIES]); each fails closed today.

… into vault custody, then fingerprints it (FIX ROOM-LOCAL-CUSTODY)

The lead's ruling ROOM-LOCAL-CUSTODY = A (21 Nov, "fingerprint only on
save"): saving the room moves each secret into the vault's normal
custody, and only then may the known-value index learn its fingerprint.

tests/room_custody_save.rs:
- a_save_moves_a_room_secret_into_vault_custody_and_only_then_fingerprints_it
  (red at the layer below: the saved MESSAGE keeps the room handle, which
  names nothing in base; base custody holds no record of the key and its
  index knows no fingerprint): a participant's message quotes the room
  handle of a key the room keeps, and the owner saves the turn; the saved
  MESSAGE names a base custody handle whose record holds the key, no row
  holds the room handle or the key, the index knows the key, and a second
  save naming the same room handle takes the same base record;
- a_save_naming_no_room_handle_moves_nothing is a guard.

test_doors/off_record_side_row.rs: say_in_room (one user message
witnessed into the session), base_rows_hold, base_custody_handle_in_rows,
vault_custody_value.
…o vault custody in the save transaction (FIX ROOM-LOCAL-CUSTODY)

A room keeps a fresh key in its own custody and a row there holds its
room handle; a message said in the room may quote that handle. A save
replayed the room's rows into base as written, so a saved row named a
room handle that names nothing outside the room, and the key never
reached the vault's custody.

batch/secret_scan/mask/room_carry.rs: carry_room_secrets_in_txn. In the
save's own transaction, each room handle `[secret rN]` in a fresh row the
save writes (each text of a Put's MessagePack body, map keys included)
takes the handle of a base custody record holding the value: the one this
save moved it to already, else the record base custody holds it in (the
writer's known-value index), else one minted now through the vault's
door (seal_whole_part_in_txn, named as found in the saved row, with the
reason the wall gave in the room). Only that mint teaches the known-value
index the fingerprint. A row base holds already keeps its bytes (the
replay compares them; a retry never mints again). A room handle the room
keeps no value under stays as written.

off_record/promote.rs: FloorWrites::promote and copy_append carry the
replay ops before seal_promoted_message_ops_in_txn, on a floor saving out
of a room (FloorWrites::saving); a floor saving out of no room writes as
before.

Stored change: keep (a saved row names a base custody handle, as before).
…ts bytes in the room carry (FIX ROOM-LOCAL-CUSTODY)

carry_room_secrets_in_txn refused the whole save when a row the save
writes held a room handle's opening but did not read as one MessagePack
value. Such a row now keeps its bytes, and a room handle in it stays as
written, naming nothing, as one the room keeps no value under does: the
save goes on and no value leaves the room.
@greptile-apps

greptile-apps Bot commented Nov 20, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 6 billable files and costs up to $1.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 35 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2e69c70 and 5d094f9.

Files selected for processing: 6

  • crates/oneiron/src/batch/secret_scan.rs
  • crates/oneiron/src/batch/secret_scan/mask.rs
  • crates/oneiron/src/batch/secret_scan/mask/room_carry.rs
  • crates/oneiron/src/off_record/promote.rs
  • crates/oneiron/src/test_doors/off_record_side_row.rs
  • crates/oneiron/tests/room_custody_save.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…layer (REVIEW-10003, FIX ROOM-LOCAL-CUSTODY)
…layer (REVIEW-10003 round 2, FIX ROOM-LOCAL-CUSTODY)

# Conflicts:
#	crates/oneiron/src/test_doors/off_record_side_row.rs
Base automatically changed from opus-fix-custody/room-local-custody-handle-scope to main November 20, 2026 21:52
@olety
olety merged commit 16942ce into main Nov 20, 2026
20 checks passed
@olety
olety deleted the opus-fix-custody/room-local-custody-save branch November 20, 2026 21:52
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