Skip to content

fix(core-sync): a secret a landing takes out is marked in the state file and saves wait for it, and a store in refill keeps what stays on the device - #4820

Merged
datlechin merged 5 commits into
mainfrom
fix/core-sync-landing-marks
Dec 1, 2026
Merged

datlechin merged 5 commits into
mainfrom
fix/core-sync-landing-marks

Conversation

@datlechin

@datlechin datlechin commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Second follow-up to #4815, from the Codex review and adversarial passes on #4816.

  • Secrets on a pulled destination change:
    • parent_landing marks a secret in the state file before it takes it out: a held row beside the envelope's id (<envelope id>#landing) that keeps where the record pointed, which no pull offers again and which leaves an envelope held for its record as it is. It marks only what goes back: a secret the store holds, or a move back to where the envelope was sealed for. A secret the person removed stays removed.
    • A secret changed here and not sent yet holds the record until it goes up, so only the synced value leaves and its envelope can give it back.
    • With password sync off, by the person or by policy, the pull asks the secrets store nothing: each secret is the device's own and follows its record to a pulled destination, as on 0.88. Before, a password changed here after turning sync off held every pulled destination change for good, since nothing would send it.
    • parent_landed puts the secret back where the record points then: the value taken out, else the envelope's, where the record pointed when it was taken out or where the envelope was sealed for. Then it clears the mark. A mark stays while its envelope does not open or its record cannot be read.
    • EnvelopeAdapter::records and apply settle any mark a crash, a stop or a failed put-back left, so it is settled before an envelope lands.
    • An envelope held back, for a moved record or an open mark, reads as its base instead of as unreadable: nothing goes up, nothing is deleted, and a newer copy for where the record points still lands. Before, a pull held that newer copy for good.
    • A later landing that takes nothing out keeps where an open mark found the record.
    • New RecordAdapter::landing_hold: the pull holds the app's save lock from the first secret out to the last one back. parent_landing and parent_landed take no hold of their own.
    • No stop check between landings. parent_landed runs for every Put, the held ones and a failed or stopped write too. Its error logs and the next pass settles the mark, instead of stopping the pass.
    • parent_landing and parent_landed read only the envelope bases they need.
  • A store in refill:
    • Takes the floor's copy under the record's local id. A refusal holds the record there as RefusedInRefill, which the push skips, with the served copy for the next pull. Before, the hold went under the wire id, the push sent the restored values, and no pull retried it.
    • A refused floor copy of a record no copy was served for goes again on each pull until the store takes it.
    • A floor copy the store takes ends that hold.
    • Takes no floor copy for a record kept on the device or a kind whose category is off, judged from the page's one store read, so the store's guard against a save in between still holds. Before, a restored store overwrote a Local only record.
  • Tests changed on purpose:
    • destinations.rs: a_pull_asks_the_secrets_store_before_the_record_lands_and_a_refusal_holds_the_record expects parent_landed for the held record too. a_move_the_records_store_refuses_gets_its_password_back_and_its_envelope_stays no longer reads records() between the hooks, which the save lock rules out. The held-back checks in a_pulled_destination_change_takes_the_password_out_first_holds_its_envelope_back_and_a_move_back_lands_it and a_move_back_the_records_store_refuses_lands_no_password_where_the_record_still_points expect the base copy, not an unreadable id.

Test plan

Each fails on main and passes here:

  • tests/engine/sealed.rs: a_restored_store_keeps_a_record_it_keeps_to_itself_whatever_copy_the_server_serves, a_restored_store_that_refuses_the_floor_s_copy_holds_the_record_sends_nothing_restored_and_takes_it_later, a_floor_s_copy_a_restored_store_refused_for_a_record_no_snapshot_served_goes_again_until_it_lands.
  • tests/engine/destinations.rs: a_crash_before_the_record_lands_neither_deletes_the_envelope_nor_loses_the_password, a_crash_after_a_move_back_lands_puts_the_password_back_on_the_next_pass, a_password_changed_here_and_not_sent_holds_the_record_and_stays, a_crash_puts_the_password_back_where_a_destination_changed_here_points, a_newer_envelope_for_where_a_moved_record_points_lands_while_the_old_one_is_held_back, a_later_landing_that_takes_nothing_keeps_where_an_open_landing_found_the_record, with_password_sync_turned_off_here_a_pulled_destination_lands_and_the_secret_follows_it, with_password_sync_off_by_policy_a_pulled_destination_lands_and_the_secret_follows_it, a_landing_keeps_an_envelope_already_held_for_its_record, a_crash_beside_an_envelope_held_for_the_record_puts_the_password_back_before_that_envelope_lands, a_landing_mark_stays_while_its_record_cannot_be_read.
  • a_password_the_person_removed_stays_removed_when_the_move_does_not_land and a_restored_store_pointing_elsewhere_takes_the_synced_destination_with_its_password guard the mark rule.

Runs:

  • cargo nextest for tablepro-sync, tablepro-sync-testing and tablepro-sync-host: 1402 passed. tablepro-ffi --lib: 302 passed.
  • cargo clippy --all-targets -D warnings for keys, records, sync, sync-testing, sync-host and ffi: clean. codex review --base origin/main: no findings.

…hold saves across it, and keep refill repairs off local-only records
@datlechin datlechin added the backport release/0.89 Merged into main; pick onto release/0.89 label Dec 1, 2026
…re an envelope lands, and a destination changed here holds the record
…-back envelope reads as its base, and a refill refusal holds its envelopes
…cord, and a refill refusal no longer holds its envelopes
…secrets store nothing, and the secret follows its record
@datlechin
datlechin merged commit 994a996 into main Dec 1, 2026
1 of 2 checks passed
@datlechin
datlechin deleted the fix/core-sync-landing-marks branch December 1, 2026 23:26
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