Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0054: One sync engine in the core for TablePro Sync and iCloud

- **Status**: Accepted; amends 0010 and 0044; the change journal, what a store is and the restore path amended by 0060; `colorTag` and the personal wire names and values amended by 0061
- **Status**: Accepted; amends 0010 and 0044; the change journal, what a store is and the restore path amended by 0060; `colorTag` and the personal wire names and values amended by 0061; the stop's cause amended by 0062
- **Date**: 2026-11-25

## Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0056: End-to-end keys: an account key pair, device key pairs, scope keys wrapped per member, the recovery key and pinned keys

- **Status**: Accepted; supersedes 0053; amends 0044 (Secrets, and its Consequences line that teammates confirm a person again after a device removal or recovery); amended by 0059 (Errors, Ed25519 validity, the HPKE buffers and one vector row); the first envelope row's destination amended by 0061
- **Status**: Accepted; supersedes 0053; amends 0044 (Secrets, and its Consequences line that teammates confirm a person again after a device removal or recovery); amended by 0059 (Errors, Ed25519 validity, the HPKE buffers and one vector row); the first envelope row's destination amended by 0061; a team stop's cause and how each clears amended by 0062
- **Date**: 2026-11-25

## Context
Expand Down
29 changes: 29 additions & 0 deletions core/docs/decisions/0062-a-stopped-scope-records-why-it-stopped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 0062: A stopped scope records why it stopped

- **Status**: Accepted; amends 0054 and 0056
- **Date**: 2026-11-26

## Context

[0054](0054-one-sync-engine-in-the-core-for-tablepro-sync-and-icloud.md)'s `key_versions.state` has one value, `stopped`, "while a catch-up or a restore leaves the device waiting". The two waits end differently:

- **A catch-up stop** clears only through re-confirmation by an owner or admin the device had counted as a holder ([0056](0056-end-to-end-keys-per-account-and-device.md), Teams, A stopped device).
- **A restore stop** waits for a team version another account signed and the server lost, and the device "waits for the signer's device to push the version back, then resumes its own push-back from there" ([0051](0051-sync-protocol-and-record-rules.md), What cannot go back).

0056 also says that at approval a held team scope's stop "clears only through re-confirmation". With no record of the cause, a device either never clears a restore stop or clears a catch-up stop when the server shows a version it already held, which would undo S3-C1's fix. 0054 and 0056 are Accepted, so the fix goes here.

## Decision

- **`key_versions` gains `stopped_cause`,** after `state`: `catch_up` or `restore_wait` while `state` is `stopped`, else null. It is text in the key digest, like the other columns. A personal or history row only ever stops as `catch_up`.
- **A catch-up stop** clears only through re-confirmation, as 0056 says. The device reports it (0051, A stopped device).
- **A restore stop** clears only when the server again holds every version the device waits for with the same fields as the copy the device holds, each passing the device's own checks as in any pull (0056, Rollback). The device then resumes its push-back. A different record at such a version ends the scope (`keys.conflict`). A restore stop is not reported, since no owner's rotation can fill it.
- **Both at once:** a scope that meets a catch-up failure while it waits on a restore keeps `catch_up`, the stricter rule.
- **Approval** keeps a held team scope's `state` and `stopped_cause` (0056, Approving a device, step 7).

**Why a column, not a `key_pending` flow.** 0054 already holds both waits in `key_versions.state`, so the cause belongs beside it. `key_versions` rows are in the anchor's checkpoint, and `key_pending` stays in the file alone. The cause must survive a file restore unchanged: read as `restore_wait`, a catch-up stop would clear at once, because the server holds the version the device stopped at.

## Consequences

