Skip to content

feat(core-sync): personal records go up sealed under the personal key at keyed wire ids - #4815

Merged
datlechin merged 3 commits into
mainfrom
feat/core-sealed-records
Dec 1, 2026
Merged

datlechin merged 3 commits into
mainfrom
feat/core-sealed-records

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • tablepro-keys: record.rs seals a personal record whole under PK with AES-256-GCM. The subkey and the AAD bind origin, account, kind, wire id and kv; the plaintext holds the local id, rv and the fields or a deletion. record_id_key derives NK from the PK root and wire_id gives ~ and 52 Base32 symbols. Labels record-key, record and record-id. vectors/records.json.
  • tablepro-records: kind::is_personal_data.
  • tablepro-sync, the pass:
    • Seals each personal data kind at push time under the newest PK at the floor's next revision, named by its wire id. A deletion goes up as a sealed write, never a delete.
    • Opens each pulled copy, checks its id against its wire id, and judges it by key version and the per-record floor. A taken copy merges against the floor's copy, not the base.
    • Holds a copy that does not open, does not count for its key version, or is below the floor, under its wire id. Writes its own copy back when it vouches for it.
    • Resends on its own only copies it vouches for (snapshots that leave a record out, user tombstones, refills, policies back on). Seals again after a rotation only copies it wrote.
    • Takes a write whose answer was lost as its own by the floor's sent digest.
    • A store in refill takes the floor's copy when no copy counts.
    • sealed_ids maps wire ids back for tombstones and held copies. A new PK root, as after a kind 3 reset, starts the scope over.
    • Sends TablePro-Sealed-Records: 1 on every /v2/sync call. Without sealed_records the personal scope syncs key objects only and the status says sync.server_too_old.
    • A file with no sealed_marks row starts the personal scope over before it pushes.
    • Start empty and a move away drop the floors with the bases.
  • tablepro-sync, the state file: schema 4 adds sealed_floors, sealed_ids and sealed_marks; oldest reader 4.
  • tablepro-sync, secrets: a pull that moves a record's destination takes its synced secrets out of the store before the record lands, and holds the record when the store cannot. The envelope is held back, not deleted, and a move back lands it again.
  • tablepro-ffi: a connect gets no stored secret once the connection points elsewhere than when the connect read it, and asks.
  • Fake server in sync/testing: the capability, the header, sealed_required, bad_record_id for a personal id that is not a wire id, the current kv check, plaintext rows skipped and a sealed create over one.
  • Tests changed on purpose:
    • tests/engine/* read and write personal records sealed, through the harness's stored_personal and push_sealed; the harness serves the account's personal key version 1.
    • pass.rs: a_batch_sent_again_keeps_its_key_until_the_server_forgets_it and the_queue_survives_a_restart use a team record, since a sealed retry seals again under a new nonce; the envelope refusal tests start with no personal key.
    • keys.rs serves no personal key record, as its tests push their own; stop.rs counts only non-key bases; rules.rs holds a store-refused copy sealed.
    • sync/testing service/tests.rs: the generic record rules run on a team's plaintext.
    • account_keys/personal.rs: a_rewritten_destination_is_the_approval_case is now a_rewritten_destination_holds_the_secret_back.
  • No change to the FFI API the apps call.

Test plan

  • tests/engine/sealed.rs and tests/engine/destinations.rs: each case of ADR 0114's Tests for tablepro-sync but the approval ones, which feat(core-sync): only a team's changes wait for approval, and rows older builds left settle #4812 covers.
  • sync/testing service/tests.rs: the fake server's sealed_required, bad_record_id, key version, header and capability rules.
  • tests/state_integrity: the sync digest frames the three tables, and a build of format 3 is no reader of this build's file.
  • vectors/records.json checked by every_committed_case_holds.
  • verify.sh core for keys, records, sync, sync-testing and ffi.

# Conflicts:
#	core/crates/sync/tests/engine/approvals.rs
#	core/crates/sync/tests/engine/rules.rs
@datlechin datlechin added the backport release/0.89 Merged into main; pick onto release/0.89 label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.89 Merged into main; pick onto release/0.89

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant