Repository navigation
Sync v0 for Phase 2: op log, gateway notification, phone and PC clients, sealed tasks - #229
Open
aharonamir wants to merge 59 commits into
Open
aharonamir wants to merge 59 commits into
aharonamir wants to merge 59 commits into
Conversation
Sync v0 needs a per-member append-only log before any client can exchange turns. V10 adds sync_heads and sync_ops with the board's forced-RLS household policy, a partial unique turn index and a pull index; appends lock the head row so one household's seqs have no gap, a replayed op id is a duplicate and a turn lands once per thread. The service validates the batch shape and caps before the store writes anything, and pull serves a client-owned cursor with a 1..200 page. The in-memory store keeps route tests database-free. Part of agents-demo#32
POST /v1/sync/ops acks a sealed batch with its seqs and the household head; GET /v1/sync/ops pages the caller's member log after a client-owned cursor. Both take the household, member and device from the bearer token only and never look at an op body. BodyTooLarge is 413 E_SCHEMA, a malformed body or base64 is 400 E_SCHEMA, and a store conflict is 409 E_CONFLICT. The mini-design records the tables, payloads, cursor and merge rules the client tasks build on. Part of agents-demo#32
mint inserted a fresh 'owner' member even when the caller named an existing household, so pairing a second device split the household into two members and two member-scoped sync logs. Resolve the household's first owner inside the tenant transaction and reuse its id; a member is created only for a household that has none. Part of agents-demo#32
The spec gains POST and GET /v1/sync/ops next to the board paths with the same bearerAuth security, the sealed op shapes, the batch and page limits, and the E_CONFLICT rule the store enforces. check-openapi.py passes both ways. Part of agents-demo#32
One frame per push carrying the highest new seq, only to the same household and member, never to the sender. A duplicate-only batch sends nothing. Part of agents-demo#32.
The validator accepts the type, the gateway schema enumerates it with a non-negative seq, a fixture pins body:{seq:7}, and the sync mini-design documents the one-frame-per-push rule. Part of agents-demo#32.
The link exposes a seq-only handler; a missing, non-integer or negative seq is ignored so a malformed frame never costs the socket or logs a body. Part of agents-demo#32.
The sync client needs the wire types and a transport before it can move the household's op log: sealed ops out, remote ops in, and a typed refusal for a non-2xx answer. OkHttp stays confined to OkHttpSyncHttp so the engine remains a plain JVM component. Part of agents-demo#32.
Payloads travel sealed inside SyncDraft, so SyncCodec is the only place that touches PayloadCipher. It refuses what the server would refuse (blank ids, a turn without a turn id, a thread upsert with one) and the 64 KiB ciphertext cap, without putting plaintext in an exception message. Part of agents-demo#32.
The engine batches pushes by 100, pulls page by page and applies in seq order, writing the cursor after each op. An unknown kind is skipped so a newer client cannot wedge an older one, while a bad tag still throws and leaves the cursor at the last good seq. SyncBacklog gives the apps deterministic turn order and title op ids. Part of agents-demo#32.
The server refuses a body over 256 KiB, so a 100-op batch of near-cap or even ordinary turns could never upload. Batches now split on count and on a conservative JSON-size estimate with headroom under the cap, and one oversized op still travels alone. Pulls now open before dedupe, throw on a bad tag even when the turn is held, and return a SyncReport whose skipped seqs make a shape/value problem observable instead of losing the turn or wedging the log. Part of agents-demo#32.
The last applied sync seq is metadata, not a secret: it lives beside the other mapping values instead of in the keystore, and a lost cursor only replays idempotent ops. Clearing the gateway resets it so a new identity cannot start mid-log. Part of agents-demo#32.
A title push is keyed by the thread's revision, so a rename that leaves updatedAt unchanged could never be told apart from the last push and the server would dedupe it away. Rename now writes a strictly newer revision (max(updatedAt + 1, now)) in both stores. An adopted thread with a blank title also gets the same 'New chat' default the Room store already used, so a thread created by a remote turn is not nameless. Part of agents-demo#32.
BackendSync runs one pull-then-push pass on the shared engine off the main thread: the cursor comes from settings, the local backlog is every turn plus one revisioned title per thread, and a StoreTarget merges remote ops into the conversation store. A pass persists the cursor only when it finishes, emits the thread it changed, and serializes passes behind a mutex while coalescing triggers for 250 ms. An op older than the local revision is ignored, so an own last push cannot undo a newer rename, and a tombstone never takes a title. No identity, no token or no household key means SignedOut and no network. SyncOwnership decides which engine merges: a paired gateway with a household key wins over the PC bridge. Tests cover signed-out, local push dedupe, remote turns, title conflicts, tombstones, the cursor and a refused call. Part of agents-demo#32.
With a gateway identity and a household key, the backend op log owns chat merge and the PC bridge is not even built; without those credentials the bridge keeps the path it had. Local appends, renames and deletes notify the sync through a ConversationStore decorator, a peer's sync.changed pulls, and a foreground pass catches up after the app was away. The chat and chats-sheet view models reload from the store when a pass reports a changed thread, through a defaulted dependency property so other fakes are untouched. Part of agents-demo#32.
One turn larger than the 64 KiB op cap used to make every pass fail, because the engine seals the whole backlog up front and the thread stays in allWithDeleted() after a delete. The backlog now measures each payload against the codec cap minus PayloadCipher's 12-byte IV and 16-byte tag, skips the turns that cannot fit, keeps them local and reports them as Done.skippedTurns. A title op id now hashes the title content instead of the thread timestamp, so a message on one device cannot republish a stale title as a new op, and a tombstone id is keyed by the deletion time. Title merge follows server seq order; an op this device wrote is inert when it comes back on the next pull, so its own echo cannot undo a newer rename, and a title this phone has not pushed yet is held until it is. The cursor and the change announcement now happen as soon as the pull finishes, so a failed push no longer hides applied turns. Part of agents-demo#32.
A remote tombstone removes the thread from all(), so the open chat used to stay on screen and writable; the view model now clears state.current when the thread it shows is gone, and appending returns early. Undo-turn and undo-delete have no wire op in v0 and could not reach the other devices (restore reuses the tombstone's id), so both are refused in backend mode with a short explanation, through the same SyncOwnership rule the merge uses. The manual sync message now also reports turns that were too large to push. Tests cover the closed chat, both guards (and both controls), and the skip message. Part of agents-demo#32.
The record is a JSON map threadId -> title next to the sync cursor. It lives in plain settings so it survives a restart: a title is pushed only when the local one differs, and a title the server already holds is never re-sent just because a message bumped the thread's timestamp. Part of agents-demo#32.
Replaces the content-hash title id and its in-memory pending set. A title op id is keyed by the thread's revision again, so A to B to A is three ops instead of a duplicate of the first; the push decision comes from the persisted record, not the id. A title is recorded when the server acks its op and when a pull applies a remote title, so a retry re-sends the same id, a failed push leaves the record for the retry, and an applied title is not echoed back. A message changes updatedAt but not the title, so it can no longer re-push a stale one. Tests cover A to B to A, a message-only push, a failed push losing to a peer rename, a restart, and the ahead-of-the-rename message case. Part of agents-demo#32.
ChatStore.mergeRemote creates an unknown thread, dedupes a message by id, keeps messages in timestamp order and applies a title only when it is non-blank, with a tombstone that is final. allWithDeleted exposes the rows sync needs, and every store method is synchronized now that a background pass and the stdin loop share it. Tests cover create, dedupe, out-of-order insert, last-writer-wins titles, the tombstone and the tombstone-aware listing. Part of agents-demo#32.
One unsolicited frame names the thread a sync pass changed and carries no id and no message text. The schema, the golden frame and the family test treat it as a contract family, and the builder test pins the exact shape the window parses. Part of agents-demo#32.
BackendSyncHost builds the shared engine from the stored session on every pass and merges into ChatStore, so a sign-out, a token rotation or a re-pair takes effect without a restart. The cursor and the last-synced title map are small atomic JSON files in the data dir; a title is pushed only when it differs from that record, tombstones travel every pass, and this PC's own ops are inert on a pull so an older echo cannot undo a rename. GatewayHost starts a pass on the first Live state and on sync.changed, and a conversation write or a turn append asks for the debounced pass. Part of agents-demo#32.
EngineHostClient raises ChatChanged from the chat.changed line, EngineSession forwards the conversation id, and the window re-reads the sidebar and the open conversation through the select path. A turn running locally is authoritative, so it is not reloaded underneath the person. Tests cover the frame and the reload of a conversation that is already current. Part of agents-demo#32.
The pass loaded the session for the token and device, then loaded it again for the content key. A re-pair between the two reads sealed the old household's ops under the new household's key, and every other device would wedge on that seq. The key is now derived from the same BackendSession the token came from, so one pass can only ever describe one household; the test makes the second read return a different household and asserts the pass reads once, sends the first token and seals with the first key. Part of agents-demo#32.
The host remembered that it had started sync and never forgot until the sidecar restarted, so a dropped socket and a new Live state pulled nothing and the server does not replay what a peer wrote while this PC was away. A small trigger now compares each link state with the previous one and starts a pass on every transition into Live; a presence re-emit of Live is not a reconnect and adds no pass. The test drives Disconnected to Live, a presence change, a drop through Connecting, then Live again, and expects exactly two passes. Part of agents-demo#32.
Every trigger cancelled the pending job, including a pass already inside its pull; with the cursor persisted only after the pull returns, a stream of sync.changed frames could starve the first sync forever. A trigger during the debounce or a pass now records one follow-up pass and leaves the pass alone, and stop() lets an in-flight pass finish too. The test holds the first pull open, fires three triggers, then expects two completed pulls, two total pulls and zero cancellations. Part of agents-demo#32.
syncNow returned 0 on any exception, so a pull that applied ops and a push that then failed looked like nothing happened, contradicting the documented return. A push failure is now handled beside the push and returns the pull's applied count; a failed pull still returns 0 because the engine never reported one. Every failure path logs one line with the exception class name only (pull, push, notify, missing key), never a message that could quote plaintext. Tests cover the push and pull paths and their log lines. Part of agents-demo#32.
mergeRemote saved through a runCatching that swallowed every I/O error, and the pass then advanced the cursor; a restart lost the merged ops and never pulled them again. ChatStore now keeps the last write's failure, and a pass that sees one holds both the cursor and the last-synced title record, logging the exception class and the held seq. A failed cursor or title write is logged too. The test points the store at a directory, so every save fails, and asserts the cursor stays at 0, no title record is written and the failure is logged. Part of agents-demo#32.
The cursor and the last-synced titles survived a re-pair, so the new household's earliest ops sat under a stale seq and were never pulled, while local titles looked already sent. Both files now carry the household and device they belong to; a mismatch starts at zero, clears the title record and logs the reset, and the seq is written back with its new owner. The test leaves a previous build's cursor at 5 and a bare title map, then pairs to a new household and expects a pull from 0, a title push and the new owner on disk. Part of agents-demo#32.
The phone and the PC both need to author a device-to-device task, and the
server only relays what the client sealed. TaskDraft builds the R29 body
(`{"sealed": base64url(IV || ciphertext || tag)}`) under the household key and
opens it again, so the composer and both receive paths share one rule.
goalOf tries the sealed body first and never falls back to a plaintext goal
beside it: an unauthentic body is a refusal, not a second chance. The trace
is a fresh W3C traceparent; the server-owned TraceIds lives in the service
module, which this client module cannot depend on.
Part of agents-demo#32.
The phone only ran plaintext goals, so a task from the PC (which seals) could
never run, and nothing let the phone start a task at all.
- RemoteTaskRunner opens `{"sealed": …}` with the household key before it
claims an id. A body that does not open is E_SCHEMA "the task could not be
opened", non-retryable and unclaimed, so a re-pair can resend it. The
plaintext goal still runs for the server-authored admin.action.
- RemoteTaskSender seals one goal, sends `task.create`, learns the
server-assigned id from the acceptance ack, and shows only an answer from the
addressed peer naming exactly that id.
- BackendSession forwards relayed task replies; AppContainer wires them to the
sender and decodes the key once for both directions.
- One sheet and one view model list the household's devices (minus this phone
and revoked rows), take a goal, and show "Sent to <name>", the sealed answer,
or the stable failure code. Nothing logs or renders the goal.
Part of agents-demo#32.
The PC could only receive; the window had no way to hand a goal to the phone. `task.send` seals the goal with the session's content key in the sidecar and sends a `task.create` through the gateway link; `devices.list` answers the picker from `GET /v1/devices` with the stored bearer. Both run on the backend scope so the stdin loop never waits on the socket or the server. The window gets one menu button and one dialog: choose a device, type a goal, and StatusText confirms "Sent to <name>" or shows the sidecar's stable code. No goal is logged, echoed in a reply, or carried in `chat.changed`. Part of agents-demo#32.
The required `:backend:ktlintCheck` gate had never run on this branch (earlier tasks ran `:app:ktlintCheck`, which the Android module's ktlint plugin reduces to the .kts files). SyncBacklog.titleOpId was the one finding: the expression body fits beside the signature. No behaviour change; the returned string is identical. Part of agents-demo#32.
`task.send`, `devices.list` and `devices.error` are new host families, and the schema's own rule says an unlisted family is a contract change. The golden frames pin what this build emits; the family test names them so a rename is caught before the window sees it. Part of agents-demo#32.
A `task.create` is not a success when it leaves the socket: the server answers a rejected create with a top-level `error` and an accepted one with a `task.ack` whose body names the id it routes under. Both echo the client's traceparent, so the send's trace is the correlation key. RemoteTaskSender now registers that trace, publishes `Sending`, and waits (bounded at 10 s) for its own ack (publishing `Sent(serverTaskId)`), or for an `error` with the same trace (its stable code), or `E_TIMEOUT`. A stale ack for another trace is ignored, and a refused send can no longer read as success. The app had no path for `error`: BackendClient already routes it to the board seam, so BackendSession narrows that seam to `error` and AppContainer forwards it to the sender. BackendClient's routing is unchanged. Part of agents-demo#32.
The sidecar reported `{ok:true, taskId:<client id>}` as soon as the frame left,
so a revoked target, E_TENANT or E_RATE read as success. Now `task.send`
registers the frame's trace and waits up to 10 s: an acceptance `task.ack`
resolves with the server's task id, an `error` with the same trace resolves
with its code, and silence is `E_TIMEOUT`. Nothing is ever reported accepted
before the server says so, and the client envelope id stays internal.
The same trace also fixes a hijack: BackendGateway's single approval slot used
to adopt any `task.ack` carrying `body.task`, so a send's acceptance ack could
overwrite the approval's server id and turn the phone's real answer into a
timeout-deny. The ask now sends its own traceparent and the slot only claims an
ack that echoes it; a send ack goes to the send waiter and vice versa.
GatewayHost seals and delegates; the WPF dialog shows the refusal's stable code
through SendTaskWindow.RefusalCode. The schema's `task.send` also allows
`code`.
Part of agents-demo#32.
SyncExitRun drives the app's own SyncCodec over a loopback socket and the shared SyncHttp port: ten sealed turns each way, a 20-op batch in one push and one pull, a second member's empty pull, and a revoked device refused with 401 and no new row. SyncExitRunTest runs it on PostgresHarness with real issued bearers and skips when Docker is absent. B2-accounts rows 1, 2 and 9 now quote the measured p50/max and leave the on-device legs pending.
A composer waits for the acceptance ack of its own trace, so a refusal without the trace looks like a timeout. Part of agents-demo#32.
The protocol contract checker rejects a schema family with no builder, and the composer frames had no documentation. Refusals for devices.list already travel as data.error. Part of agents-demo#32.
Every client re-pushes its whole local history on each pass and reseals each op with a fresh IV, so a retried op is never byte-identical. PgSyncStore compared body_hash and answered 409, so the second pass failed forever and nothing after the first op could upload. An op id that names the same kind, thread and turn is now a duplicate (stored seq, no write); anything else under that id stays a conflict. body_hash remains an integrity/diagnostic column only. Also scope the turn unique index by member (v0's log is per member) so one member cannot pre-empt another member's (thread_id, turn_id), and align the OpenAPI pull limit with the service clamp (minimum 0, 0 means the 200 default). Phase 2 sync v0, task 8a.
A re-pair kept the previous household's cursor and title record, so every op at or below the old seq was skipped forever: turns never arrived, and stale titles suppressed pushes. Persist the cursor's household+device and the title record's household beside them (the shape the Windows sidecar uses), start at 0 with no titles when the owner is not the current identity, and clear both when a claim changes the device or household. A pass also takes the identity again after the token and key reads and abandons the pass when it changed: a claim landing between them would seal household A's ops under B's key and wedge A's log. Chat sync now runs on every transition into Live, so a foreground reconnect pulls what a peer wrote while the socket was down, and report.skipped reaches SyncOutcome.Done and the manual sync message instead of being dropped. Milestone: G4 (sync v0).
The M0 design still listed payload fields the clients never send (the row already names the thread and turn), and the OpenAPI push summary still promised a byte-equality replay rule that the retry fix replaced. Part of agents-demo#32.
A pass read the identity, token and key one after another, but the tuple is written in pieces: persist writes secrets before the identity and sign-up writes the identity before the key. Two identity reads could therefore agree while the token came from one pairing and the key from another. A plain credential epoch is now bumped when a claim, a sign-up or a sign-out lands, and a pass captures it before the reads and gives up (no send) when it moved. The skip count also lied: OwnOpsIgnored rewrote this device's own replayed ops to kind=null, which the engine counted as skips, so a clean sync reported "N skipped". The engine now takes an optional ignore predicate that steps over such ops without opening them and counts them in SyncReport.ignored; the Android pass uses it for its own device and the sheet counts real skips only. Milestone: G4 (sync v0).
The epoch bump closes the common tear but not a pass whose whole read falls inside the write sequence, nor a kill in that gap. The comments claimed the stronger guarantee. Part of agents-demo#32.
The retry-idempotency fix added four tests, so the evidence line's 405 is now 409. Part of agents-demo#32.
Phone to PC 1.25 s warm and 2.42 s on the cold first pass, PC to phone 1.45 s, a revoked PC refused in 138 ms, and one sealed task done each way with the PC to phone execution carried as a gap. Row 1 and 3 stay unticked. Part of agents-demo#32.
Task a7e9bae9 opened the calculator on the PC from the phone. The run also exposed two wrinkles: duplicate phone device rows after sign-up then sign-in, and a composer that does not refresh an expired access token. Part of agents-demo#32.
Keeps the family-board protocol families next to the sync and task composer families: both sides of GatewayHost, the protocol schema, the golden frames and the host protocol table. devices.error returns as a real family with a literal builder, since TaskHandler already emitted it through dataError. Part of agents-demo#32.
Task 037ad005 was delivered and answered E_DEVICE, so the surface still does not answer and the gap is the accessibility service binding, not sync. Part of agents-demo#32.
The header status line was Visibility=Collapsed, so a refused devices.list or an unpaired client left the Send to phone button looking dead. It is visible now, and an unpaired window says so. Part of agents-demo#32.
The window chrome makes the top 52 px a caption, so a real click on Send to phone started a drag and a double click maximized; only the three window buttons were marked hit-test visible. UI Automation bypassed the chrome, which hid the bug in tests. Part of agents-demo#32.
Three warm rounds at 985/998/931 ms and a PC-to-phone task that ran to done after the phone's screen path was set to This phone. The cold first pass (2417 ms) stays recorded rather than dropped. Part of agents-demo#32.
4 of 11 tasks
GatewayHost.start runs startBoard before the gateway coroutine, and onBoard is a single slot: attach() replaced the board's receive handler with an error-only lambda, so board.op.ack and board.changed were dropped and every board append timed out on a paired PC. Chain to the handler that was already there and let both see error frames. Part of agents-demo#32.
The class doc promised that a peer's older op could not undo an unpushed local rename, but a pulled title is applied unconditionally and the titles record then suppresses the rename; the test pins that behavior and the PR lists it as a decision. Say what the code does. Part of agents-demo#32.
…other update() read a snapshot outside edit() and wrote every key from it, so concurrent writers (the sync pass persisting a cursor or titles, the UI, sign-up bumping the credential epoch) could silently revert each other's fields. Run the transform on the preferences edit() already holds. Part of agents-demo#32.
The sync reload checked Running and CurrentId before awaiting the engine, then rebuilt the view unconditionally, so a selection or turn that started during the round trip was overwritten. Every open bumps a generation; a stale reply returns without touching CurrentId or the view, and a reload also yields to a running turn. Part of agents-demo#32.
check-android-structure.py requires a file to carry one public declaration named after it, and contracts may share a file but behaviour may not. SendTaskSheet, RemoteTaskSender, SyncOwnership, DeviceListClient and the sync test fixtures each carried two, which failed both the Android and bridge CI jobs before they reached their tests. Part of agents-demo#32.
The factory appends the link to the list before connect() calls start() on it, so the test could observe the window in between and fail on a loaded CI runner. Poll for started inside the same timeout the file already uses. Part of agents-demo#32.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sync v0 for Phase 2 (Part of #32)
Turns typed on the phone now reach the PC and back through the backend, with the
op log, the gateway notification, both app clients and the sealed short-task path
from
docs/project/plan/backend/tasks/week2-sync.md.What changed
Backend (
services/backend)V10__sync.sql:sync_heads+sync_ops, append-only, RLS forced with theboard's household policy,
textclient ids, a partial unique index on(household_id, thread_id, turn_id), no cursor table (the client owns it).com.hopa.backend.sync:SyncStore,SyncService,SyncRoutes,SyncGateway,InMemorySyncStore;store/PgSyncStorebumps the head inside the tenanttransaction so a household's seq has no gaps or duplicates.
POST /v1/sync/ops(batch ≤ 100, ≤ 64 KiB per ciphertext, ≤ 256 KiB body,idempotent by
op_id,duplicateechoed with the stored seq) andGET /v1/sync/ops?after=&limit=(≤ 200, caller's household and member only).sync.changed {seq}fans out to the sender's other devices of the same memberafter a push with at least one new op; no FCM wake in v0.
PairingService.mintreuses the household's existing owner member instead ofinserting a second
'owner', so an operator-minted PC shares the phone's member.Shared client (
core/backend)sync/client:SyncHttp/OkHttpSyncHttp,SyncCodec(AES-GCM viaPayloadCipher),SyncEngine(push bounded by count and body size, pullwith a
SyncReport(applied, skipped)),SyncBacklog,SyncCursor,SyncTarget.onSyncChangedonBackendLink/BackendClient.TaskDraft: sealedtask.createbuilder andgoalOffor both body shapes.Android
BackendSyncowns merge in backend mode (the bridgeChatSyncis never built),cursor in settings, 250 ms coalescing,
sync.changedand local-write triggers,an open chat reload on change, content-derived-less title rule: a persisted
threadId → titlerecord so a message never re-pushes a stale title andrename-back still lands.
restore-after-delete and no turn tombstone.
RemoteTaskRunnerunsealsbody["sealed"]with the household key and keeps theplaintext path for server-authored
admin.action.Windows
ChatStore.mergeRemote(dedupe, ordered insert, LWW title, final tombstone),BackendSyncHost(cursor/titles files carry household+device and reset on are-pair, pass on every return to
Live, no cancellation of a live pass, a failedsave holds the cursor),
chat.changedin the sidecar↔host protocol, and a WPFreload of the open chat.
Review fixes on this branch
The whole-branch review found a blocking defect in the first cut, now fixed:
SyncCodecreseals with a fresh IV, so the sameopIdarrived with different bytes,which the server called a conflict;
SyncEngine.pushaborting the batch meant no turnafter the first pass ever uploaded.
f514bf0bdecides a duplicate by the op it names(
kind,threadId,turnId) and demotesbody_hashto integrity. The turn uniqueindex is now member-scoped.
4c3e4992): the cursor and titlerecord now name their household and device and reset on a mismatch, and
persistclears them.
d3da8cde,a717ae77): acredential generation marker is captured before the reads and re-checked after them;
the residual window is documented rather than over-promised.
4c3e4992): a pass now runson every transition into
Live.d3da8cde): the engine takes anignorepredicate and reports
ignoredseparately.6f8a32ff): the composer frames are documented and thedevices.errorfamily, which no builder emits, is gone —protocol-contract.pywasfailing before this.
0b6251dd): the M0 payload table and the OpenAPI duplicate rule now matchthe shipped code.
Evidence
Results are in the PR checks; the per-task review reports were kept out of the tree.
Phase 2 clauses
docs/project/evidence/B2-accounts.mdrecords what was measured here and what stillneeds the physical exit run. Phase 2 in #32 is not ticked by this PR: the
on-device turn latency, the 5 s revocation measurement and the device-to-device task
run need the phone and the PC on the local stack.
Decisions worth reviewing
V10__sync.sqlwas edited in place while the branch was open (the turn unique indexbecame member-scoped and the duplicate rule changed). It has never been deployed, so
nothing needs a follow-up migration; a local database that already ran the old V10
must be reset, and Flyway will refuse it loudly on the checksum.
opIdis a duplicate when it names the same op (kind,threadId,turnId), not when its bytes match: clients reseal a retry with a fresh IV, so byteequality could never be the retry path. A reused id that names another op is still
E_CONFLICT.objective asked for a PR.
sync_cursorswas dropped; the cursor is client-owned (after=).rename, which is the plan's "seq is authoritative" rule.
the UI rather than silently diverging.