- The state file gains one column; the key digest and the checkpoint carry it.
- The engine and the key-flow lanes branch on the cause, never on the server's view alone.
- A restore stop clears with no admin action once the signer's device pushes back.
5 changes: 3 additions & 2 deletions core/docs/decisions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ The format, the statuses and how a later ADR changes an earlier one follow [the
| [0051](0051-sync-protocol-and-record-rules.md) | Sync protocol and record rules | Accepted; the JSON depth count, the personal wire names and which settings kinds sync amended by 0061 | `sync_records` in scopes, with install-wide random epochs and a cut per scope; a write is conditional on an opaque change tag of epoch, version and random write tag, and a push names its epoch; each change answers `applied`, `conflict` or `rejected` with a code; open kinds beside reserved `key.*`, `secret_envelope`, `history_entry` and library kinds, the server reading only `kv` and the key-object fields 0056 lists and verifying their Ed25519 signatures; 1 MiB a record, pages by count and bytes, a strong ETag over the whole scopes body; DPoP on personal and history calls and on every key-object and envelope write, with a filtered view before approval; content edits revive a deletion and placement edits never do; the system identifier and timeline are checked before any connection serves, and a restore opens an epoch whose cuts tell each device which writes to refill; pull-only past grace; the library moves in behind views under N-1's lock order, and the facade lives until 2% of devices. |
| [0052](0052-synced-records-have-canonical-ids.md) | Synced records have canonical ids; saved queries and folders have UUIDs and may have no connection | Accepted | A wire id is compared as bytes, a UUID in it upper case as `uuidString` writes it, except the team library's client ids as stored and new ones lower case; favourite tables and databases, table folder items and settings categories take the Mac's derived ids byte for byte, `sha256-` past CloudKit's 255 UTF-16 units; an envelope's id is its parent's kind, id and secret kind, a key object's its owner and its version, recipient or step; saved queries and folders get UUID record ids beside the rowid and an optional connection, with name and keyword collisions settled the same way on every device and no referential actions; history gets a random UUIDv4 record id. |
| [0053](0053-end-to-end-keys-under-the-recovery-key.md) | End-to-end keys: the identity under the recovery key, signed logs, envelopes, removal and recovery | Superseded by 0056 | Suite `tp1`: HPKE P-256 only wraps keys, AES-256-GCM under per-record HKDF subkeys of versioned account and team keys, Ed25519 JWS statements; the identity key lives only in a blob sealed under the 256-bit recovery key; identity, device and team logs are hash-chained, and every unwrapped key must match a signed `kid` or public key; devices and members join by five words behind a hash commitment; the server serves personal data only to DPoP keys in the signed device set; envelopes bind immutable ids and seal the destination inside; a lost device is removed with the recovery key; any owner or admin signs team trust; MLS does not fit a vault. |
| [0054](0054-one-sync-engine-in-the-core-for-tablepro-sync-and-icloud.md) | One sync engine in the core for TablePro Sync and iCloud | Accepted; the change journal, what a store is and the restore path amended by 0060; `colorTag` and the personal wire names and values amended by 0061 | `tablepro-sync` runs TablePro Sync and iCloud as two transports under one engine, CloudKit's an async callback interface the Swift apps implement; the engine owns the record cache, dirty state as a diff against the bases, standing, held and deferred changes, the rebase and batching; one state file per provider and account; iCloud gains no record type; a move merges against the CloudKit base and carries its deletions; the Mac writes the Swift sync metadata while the previous stable runs the Swift engine; a state file is MACed and checked against an anchor in the device store that keeps its counter and its key checkpoint, and a stale one refills and rebuilds its keys on that checkpoint. |
| [0054](0054-one-sync-engine-in-the-core-for-tablepro-sync-and-icloud.md) | One sync engine in the core for TablePro Sync and iCloud | Accepted; the change journal, what a store is and the restore path amended by 0060; `colorTag` and the personal wire names and values amended by 0061; the stop's cause amended by 0062 | `tablepro-sync` runs TablePro Sync and iCloud as two transports under one engine, CloudKit's an async callback interface the Swift apps implement; the engine owns the record cache, dirty state as a diff against the bases, standing, held and deferred changes, the rebase and batching; one state file per provider and account; iCloud gains no record type; a move merges against the CloudKit base and carries its deletions; the Mac writes the Swift sync metadata while the previous stable runs the Swift engine; a state file is MACed and checked against an anchor in the device store that keeps its counter and its key checkpoint, and a stale one refills and rebuilds its keys on that checkpoint. |
| [0055](0055-managed-policies-for-the-sync-provider-and-tablepro-app-traffic.md) | Managed policies for the sync provider and tablepro.app traffic | Accepted; what `personalSync` off refuses and tombstones amended by 0051, which keeps the `key.*` kinds | `PersonalSyncProvider` lists the personal sync providers a device may use, one entry forcing it and none leaving sync off; `AllowOtherAccountServers=false` with a company server also stops share-link reads and the AI catalog refresh; the Mac reads `UsageDataAllowed`, `PluginCatalogAllowed` and `ICloudSyncAllowed`; one key table with each type per channel, lists as an ADMX `<list>`; a self-hosted `personalSync` switch, on by default, leaves an install serving Team Library only. |
| [0056](0056-end-to-end-keys-per-account-and-device.md) | End-to-end keys: an account key pair, device key pairs, scope keys wrapped per member, the recovery key and pinned keys | Accepted; amended by 0059 (Errors, Ed25519 validity, the HPKE buffers and one vector row); the first envelope row's destination amended by 0061 | The 1Password and Bitwarden model on suite `tp1` (HPKE X25519, AES-256-GCM, Ed25519): an identity key derived from the 256-bit recovery key certifies each version of the account's X25519 and Ed25519 keys, which every approved device holds; personal, history and team keys are AES-256-GCM scope keys in HPKE wraps signed by the wrapper; a new device joins by five words behind a commitment, and the server serves personal data only to DPoP keys it certifies; removing a device needs the recovery key and rotates the account and every scope key; teammates pin identity keys on first use, compare six fingerprint words and get an alert on any unendorsed change; an owner or admin confirms each member, and only a holder of a team key's previous version signs the next; a reset waits 7 days. |
| [0056](0056-end-to-end-keys-per-account-and-device.md) | End-to-end keys: an account key pair, device key pairs, scope keys wrapped per member, the recovery key and pinned keys | Accepted; amended by 0059 (Errors, Ed25519 validity, the HPKE buffers and one vector row); the first envelope row's destination amended by 0061; a team stop's cause and how each clears amended by 0062 | The 1Password and Bitwarden model on suite `tp1` (HPKE X25519, AES-256-GCM, Ed25519): an identity key derived from the 256-bit recovery key certifies each version of the account's X25519 and Ed25519 keys, which every approved device holds; personal, history and team keys are AES-256-GCM scope keys in HPKE wraps signed by the wrapper; a new device joins by five words behind a commitment, and the server serves personal data only to DPoP keys it certifies; removing a device needs the recovery key and rotates the account and every scope key; teammates pin identity keys on first use, compare six fingerprint words and get an alert on any unendorsed change; an owner or admin confirms each member, and only a holder of a team key's previous version signs the next; a reset waits 7 days. |
| [0057](0057-a-setup-guide-shows-on-an-empty-library.md) | A setup guide shows on an empty library | Accepted | Every app shows a guide while its library is read and empty, under one gate table, step order and handoff; `sources_blocking` lists other apps with an availability that can be Unreadable, a password offer, a ticked and a preselected rule shared with the Swift scanner through `source_list.json`; an import reports the ids it wrote, and one opens unless a file or a link supplied it, several are selected. |
| [0058](0058-shortcut-presets-from-one-file.md) | Shortcut presets come from one file | Accepted | `core/crates/core/keymaps.json` holds a preset per import source, its actions named by the macOS `ShortcutAction` raw values and its chords in VS Code's text with `key`, `mac`, `linux` and `windows`; `tablepro_core::keymap` and the FFI's `keymap_preset` read it for a named platform; a preset row wins and the displaced command has no key, bare-key defaults stay, each app drops what its platform refuses. |
| [0059](0059-key-errors-name-the-expected-signer-and-two-library-limits-are-written-down.md) | Key errors name the expected signer, and two library limits are written down | Accepted | 0056's Errors gain `keys.random` and give a failed signature `keys.not_compared` under the compared DSK, `keys.unendorsed` under the held IK, else `keys.signature`; Ed25519 refuses the sign-bit encodings of the two x = 0 points; rustls's HPKE leaves plaintext buffers unwiped until an upstream fix ships; the encoding vector row names no server code for an encrypted plaintext. |
| [0060](0060-the-change-journal-names-the-records-each-write-changed-and-a-store-is-one-file.md) | The change journal names the records each write changed, and a store is one file | Accepted | 0054's change journal names, per committed write, the kind with the ids written and deleted, which the downgrade mirror writes as dirty and tombstone keys with no diff of a whole store; a store is one file with one generation and write sequence, so a restore refills every kind in it; a host's restore path calls the store's `start_new_generation` in the core. |
| [0061](0061-the-records-crate-settles-six-record-rules-the-adrs-left-open.md) | The records crate settles six record rules the ADRs left open | Accepted | The first envelope row's `dest` binds the SSH host and jump host fields, `ssh_profile_id`, `ssh_route`, `additional_fields` and `network_options`, not the TLS client key path; eight more AI options are approval-required; the core writes `colorTag`; personal wire fields are CloudKit names in snake_case with CloudKit values, core-only fields sync on TablePro Sync only, and the credential profile link syncs there as approval-required; JSON depth counts `fields` as level 1; no iOS, Linux or Windows settings category syncs until an ADR names it. |
| [0062](0062-a-stopped-scope-records-why-it-stopped.md) | A stopped scope records why it stopped | Accepted | `key_versions` gains `stopped_cause`, `catch_up` or `restore_wait`, in the anchored row; a catch-up stop clears only through re-confirmation and is reported; a restore stop clears only when the server again holds each awaited version with the fields the device holds and its own checks pass, then push-back resumes, and is not reported; a scope with both keeps `catch_up`; approval keeps the cause. |
Loading