Repository navigation
feat(canvas): reliable execute and multi-device sync - #386
Open
cxxxxxn (cxxxxxn) wants to merge 132 commits into
Open
cxxxxxn (cxxxxxn) wants to merge 132 commits into
cxxxxxn (cxxxxxn) wants to merge 132 commits into
Conversation
… order Add strict ordered diff, replay and inversion; integrate snapshots and identity remapping. Give Column/Row independent reading lists and relative Agent placements while preserving Grid cells and existing collaboration gates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Server-side core that saves one canvas mutation reliably: result-record lookup by request id, admission under the Workspace lease and Space mutex, shared-engine execution, and an atomic commit of state, events and the result record on SQLite, PostgreSQL and Disk (redo). Also keeps content operations, sessions, result lookup, the structural snapshot, commit replay with the SSE stream, and attaching Review records to a commit. This is the phase C work reduced to that core. Removed relative to the full snapshot on archive/phase-c-full-2026-11-11: - per-Space coexistence machinery (operation marker, per-backend activation flag, legacy-write rejection, RFS alias of the routes); one process-wide switch HUABU_CANVAS_OPERATIONS (off by default) now gates the operation routes - durable derived-work queue, metadata/cover/title/agent owners and their forks in legacy services, undo, Review accept/revert, retention and the maintenance loop Kept independent hardening on legacy paths: Workspace lease across mutex queueing, RFS upload scoping and no-overwrite creation. Nothing calls the core in production yet; the switch is off. Server suite: 11 failures remain, all in files identical to the parent commit (video-cover, external-watcher.real, image-gen and web-search entry, world-previews suite error). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
SpaceHandle.write can now persist a result record (principal + request id -> stored response) atomically with the state and delta log, and maintains per-node version stamps (created / membership) once a Space has a lazily created baseline. Adds SpaceHandle.save (lookup, stamps, record) and basis helpers. SQLite/PostgreSQL: migration v5 (space_save_heads, space_save_results), same transaction as the write. Disk: write-ahead intent under .history/save with idempotent recovery. Spaces without a baseline and writes without a result pay one key lookup / one stat. Contract tests run on every backend; crash-recovery fixtures cover SQLite and Disk. PostgreSQL remote tests were not run locally. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
executeOnServer accepts an optional request id and read version: - a request id is looked up before any preparation; the same request returns the stored output (replayed, no publish, no re-import), a different body is rejected; new work saves the result record in the same write, including no-op and conflict outcomes; an unknown save outcome surfaces as such - a read version rejects commands whose targets were deleted, or moved between frames for geometry/parent/order/align/distribute commands, via an admit hook in the shared engine (stale-target, stale-parent) - the sync update event and the output carry the request id Calls without either input behave as before; no existing test changed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- execute (RFS and /api/canvas) accepts an optional operationId and basis, returns operationId/basis/replayed, and maps the executor's errors to 409 operation-id-reused, 409 basis-unknown and 503 operation-outcome-unknown; GET execute/:operationId returns a stored response - every query response and node download carries the current basis - huabu-rfs execute attaches a request id per invocation, retries a dropped or timed-out request under the same id and bytes, prints the id on final failure, accepts --operation-id and --basis, and gains `result <operation-id>` - agent-facing guides describe basis, the request id and safe retry Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The executor derives Review records before the write and passes them to SpaceHandle.write, which stores the coalesced per-thread list in the same atomic unit as state, delta, result record and stamps on all three backends; the best-effort append after the write is gone and a replay never appends twice. Thread attribution on both execute routes is dropped unless the thread belongs to the Space. All machine-token callers still share one principal, so this checks membership, not which agent is calling. Also: exported and imported Spaces no longer carry .history/save (an imported Space starts without a baseline); the stored-result lookup answers 404 for results that are not RFS executes; core reliable-save executor cases now also run on SQLite. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Reliable save now lives in the executor and SpaceHandle.write, so the parallel operation path is removed: canvas/operations, the SpaceOperationStore port with its rules and three backend adapters, the Disk redo adapter, the shared canvas-operations protocol, the operation branch of the sync stream and the HUABU_CANVAS_OPERATIONS switch. Migration v6 drops the tables v3 created for it. Shared SQL text and pure rules for save and Review coalescing move to storage/backends/sql. Architecture docs describe the request id, read version, result records and node version stamps; the realtime-sync proposal carries a status note on what is superseded. PostgreSQL schema tests for v6 need a real database and were not run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Conflicts: - canvas.route.ts: upstream dropped the owner-only check on agent execute batches; kept that removal and this branch's request-id and basis handling - preprocessing/dispatcher.ts: both workspace imports are needed - agent-thread.service.test.ts, setFrameLayoutCells.test.ts: both sides added tests; kept both - external/agenetes: taken from upstream as is; this branch no longer changes the subtree (upstream fixed ACP close during startup itself) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Node writes and the executor now hold a Workspace lease, so a suite that runs them without a configured Workspace (video-cover) or with a partial workspace mock (world-previews) failed. Both suites pass on main; this branch broke them. Provide the lease in their mocks. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The separate operation path these notes referred to was removed. Describe what the execute write does with an order-only change today and which read-version checks cover placements. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The [ and ] shortcuts pass the whole selection to REORDER_NODES, which rejects a selection that spans containers or includes a locked layer. Nothing happened and nothing was shown. Check admission in the resolver and show an auto-dismissing warning instead. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An execute batch that only changes layer order committed with empty deltas, so other open pages kept the old stacking until reload. executeOnServer now attaches the batch's SetSiblingOrderEvent list as an optional orderEvents field on the update notification and the execute response. The browser replays it after the entity deltas; events that do not fit the local forest leave the entity-only result in place and fall back to the existing reload when there are no unsaved local edits. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two real browser contexts open the same Space. Each case (move, create, delete, accent colour, layer order, two writers on different nodes, note body, execute control) has a 'current' test pinning today's behaviour and a 'target' test.fixme stating the intended behaviour. Set E2E_RUN_SYNC_TARGETS=1 to run the targets as expected failures. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…updates per property A ui command batch now runs locally and is then sent to POST /execute by a serial send queue with a request id and the page's client id; a failed request is repeated with the same id. Free-drag drops and resize previews are sent by the batch that closes the gesture. Incoming updates, including the page's own, are applied per property unit: a unit this page changed and has not had confirmed keeps the local value, and the remote value is kept as the unit's last confirmed value. A person's edit takes no undo snapshot and does not change selection on another page. The remaining whole-Space PUT and any reload wait for the queue. The update event gains an optional source field. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e close While a queued execute request keeps failing the page shows a persistent unsynced notice and retries on its own, at once when the browser comes back online. After 8 failed attempts or 60 s the queue stalls and the user chooses between keep trying and reloading the Space without the unsent changes; the page never reloads over them by itself, the whole-Space PUT is held, and leaving the Space is refused. On page close unanswered batches are sent with keepalive under their existing request ids and the browser is asked to confirm. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nds; keep the PUT for the rest Undo and redo, patchNodeSilent and measured heights now reach the server through the send queue whenever commands can reproduce their result; the proposal read from the state difference is run through the engine first and used only if it gives exactly the intended state. An undo entry records what its edit changed, so once another page's edit has been applied an undo puts back only that. A measured height is applied locally and reported once, after the node's content save, and not over a measurement already on the server. The whole-Space PUT stays for what no command can say (a node coming back, a cleared data key, layout around renderer-measured children, the title). While one is pending, edits join it instead of the queue, and what waits for it — like what a pointer gesture has changed so far — is held against incoming updates. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When a Space is open on several pages, each page now sees the others: a coloured cursor at the other page's pointer, and an outline in the same colour around the nodes that page has selected, is dragging or is editing. A marker stands for a page (colour from the server, device label from the page); the payload has room for a person's name later. Presence is ephemeral. A page reports through POST /presence and receives the others as `presence` events on the existing Canvas Sync stream. The server keeps it in memory per Space, outside the sync publisher, and drops a page on leave, when its stream closes, or after 75 s of silence. The browser keeps it in its own store, so nothing enters the Space record, its version, undo or a save, and a pointer tick re-renders only the cursor layer. A drag is reported as "being moved"; the position still arrives on drop. The page id is the existing originator.tabId, moved to its own module. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two devices open one Space with different pan and zoom. B must see A's cursor and the outline of the node A selected where they belong under B's own viewport, see that A is moving or editing a node without the drag being streamed, and lose both markers when A closes or navigates away. Neither page may save anything or change the Space version while doing so. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A node-content save does not change the Space version, so the other pages were only told that a node had been saved and kept their copy until they reloaded. Each of them now fetches the node named by the invalidate event and shows it, with its revision as the new save baseline, unless it has unsaved content of its own for that node; that case keeps the existing content-conflict choice. The save names its page so the saving page does not fetch what it wrote. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ge undo RESTORE_NODES puts nodes and edges back as a page's undo history holds them: a node not named in `replace` is inserted with its id and content and must not exist; one named there must exist and is replaced in place, keeping the data keys the command lists. Parents must exist and be containers, a node returns under a lock only as the member it was, Agent Nodes cannot be inserted and never change type. The command is UI-only: it is not in the agent schema and is refused for an agent batch. MERGE_NODE_DATA patches take `unset`, the data keys (or `style.<leaf>`) to remove, admitted like a write of the same key. JSON drops a key whose value is undefined, so a page states the removal there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
While another page reports a node as being edited, this page cannot start editing its body or title: the preview is read-only with a notice, in-place editing and renames are refused with a short hint. Moving, resizing and styling stay allowed. The lock lives only in presence. It ends when the editor loses focus or closes (after the last save has been answered), when the window loses focus, after two minutes without input, and with the page's presence. The content revision check remains the safety net for a race. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…_SIZE Text, Question and Space Shortcut nodes have no authored height, so the headless engine could lay a Frame out around them only from the `measured` a whole-Space save carried. APPLY_MEASURED_SIZE reports the box a renderer measured: it is stored as `data.measuredSize` with the key (content revision and authored width) it was measured under, mirrored to `measured`, and the affected Frames are laid out again by the executor's end-of-batch pass. An item whose key no longer matches the node is ignored, as is an unchanged box, so neither writes a version. UI-only like APPLY_MEASURED_HEIGHT, and refused for an agent batch. RESTORE_NODES seeds a returning node's `measured` from a box reported for exactly its content. Also gives the restore test's seeded sidecars the content field the store type requires. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PATCH /canvas/:id/title advances the version without touching a node. It published a snapshot, which every open page answered by loading the Space again. It now publishes the update from the previous version to the new one, with no deltas and the new title (an optional field on the update event), so pages stay in step and show the title without a reload. The conversation-owner stream refreshes on it as it did on the snapshot. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…r pointers Presence markers now use the node accent palette (teal, orange, purple, green, red, amber) through the existing accent foreground tokens instead of six tokens of their own; amber uses the darker variant so the label text stays legible in the light theme. A pen is reported while it hovers and while it is in contact, and a single finger is reported at its contact point and for a moment after it lifts. Two fingers navigating are not reported. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`unset` is a page's way to state a removal JSON cannot carry. An agent clears with null where a field allows it, and its schema never carried `unset`; a batch that claims the agent origin over HTTP is now refused too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every writer that still ended in PUT /api/canvas/:id now sends commands through the send queue, or is local by nature: - Undo and redo plan their commands in sync/restorePlan.ts: per-property commands where they exist, RESTORE_NODES for a node or edge that comes back (the server writes its content in the same batch) and for a surviving node no property command reaches. The plan is run through the engine as the one batch the server will execute; when the engine would not reproduce the snapshot the page shows what the commands give, so page and server agree. A returning Agent Node keeps its association path and content hold; its edges and order follow in a gated batch. The restoring batch waits for the node's sidecar DELETE, and content saves and preprocessing for the node wait for the batch. - A data patch that clears a key with undefined is sent with `unset`. - Frame layout around renderer-measured children stays this page's own; the measured box is reported with APPLY_MEASURED_SIZE and the server lays the same Frames out. A page reports only when its own measurement of a content changes, never in answer to another page's box. - The Space title goes to PATCH /canvas/:id/title; pages learn it from the rename's update. - Read-model hints and the rollback of a failed creation are local only. The load-time Frame-header migration is sent as geometry commands and the Space is loaded again. The page-close flush is the queue's keepalive flush. With no caller left, saveCanvas, the structure scheduler, the dirty detector, the version-conflict state and its toast, and the save reconciliation helpers are removed. drainPendingSaves waits for the queue, pending associations and content; a request that was failing is retried at once and one more failure rejects the drain, as a failed PUT used to. The action-log buffer is flushed when the queue drains. Tests that asserted the PUT are rewritten for the commands that replace it; the PUT-only cases (version conflict, structure-save retry, edits joining a pending PUT) are removed with the code. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Page A undoes a deletion and a type change, clears a data key, grows a Text inside a hug Frame, shows a read-model hint and renames the Space. Page B holds an undo entry from before. The spec asserts that neither page sends PUT /api/canvas/:id, that page B never fetches the Space again or reloads, that it shows page A's results, and that its own undo still works. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…save Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Node content between pages, the one-editor-at-a-time lock and the presence changes, on top of the browser no longer saving the whole Space. Conflicts: - multi-page-sync-baseline.spec.ts: case (f) is content-sync's two passing tests; the `target` switch and its leftovers are gone. The store fields drop-structure-put removed (`versionConflict`, `isSaving`) are not read; the conflict-toast count already asserted stands in for them. - canvasSyncStore.test.ts: both sides' tests, with one mock set that has the Space title setter and the remote-content hooks. - canvas-realtime-sync.md: content fields reach other pages through the content path, there is no whole-Space PUT, and the renderer box is reported through APPLY_MEASURED_SIZE; the gaps either branch closed are removed, and sentences that still described the PUT, its 409 path or the structure scheduler are rewritten. Also needed for the two to fit: - content-sync.spec.ts and canvasStore.remoteContent.test.ts read `isSaving` / `pendingSave` / `versionConflict`; they now ask `hasUnsavedCanvasEdits()`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two browser contexts with real keyboard, mouse and clipboard: a cut on one page empties the other, a paste arrives there with bodies, edge and Frame child, undoing brings the originals back with bodies and edges, and a cut PDF with its Note returns linked, with the Note's text and the PDF's text extracted again. The receiving page never reloads, loads the Space again or gains an undo entry. Documents cut, paste and the restore of server-derived data in canvas-realtime-sync.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A REPLACE_NODE row names the node and holds, in prev and next, just the fields that differ (data key by key) with their previous and new values; a body the batch did not touch no longer travels. One applier, mergeNodeFields, merges a row into the node as it is now: applyDeltas, the server's delta replay and Review revert, and the page's update path (which expands a row against its live node before its field-level rewrite) all use it. Rows in the old whole-node format are valid input of the same applier and are reduced by slimDelta. A deletion keeps the whole node in the diff and in the Review record of the batch, which is the only place its content exists afterwards, and is reduced to an id when it travels (toWireDeltas, applied where an update is published and where the delta log row is built). Review extraction, fingerprints, staleness and coalescing work on partial rows; imported history is read in both formats. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The log is a journal nobody reads except Disk crash recovery, which asks for its last row. It was written on every edit and never pruned. A Space now keeps the rows of its newest 200 versions. SQLite and PostgreSQL delete what is older in the write that adds a row (one range delete on the primary key). Disk, whose log is one append-only file, is cut to its newest part (at most 100 rows and 2 MiB, read from the tail) when it spans 200 versions or reaches 4 MiB, before the write takes its before-image of the file. A row is stored whole up to 64 KiB; a larger one keeps its header and says what was left out. Every check costs the same whatever the log holds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…and records carry only what changed
Request. The page route takes { operationId?, runId?, originator?, edits }
with Edit = { basis?, after?, commands }; commands, runs and the top-level
basis are gone. The Agent route and the CLI keep accepting
{ commands, basis? } unchanged: it is converted in one place into one edit
per command, each quoting the basis, and answered in the response shape
it always had. The Agent route also accepts edits.
Engine. Edits run in order. An edit is all-or-nothing: when one of its
commands does not take effect (any result that is not applied, other than
no-op) the state returns to the one the edit started from and what it
accumulated (pending effects, frames to fit, explicit sizes) is dropped,
so the end-of-batch passes run over the surviving edits only. An edit made
on top of an edit that did not take effect does not run; unrelated edits
still apply. The read version is judged once per edit.
Response and event. Results are grouped per edit (applied, reason,
failedAt); commands are not echoed; pending effects name mutated nodes by
id.
Result record. A request id stores the outcome of the request (per-edit
results, generated ids, versions, order events, content revisions, basis)
instead of the response, so its size does not depend on what the request
changed. Both entry points answer from the outcome; a replay is the first
answer without deltas. An outcome too large for a record is stored
without its optional parts instead of not at all, so a retry never
executes twice. Records in the old format are still read.
Page. The send queue holds edits, a request is frozen at first send, and
later edits name earlier ones by { operationId, edit }.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d delta log The architecture docs now state the implemented contract: the edits request and its per-edit response, the all-or-nothing engine rule and what counts as a failure, the legacy Agent form as one edit per command, partial node rows and their one applier, where a deleted node's content is kept, what a request id stores and what a replay contains, and the delta log's retention. Adds unit tests for the outcome, its size ladder and reading a record stored in the old format. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Locking is a ui-only command; an agent batch carrying SET_NODE_LOCKED has been refused as invalid-scope since the single execute admission. The spec seeded the lock through its agent fixture and failed. The lock is now sent as a person's edit; the other fixtures keep the agent source. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
No textual conflicts. One semantic conflict: main removed the functional text task id (it existed only to build the reachback environment), while this branch logged it from the cleanup path it added; the two log lines now carry the profile id. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pace persists Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s real callers
The page execute route kept one affordance only tests used: a browser
session could send originator.source 'agent' and be treated as an Agent.
The source is now the credential's and nothing else:
- executeRequestOriginatorSchema is a strict { tabId?, threadId? }; a body
that states originator.source, any value from any credential, is 400.
- admitExecuteRequest takes no claimed source; SOURCE_NOT_ALLOWED is gone.
Fixtures now act as the caller they stand for:
- e2e: a person's seed goes through the page route (personEdits: one edit
per command and, as a page does, no created node selected on the
server). An Agent's write goes through the Agent route with the machine
credential (e2e/agent-execute.ts); playwright.config.ts gives the backend
it boots that credential with HUABU_CONNECTION_TOKEN, the variable a
deployment uses.
- server route tests mark the request as made with an agent credential
(test-support/agent-credential.ts) instead of claiming a source.
Three fixtures depended on a caller no client can be (a page-route batch
run as an Agent): Frames fitted by the Server to children (now an Agent
groups them), a Note named after its body (now the name a person gave),
and a rename from a background tab's menu (now from the tab on show; the
background case is a fixme with the observed cause).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…sation
The page route's originator is now { tabId? } only; a body naming a
threadId is refused with 400 from any credential. Conversation attribution
stays with the Server's own agent tools and the Agent route's
X-Huabu-Host-Thread-Id header. No page sent the field.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… content Through the real sync store, canvas store, content queue and change-review store: an agent's body, structure, title and deletion against a body or a title being saved here, and another person's save against a body being typed. These are today's outcomes; the unification changes the ones the comments name. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…coming changes Content units (body, title, summary, each custom property, the display order) of a node with unsaved content are held like structure units: the remote value is kept back and buffered, everything else of the change is applied. Both delivery routes go through the same partition (toFieldLevelDeltas via BrowserSync.prepareRemote): an update's rows, and content fetched after an invalidate as the row an update would carry. - applyServerDeltas reads as a pipeline (580 -> 248 lines); the dirty-node filter, its Question branch, the accumulator lists and the repeated diffs are gone, as are remotePropertyChanges / installRemoteProperties / installRemoteContent and the two property-key constants. - One predicate, NodeContentQueue.hasUnsaved, with unsavedNodeIds, hasUnsavedContent and whenInFlightSaved defined in terms of it. - A deletion of the node being edited is kept back: the person is told, the node stays until the editing ends and nothing is sent for it; it is then removed and unsaved text is offered for copying. - Custom properties are one property unit per key. Behaviour changes, as specified: a title, summary or structure change to a node whose body is unsaved applies at once (it was dropped or kept local); a body arriving for a node of which only the title is unsaved is shown. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The content PUT is unchanged; the page now sends what it changed since its baseline: the body with expectRev, the title with its source, summary, keywords, provenance, each only when changed, and properties per key as before. A node the page is creating, or an undo brings back, is still sent whole. After a body conflict, Keep mine resends the body alone on the server's revision, so it no longer writes this page's copy of the title or summary over one another writer changed meanwhile. A flush with nothing changed sends no request. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e standing Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The content revision protects the body only. A title a person or an agent gave (label / labelSource other than auto) is an independent small item, like a custom property, colour or position: different items never conflict and the same item is last-writer-wins. Page: a save that carries only a title and/or properties quotes no expectRev, and its answer never moves the body's baseline (the revision it names may be of a body this page has not shown). A node frozen by a body conflict still sends a rename by itself. Summary, keywords, provenance and an automatic title are derived from one particular body and keep quoting its revision. Server: expectRev is checked only for a request that carries the body or something derived from one. When that part is refused, the authored title and the property patch beside it are written all the same and the 409 says so (titleApplied, propertiesApplied). A name another node uses still rejects the whole request. Also: a content fetch under way is no longer dropped when the page makes its first save of that node during it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…act inherited from main Investigated the fixme in preview-title-rename.spec.ts with real input on this branch and on origin/main (7645d4e), development and production builds. Rename from the context menu of a tab that is not on show activates the tab and opens no title editor in the development build, on both, for nodes a person made and for nodes an Agent made; a production build opens the editor on both. Cause: showing the tab's hidden Activity sets up the panel's effects, and React.StrictMode repeats them. The rename-request effect in ExpandedNodePanel skips a request it has handled, while the 'always exit edit mode' effect runs again and closes the editor the first pass opened. Not fixed here: it is not a regression of this branch. The fixme stays, with the cause, the origin and the suggested fix; its fixture now gives the nodes a person's title (without one the Note is named after its body and the tab the test looks for does not exist) and outlasts the moment after the creating batch in which the reveal is not repeated. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The page ran a gesture's commands one edit per command and then sent them as one edit. A command the engine refused was skipped here and the rest applied, while the server refused the whole edit: rejection notice, reload, and the gesture was undone. - executeCommands runs a ui batch that closes a gesture through executeCanvasEdits as one edit (executeGesture), as do the two places that check a command list by running it before it is sent: the commands a silent patch is read back as, and an undo/redo plan. Preview ticks and agent/system batches, which are not sent as an edit, stay per command. - DELETE_NODES intent with edge ids emits DISCONNECT_EDGES before DELETE_NODES. Deleting a node removes its edges, so the disconnect that followed found none, reported not-found and refused the edit. The engine is unchanged: a plain command list (the Agent route) still reports not-found for an edge that is not there. Reached through the UI by pressing Delete while a marquee is still held: that is the one state in which the store has nodes and their edges selected together (a finished marquee clears edge selection, and its Delete sends DELETE_NODES alone). Tests: store tests for the deletion and for a gesture with a refused command, engine tests for both orders and the unchanged Agent reporting, and a two-page e2e (delete-with-edges.spec.ts). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ked node is never taken "This page is editing node N" was decided by DOM focus in two places (editingNodeId in the presence hook, pageIsEditing) that both counted any focused textarea, input, select or contenteditable of the node, excluding only readOnly fields. A page locked out of N could put its caret into a surface that is read-only but focusable, was then reported as editing N, exempted itself from the lock, and both pages typed. Reproduced with two pages for the raw Markdown source (CodeMirror with EditorState.readOnly stays contenteditable) and for the find field of the preview: the lock notice went away, the body became editable, the locked-out page saved content and the editing page was shown the other as editor. - One classifier, writableControl in localEditing.ts, used by the report (editingNodeId, moved there) and by pageIsEditing. It does not count a readOnly field, an aria-readonly editor (how CodeMirror presents EditorState.readOnly; also covers the read-only file source view), or a control marked data-not-node-content (the preview find field). - The editing tracker asks "held elsewhere?" whenever it is about to report a node it does not report, not only on return to the page: focus moving into a control of a node another page edits blurs the control and shows the hint. resume() was that check plus sync() and is folded into sync(). Tests: classifier and tracker unit tests, and two two-page e2e tests in content-sync.spec.ts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A text node edited in place kept its draft in component state and wrote the store only on blur. The content queue therefore knew nothing of it while the person typed. Reproduced with the real Agent route: an Agent's body for that node was applied to the store under the caret without a notice (the control went on showing the draft), and the blur then saved the draft over it, also unannounced. The lock's save-on-release and the reload gate found nothing to save. The control now does what the note editor does: every change is written to the store, where the content queue schedules its save and holds the body against incoming changes. No second mechanism: the Agent's body is kept back, the "your version was kept" notice and the review card report it, and the draft is saved on the Agent's revision, exactly as for a note. - One undo entry per editing session: the first change goes through updateNodeData (the snapshot of the text before the session), the following ones through patchNodeSilent. - useTextNodeSurface: the draft follows the store's text at all times, so a value the control did not write (an undo, the server's body taken after a conflict) is shown instead of being overwritten by a stale draft. Its isEditing option is gone. - Blur no longer commits; it settles preprocessing when the session changed the text. Tests: an e2e in content-sync.spec.ts (person typing, Agent writing through /api/rfs with the revision it read), store and hook unit tests; the reload e2e now expects the typed text in the store before blur. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…oes away
A page runs a gesture as one edit, so a gesture one of whose commands the
engine refuses changes nothing and is not sent. It also showed nothing: the
person pressed Cmd+G over a selection with a locked note and saw no reaction.
- executeCommands, the one place a refused gesture is noticed, shows one
warning toast (auto-dismissing, the toast default) and returns
{ refused }. The text is read from the failing command: grouping that
includes a locked node, a change that touches a locked node or Frame, or
a general wording. `not-found` stays silent (the target is already gone),
preview ticks and agent/system batches never show it, and a repeated
attempt within 1.5 s is one hint.
- A refused drag takes back what its ticks moved through the existing
cancelActiveNodeDrag: before, a Cmd-drag dropped into a Frame nested in a
locked Frame left the node at the drop point outside the Frame and sent
that move.
- dispatchUiIntent stops at a refused batch, so no trace entry, reveal or
editor is requested for a node that was never created.
- hasUnlockedAncestry is exported from the engine so the page reads a lock
the way the handlers do.
Verified refused through the store: Cmd+G and a drawn Frame around a locked
node (invalid-parent at SET_NODE_PARENT), a Cmd-drag into a Frame under a
locked Frame (invalid-parent at SET_NODE_PARENT), a node added on a grid
Frame under a locked Frame (invalid-target at SET_FRAME_LAYOUT).
Tests: store tests for the four cases, the general wording, the silent
cases and the repeat window; a two-page e2e for Cmd+G
(refused-gesture.spec.ts).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main shipped server records as SQL schema v3, so this branch's migration (save heads, result records, node change sequence) becomes v4; the pinned SQLite schema fixture, the schema tests and canvas-storage.md follow. main's async settings reads are awaited in the executor's review-record gate, and the whole-Space PUT route main still edited stays removed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The store now sends its edits through execute; under the test setup that came with the dependency upgrade on main, the unanswered retries kept the suite's teardown waiting until it timed out. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-backend durability, crash recovery, and browser convergence require human review because final-head PostgreSQL verification and real multi-device/desktop validation remain unverified.
No open issues 🎉
What changed in this PR
Introduces an execute-based write path for agents and browser edits, enabling multi-device Space synchronization without whole-Space saves.
Changes:
- Adds retry-safe operation IDs, read-version checks, credential-based attribution, and storage support.
- Connects browser edits, content catch-up, presence, and advisory editing locks.
- Preserves layout order and measured geometry, with updated contracts, documentation, and test fixtures.
| File | Description |
|---|---|
space-kits/issue-tracker-setup/tests/rfs.integration.test.mjs |
Authenticates RFS integration requests. |
packages/shared/src/utils/node-label.ts |
Shares label-protection rules. |
packages/shared/src/utils/conversation-title.ts |
Shares conversation-title policy. |
packages/shared/src/utils/basis.ts |
Encodes and validates read versions. |
packages/shared/src/utils/basis.test.ts |
Tests read-version encoding and validation. |
packages/shared/src/utils/agent-node-transition.ts |
Centralizes authorized Agent-node projections. |
packages/shared/src/types/canvas/node.ts |
Adds measured-size and layout-order fields. |
packages/shared/src/types/canvas/index.ts |
Exports new command and execution types. |
packages/shared/src/types/api/ink-sigil.test.ts |
Tests Sketch validation without Canvas PUT. |
packages/shared/src/types/api/index.ts |
Exports layout, command, and presence contracts. |
packages/shared/src/types/api/frame-layout.ts |
Defines structured-layout wire schemas. |
packages/shared/src/types/api/common.ts |
Updates error-contract documentation examples. |
packages/shared/src/types/api/canvas-presence-limits.ts |
Defines shared presence bounds and timings. |
packages/shared/src/types/api/agent-node.ts |
Removes obsolete node schema; extends projections. |
packages/shared/src/index.ts |
Exports new shared utilities. |
packages/shared/src/canvas-engine/height/index.ts |
Exports measured-size freshness helpers. |
packages/shared/src/canvas-engine/container/zorder.ts |
Materializes rendering forest order. |
packages/shared/src/canvas-engine/container/index.ts |
Exports forest-order helper. |
packages/shared/src/canvas-engine/commandScope.ts |
Enforces source-specific command permissions. |
packages/shared/src/canvas-engine/commands/setNodeGeometry.ts |
Updates masonry reading order after moves. |
packages/shared/src/canvas-engine/commands/initializePdfNote.ts |
Accepts validated page-selected Note IDs. |
packages/shared/src/canvas-engine/commands/index.ts |
Registers restoration and measured-size commands. |
packages/shared/src/canvas-engine/commands/dissolveFrame.ts |
Updates sidecar-persistence comments. |
packages/shared/src/canvas-engine/agentNodeOwnership.test.ts |
Tests ownership without obsolete PUT schema. |
docs/proposals/node-write-unification-plan.md |
Qualifies revision co-delivery guarantees. |
docs/proposals/node-height-ownership-model.md |
Records revised collaboration measurement design. |
docs/proposals/agent-node-fsm.md |
Updates documented sync method name. |
docs/proposals/agent-node-freshness-cas-plan.md |
Documents server-issued revision baselines. |
docs/architecture/space-preview.md |
Removes obsolete structural-PUT description. |
docs/architecture/question-node.md |
Documents workspace leases and structural storage. |
docs/architecture/note-node.md |
Documents remote content and editing locks. |
docs/architecture/node-auto-height.md |
Documents queued measurement persistence. |
docs/architecture/device-files.md |
Documents execute-based reference creation. |
apps/web/src/store/conversationPreparation.test.ts |
Updates raw-state fixtures. |
apps/web/src/store/conversationOwner.ts |
Adopts edit batches and revision-aware replay. |
apps/web/src/store/canvasStore/sync/syncStatus.ts |
Exposes user-facing send-queue status. |
apps/web/src/store/canvasStore/sync/pageId.ts |
Creates shared per-page identity. |
apps/web/src/store/canvasStore/siblingOrderReplay.ts |
Replays server sibling order with divergence detection. |
apps/web/src/store/canvasStore/save/structureSaveReconciliation.ts |
Removes obsolete whole-Space save reconciliation. |
apps/web/src/store/canvasStore/save/eventBuffer.ts |
Documents send-queue event flushing. |
apps/web/src/store/canvasStore/save/__tests__/unsavedFields.ts |
Adds held-content-field test helper. |
apps/web/src/store/canvasStore/save/__tests__/structureSaveReconciliation.test.ts |
Removes obsolete reconciliation tests. |
apps/web/src/store/canvasStore/save/__tests__/preprocessQueue.restore.test.ts |
Updates raw-state mock. |
apps/web/src/store/canvasStore.signOutSave.test.ts |
Removes whole-Space save fixtures. |
apps/web/src/store/canvasStore.previewLifecycle.test.ts |
Updates raw-state fixtures. |
apps/web/src/store/canvasStore.postCreateEditing.test.ts |
Updates raw-state fixtures. |
apps/web/src/store/canvasStore.noteHeight.test.ts |
Isolates local sizing from execute responses. |
apps/web/src/store/canvasPresence/deviceLabel.ts |
Builds browser and device presence labels. |
apps/web/src/store/canvasPresence/deviceLabel.test.ts |
Tests device-label formatting. |
apps/web/src/store/canvasHistoryManager.test.ts |
Tests remote content preservation through undo/redo. |
apps/web/src/pages/CanvasPage/CanvasPage.tsx |
Removes legacy conflict-toast cleanup. |
apps/web/src/pages/CanvasPage/CanvasPage.deepLink.test.tsx |
Updates load results and state fixtures. |
apps/web/src/hooks/useTextAutoSize.test.tsx |
Tests drafts following store content. |
apps/web/src/hooks/useSketchStrokeMove.test.tsx |
Updates raw-state fixture. |
apps/web/src/hooks/useSketchHoverRouting.test.tsx |
Updates raw-state fixture. |
apps/web/src/hooks/useDesktopContent.test.tsx |
Updates desktop save mocks. |
apps/web/src/hooks/useActivelyViewingQuestion.test.ts |
Updates raw-state fixture. |
apps/web/src/handler/canvasPointerRecognizers/viewportNavigation.test.ts |
Updates raw-state fixture. |
apps/web/src/handler/canvasCommand/utils/frameLayout.ts |
Includes reading lists in relayout commands. |
apps/web/src/handler/canvasCommand/uiIntent.ts |
Validates reorders and disconnects edges before deletion. |
apps/web/src/handler/canvasCommand/resolvers/resolvePasteClipboard.ts |
Remaps copied Frame reading lists. |
apps/web/src/handler/canvasCommand/resolvers/resolveNodeDragStop.ts |
Preserves masonry insertion order during drops. |
apps/web/src/handler/canvasCommand/resolvers/__tests__/resolveReorderNodesRelative.test.ts |
Tests reorder rejection feedback. |
apps/web/src/handler/canvasCommand/resolvers/__tests__/resolveNodeDragStop.masonry.test.ts |
Verifies persisted masonry reading order. |
apps/web/src/handler/canvasCommand/__tests__/postEffects.web.test.ts |
Updates post-effect test arguments. |
apps/web/src/components/Space/SpaceDeletionDialog.test.tsx |
Updates save-recovery and state mocks. |
apps/web/src/components/Panels/ExpandedNodePanel/InPreviewSearchBar.tsx |
Excludes search controls from editing presence. |
apps/web/src/components/Panels/ChatPanel/useNodeMentionTypeahead.test.tsx |
Updates raw-state fixtures. |
apps/web/src/components/Panels/ChatPanel/ChatContextSources.test.tsx |
Updates raw-state fixtures. |
apps/web/src/components/Panels/ChatPanel/ChangeReviewCard.tsx |
Uses raw-state setter for previews. |
apps/web/src/components/Panels/Canvas/selectionChrome/SelectionOutline.tsx |
Supports remote-selection outline colors. |
apps/web/src/components/Panels/Canvas/presence/usePresenceLabel.ts |
Localizes presence names and activities. |
apps/web/src/components/Panels/Canvas/presence/CanvasPresenceLayer.tsx |
Mounts presence reporting and overlays. |
apps/web/src/components/Panels/Canvas/MultiSelectResizer.tsx |
Closes gestures after empty resize commits. |
apps/web/src/components/Panels/Canvas/MultiSelectResizer.test.ts |
Adds gesture-close mock. |
apps/web/src/components/Panels/Canvas/MoveSelectionPopover.test.tsx |
Removes obsolete pending-save state usage. |
apps/web/src/components/Panels/Canvas/Canvas.tsx |
Mounts Canvas presence layer. |
apps/web/src/components/Nodes/spacePreview/SpacePreviewNode.test.tsx |
Updates raw-state mocks and assertions. |
apps/web/src/components/Nodes/question/QuestionNode.tsx |
Checks remote locks before title editing. |
apps/web/src/components/Nodes/question/questionCompose.ts |
Uses raw-state setter for association responses. |
apps/web/src/components/Nodes/question/questionCompose.test.ts |
Updates raw-state fixtures. |
apps/web/src/components/Nodes/note/NoteNode.tsx |
Blocks content drops during remote editing. |
apps/web/src/components/Nodes/NodeWrapper.tsx |
Ensures resize gestures close. |
apps/web/src/components/Nodes/NodeWrapper.test.tsx |
Adds gesture-close mock. |
apps/web/src/components/Nodes/frame/FrameNode.tsx |
Checks remote locks before label editing. |
apps/web/src/api/canvasSync.ts |
Adds page-aware streams and content catch-up. |
apps/web/src/api/canvasPresence.ts |
Sends best-effort presence reports and departures. |
apps/web/src/api/_routes.ts |
Adds presence and content-change routes. |
apps/web/playwright.config.ts |
Shares machine credentials with test backend. |
apps/web/e2e/web-reading.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/video-preprocess.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/video-border.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/unified-links.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/toolbar-inputs.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/text-surfaces.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/system-blue.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/structured-drop.spec.ts |
Migrates helper to person edit batches. |
apps/web/e2e/space-conversation.spec.ts |
Adopts edit batches and page-only originator. |
apps/web/e2e/session-recovery.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/select-all-cut.spec.ts |
Adopts edit batches and nested results. |
apps/web/e2e/question-insertion-stability.spec.ts |
Migrates fixtures to edit batches. |
apps/web/e2e/question-card-scale.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/production-selection-resize.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/preview-tab-drag.spec.ts |
Updates raw-state fixture. |
apps/web/e2e/preview-groups.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/preview-card.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/pdf-highlight.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/paragraph-touch-drag.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/overlay-panels.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-touch-scroll.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-surfaces.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-scroll.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-drop-indicator.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-comments.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/note-auto-height.spec.ts |
Exercises authenticated Agent execution. |
apps/web/e2e/node-radius.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/node-deep-link.spec.ts |
Adopts edit batches and page-only originator. |
apps/web/e2e/nested-selection-chrome.spec.ts |
Migrates helper to person edit batches. |
apps/web/e2e/nested-frame-resize.spec.ts |
Migrates helper to person edit batches. |
apps/web/e2e/interactive-node-drag.spec.ts |
Adopts edit batches and page-only originator. |
apps/web/e2e/helpers.ts |
Adds edit-batch fixture helpers. |
apps/web/e2e/frame-marquee.spec.ts |
Separates person fixtures from Agent layout writes. |
apps/web/e2e/fixtures/ink-toolbar.tsx |
Updates raw-state fixture. |
apps/web/e2e/fixtures/ink-sigil-rendering.ts |
Updates raw-state fixture. |
apps/web/e2e/file-comments.spec.ts |
Migrates fixtures to person edit batches. |
apps/web/e2e/cross-frame-marquee.spec.ts |
Uses authenticated Agent writes for fitted grouping. |
apps/web/e2e/conversation-sync.spec.ts |
Updates edit requests and ID-only effects. |
apps/web/e2e/chat-stop-history.spec.ts |
Migrates fixtures to edit batches. |
apps/web/e2e/chat-queue.spec.ts |
Updates raw-state fixture. |
apps/web/e2e/chat-node-mentions.spec.ts |
Updates raw-state fixtures. |
apps/web/e2e/chat-context-sources.spec.ts |
Updates raw-state fixtures. |
apps/web/e2e/canvas-mouse.spec.ts |
Migrates fixtures to person edit batches. |
apps/server/src/test-support/agent-credential.ts |
Adds test-only Agent credential admission. |
apps/server/src/modules/task/task.service.test.ts |
Adds edit results to executor fixture. |
apps/server/src/modules/storage/storage.ts |
Exposes save operations through composed Spaces. |
apps/server/src/modules/storage/ports/contracts/blob-store.contract.ts |
Tests isolated copies and lease cleanup. |
apps/server/src/modules/storage/ports/blob.ts |
Documents disposable materialized paths. |
apps/server/src/modules/storage/backends/sqlite/structured-store.ts |
Connects SQLite reliable-save operations. |
apps/server/src/modules/storage/backends/sqlite/space-save.crash-fixture.ts |
Adds transaction crash-test subprocess. |
apps/server/src/modules/storage/backends/sqlite/schema.ts |
Adds save records and change-sequence migration. |
apps/server/src/modules/storage/backends/sqlite/contracts.test.ts |
Supports reopened node-storage contract checks. |
apps/server/src/modules/storage/backends/sql/node-rules.ts |
Adds change-position validation helpers. |
apps/server/src/modules/storage/backends/sql/log-rules.ts |
Shares Review-record merge and upsert logic. |
apps/server/src/modules/storage/backends/postgres/structured-store.ts |
Connects PostgreSQL reliable-save operations. |
apps/server/src/modules/storage/backends/postgres/schema.ts |
Adds save records and change-sequence migration. |
apps/server/src/modules/storage/backends/disk/structured-store.ts |
Connects Disk save and recovery operations. |
apps/server/src/modules/storage/backends/disk/space-save.crash-fixture.ts |
Adds staged-save crash-test subprocess. |
apps/server/src/modules/storage/backends/disk/space-import.ts |
Clears imported save identity and results. |
apps/server/src/modules/storage/backends/disk/blob-store.ts |
Uses safe paths and disposable materialization. |
apps/server/src/modules/storage/backends/blob/materialization.ts |
Shares temporary-copy lease implementation. |
apps/server/src/modules/storage/backends/azure/blob-store.ts |
Reuses shared blob materialization. |
apps/server/src/modules/remote_fs/space-capabilities.ts |
Advertises layout details and operation-ID support. |
apps/server/src/modules/remote_fs/node-meta.ts |
Includes read versions in download metadata. |
apps/server/src/modules/remote_fs/node-meta.test.ts |
Tests read-version response headers. |
apps/server/src/modules/preprocessing/video-cover.test.ts |
Mocks workspace leases for pipeline tests. |
apps/server/src/modules/preprocessing/stages/enrich.ts |
Includes Office nodes in text enrichment. |
apps/server/src/modules/preprocessing/label-policy.ts |
Reuses shared label-protection policy. |
apps/server/src/modules/preprocessing/dispatcher.ts |
Leases and scopes preprocessing by workspace. |
apps/server/src/modules/identity/request.ts |
Tracks machine-credential admission. |
apps/server/src/modules/identity/http.ts |
Marks authenticated machine requests. |
apps/server/src/modules/canvas/world-preview-policy.ts |
Guards target removal through unset patches. |
apps/server/src/modules/canvas/space-move-plan.ts |
Remaps Frame reading lists across Spaces. |
apps/server/src/modules/canvas/space-move-plan.test.ts |
Tests reading-order preservation across moves. |
apps/server/src/modules/canvas/space-card.route.ts |
Publishes renames as incremental updates. |
apps/server/src/modules/canvas/persistence-types.ts |
Describes compact and bounded delta records. |
apps/server/src/modules/canvas/node-prompt.test.ts |
Verifies body-only revision semantics. |
apps/server/src/modules/canvas/member-spaces.route.test.ts |
Tests credential-derived execution sources. |
apps/server/src/modules/canvas/import-space-identity.ts |
Remaps imported layout-order references. |
apps/server/src/modules/canvas/import-node-src.route.test.ts |
Uses credential admission and edit batches. |
apps/server/src/modules/canvas/canvas-sync.test.ts |
Tests transient invalidations and ID-only effects. |
apps/server/src/modules/canvas/canvas-spatial.ts |
Exposes structured Frame layout during inspection. |
apps/server/src/modules/canvas/caller-principal.ts |
Scopes page-origin echoes to authenticated principals. |
apps/server/src/modules/canvas/agent-node-association.ts |
Publishes compact effects and content revisions. |
apps/server/src/modules/canvas/agent-command-preparation.ts |
Restricts injected revision checks to body edits. |
apps/server/src/modules/agent/tools/handlers/fs-read.ts |
Removes metadata-specific read tracking. |
apps/server/src/modules/agent/tools/handlers/fs-read.test.ts |
Tests independent property writes and body revisions. |
apps/server/src/modules/agent/tools/handlers/canvas-write.ts |
Updates body-conflict recovery guidance. |
apps/server/src/modules/agent/tools/handlers/canvas-query.ts |
Stops inspection from recording write authorization. |
apps/server/src/modules/agent/tools/executor.ts |
Removes inspection read-set plumbing. |
apps/server/src/modules/agent/node-ref.ts |
Adds layout descriptions and body-only revisions. |
apps/server/src/modules/agent/ink-response.test.ts |
Updates ID-only pending-effect fixtures. |
apps/server/src/modules/agent/functional-text.test.ts |
Updates logging and permission cleanup expectations. |
apps/server/src/modules/agent/conversation-title.service.ts |
Reuses shared title-acceptance policy. |
apps/server/src/modules/agent/conversation-title.conversion.test.ts |
Checks published stored-content revisions. |
apps/server/src/modules/agent/conversation-title-node-store.ts |
Shares title projection and publishes revisions. |
apps/server/src/modules/agent/conversation-owner.route.ts |
Refreshes on renames and ID-only effects. |
apps/server/src/modules/agent/agent-thread.service.ts |
Checks Space ownership before thread attribution. |
apps/server/src/modules/agent/agent-node.service.test.ts |
Adds edit results to executor fixture. |
apps/server/src/modules/agent/agent-node-lifecycle.ts |
Leases workspace during lifecycle transitions. |
apps/server/src/modules/agent/agent-node-binding.test.ts |
Tests lease admission and release. |
apps/server/src/modules/agent/agenetes/ink-response-driver.test.ts |
Updates ID-only pending-effect fixtures. |
apps/server/src/modules/agent/acp/external-agent-realization.test.ts |
Adds workspace-lease dependency fixture. |
apps/server/src/app.ts |
Registers presence endpoints. |
apps/desktop/scripts/test-tabs.mjs |
Migrates smoke requests to edit batches. |
Review effort: Balanced
This branch has not been deployed
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.
Summary
Two pieces of work that build on each other: reliable
executefor agents, and multi-device sync for the browser on top of it. The same person can now have a Space open on several devices or windows and see every edit, with edits to different nodes — and to different properties of one node — all kept.1. Reliable
execute(agents and CLI)executelooks up a stored result for(principal, operationId)before doing any work. The same request returns the original response (replayed: true, nothing published or imported again); the same id with a different body is409 operation-id-reused. The result record is saved in the same write as the state. An unknown save outcome is503 operation-outcome-unknown.basis. When a caller passes it back, a command is refused if a node it targets was deleted (stale-target) or moved between containers (stale-parent) since then. Only the nodes a command names are checked.huabu-rfs executeattaches a request id, retries with the same id and bytes, accepts--operation-id/--basis, and gainsresult <operation-id>.2. One request shape: a list of edits
{ operationId?, runId?, originator?: { tabId? }, edits: [{ basis?, after?, commands }] }. An edit takes effect as a whole or not at all. The Agent route still accepts the earlier{ commands, basis?, operationId?, runId? }with unchanged behaviour (one edit per command), so no agent skill or prompt changes.pendingEffectsare ids only. Deltas carry only the fields that changed (REPLACE_NODEwith partialprev/next), the stored result record is compact, and the delta log is bounded (200 versions per Space, 64 KiB per row). A PDF move went from about 2.1 MB to about 500 bytes on the wire.originator.sourceandoriginator.threadIdare no longer accepted on the page route. The Agent route attributes Review records to a thread only when that thread belongs to the Space.3. Multi-device sync (browser)
execute. Move, resize, create, delete, style, edges, grouping, layer order, undo/redo and measured sizes are sent by a per-page send queue, with request ids. The browser no longer saves the whole Space;PUT /api/canvas/:idand its types are deleted.updateevents carry sibling paint order; a page applies incoming changes per property, so an unconfirmed local change is not overwritten and a remote change to another property of the same node is kept. One mechanism holds unsaved local fields against incoming changes, for bothupdateevents and fetched content.expectRev, and send only the fields that changed. Custom properties, a person's or an agent's title, colour, position and the like are unversioned: per item, last writer wins, and different items never conflict. Automatic titles, summary and keywords stay revision-checked because they are derived from one body. The server sends content revisions; the page no longer computes them for other writers' content.invalidateand a fetch; a persisted per-node change sequence lets a page catch up after a dropped stream or a load/subscribe gap.expectRevconflict remains the safety net). Only a control that can change the node's content counts as editing. A text node's typing now reaches the content queue as it is typed, like a note's, so it is held and saved the same way.beforeunloadprompt only for real unsent edits; a refused edit is reported once and the page converges to the server by reloading in place.mainup to0b4438c81.Behaviour changes to review
PUT /api/canvas/:idis gone. Writing to a Space that does not exist no longer creates it.RESTORE_NODES,APPLY_MEASURED_SIZE,MERGE_NODE_DATA.unset. Agents cannot send them.SET_NODE_GEOMETRYno longer depends on the node's parent;SET_FRAME_LAYOUTcells/placements are parent-checked (stale-parent).DISCONNECT_EDGESbeforeDELETE_NODES.basis.Storage
mainshipped server records as v3 while this branch was open):space_save_heads,space_save_results,spaces.node_change_seq, indexednodes.change_seq. Databases that only ranmainupgrade normally. A database that ran an earlier revision of this branch must be recreated. Disk is unaffected.Known limits
updatecarries the complete before/after order of each changed container. Planned follow-up: a per-node order key.canUndoflag can lag after an agent batch (Cmd+Z works). These read the same onmain.updateevents and only one setssource; the conversation-owner patch and agent-node association responses do not go through the send queue;applyDeltasOnServerpersists without the execute tail; content-field lists are hand-copied in three places.Testing
On the pushed head
9771b16ca, Node 24.14 (below the required 24.16), clean environment:pnpm typecheck,pnpm format,pnpm lint:fix: clean (0 errors).canvas/external-watcher.real.test.ts, which fails the same way onmainon this machine).file-comments.spec.ts:24andlayers-activation.spec.ts:1330(fail onmain); twocanvas-native-selectiontests (WebKit is not installed here);ink-user-message.spec.ts:7andnode-far-zoom.spec.ts:710(passed when rerun alone, 2/2 and 6/6); twoportal-retirementtests and onestorage-profilestest that need their own configs —playwright.portal-retirement.config.ts4/4,playwright.storage-profiles.config.tspassed on disk/disk and sqlite/disk.Not verified: PostgreSQL suites on this head (CI runs them), two physical devices, Safari/Firefox, the desktop app, IME input in a text node.
Notes for review
92c6c946(persist sibling paint order and explicit layout reading order), which is not onmain, so that commit is part of this diff.docs/architecture/canvas-realtime-sync.md,api-design.md,canvas-storage.md,canvas-command-architecture.md.🤖 Generated with Claude Code