Skip to content

factory: organization canvases on the server, through canvas-core (E4) - #2638

Merged
santoshkumarradha merged 8 commits into
work/teamsfrom
w2/e4-canvas
Nov 13, 2026
Merged

santoshkumarradha merged 8 commits into
work/teamsfrom
w2/e4-canvas

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

What

Lane E4 (WAVE2 §3 E4, as amended by §4). With this, an organization's canvases live on its codeaf factory serve server. This is the demo's critical path.

  • Server, /v1/canvases*. List, make, rename, trash, delete, share (owner, shares, private), snapshot, ops since a seq, write ops, versions and restore, marks, assets (PUT/GET by sha), and moving a laptop canvas in once (/import, idempotent per person and local id).
  • Nothing about a canvas is re-implemented in Go. Every read and write execs canvas-core's canvas rpc (new internal/factory/canvasrpc; desk PR Agent-Field/codeaf-desk#433, CONTRACT §10), one request at a time per canvas. The index of owner, shares and private is factory-canvases.json beside the workstreams. Each canvas is a canvas-core directory under <store>/canvases/.
  • Access core (E1). view reads; comment adds marks and takes a hand; edit writes ops, versions, restores and assets; full shares, trashes and deletes. A canvas you cannot see answers 404, and the operator sees a private canvas as a name_only row.
  • Actor stamped by the server. Every op is written as person:<handle> of the signed-in caller. A hand is {t:"lease",frame,actor:"",until:"hand"}; the server fills in the caller and wall clock + HAND_SECS. A hand for someone else, member/wait/proposal/suggest ops, and reserved meta keys are refused with 400.
  • Two people never write one frame at once. A batch that writes into, or takes a hand on, a frame another person's hand is on gets 409 {error:"<handle> is working in this frame", reason:"conflict", frame, holder, seq, ops}, where ops are the records after base_seq.
  • Events. canvas.changed {id,seq,by} and canvas.removed, filtered by view through itemAudience.
  • Engine. 17 methods: factory.org_canvases, _get, _create, _update, _delete, _snapshot, _ops, _apply, _versions, _version_create, _restore, _marks, _mark_create, _shares, _import, _asset_get, _asset_put, using the names the desk (W3) codes to. The hello word is org_canvases. On a 409, error.detail carries frame, holder, seq and ops. factory.org_changed relays the canvas kinds with seq and by. OrgRequest gains a raw body and a larger answer bound (64 MB) for canvas answers.
  • Absent, not broken. A server with no canvas program (beside codeaf, on PATH, or $CODEAF_CANVAS_BIN) logs it once and leaves the routes off. PATCH marks is absent because canvas-core has no mark update.
  • Deploy (E0's VM). scripts/demo-org-server-deploy.sh builds a static linux/amd64 canvas from the desk repo (cargo-zigbuild off amd64) or takes CANVAS_BIN. install.sh puts it at /usr/local/bin/canvas.

Contract

docs/design/app-v3/PROTOCOL.md has the method rows, a paragraph for them and the event kinds. ~/work/teams-wave/WAVE2.md §4 has a new "E4 as built" section; that file is outside the repo and was edited in place.

Proof

  • Sidecar de-risk. The static musl amd64 canvas (3.8 MB, about 45 s to build) runs headless, and a Go program execs it JSON-in/JSON-out, error shape included.
  • Two people, one real server handler, the real canvas binary (CODEAF_CANVAS_BIN=…), with santosh and abir signed in through the org fixture (newWSOrg):
    • TestTwoPeopleWriteOneCanvasInDifferentFrames: each holds a hand on their own frame and both write. Each sees the other's ops, stamped with the writer. abir writing into santosh's frame gets 409 naming santosh, with the unseen ops. abir cannot take santosh's hand, and the refused write never lands.
    • TestCanvasRolesAndPrivacy, TestCanvasEventsReachOnlyItsPeople, TestCanvasImportMovesALaptopCanvasInOnce, and TestCanvasOpsAreThePersonsOwn (no binary needed).
    • Without the binary these tests skip and say how to build one. That is deliberate: canvas behaviour belongs to canvas-core, and a fake would only test the fake.
  • Engine. TestOrgCanvasesForwardToTheServer covers routes, raw asset bytes in both directions, and the 409 detail. TestOrgCanvasMethodsRefuseBadParamsBeforeSending covers bad params. internal/appwire passes, including the protocol-document gate.
  • make pr-ready BASE=origin/work/teams: see the comment below.

Not in this PR

  • Canvas presence (E3a's presenceKinds["canvas"]): added when E3a lands.
  • Text inside a frame is E7's Yjs doc canvas/<id>/frame/<fid>.
  • No two-person e2e harness (internal/e2e/org_two_people_test.go) exists on work/teams yet.

@santoshkumarradha
santoshkumarradha force-pushed the w2/e4-canvas branch 2 times, most recently from 61c1ddb to 36ec7db Compare November 13, 2026 22:06
santoshkumarradha and others added 8 commits November 13, 2026 17:06
…s-core

/v1/canvases*: list, make, rename, trash, delete, share, snapshot, ops
since a seq, write ops, versions and restore, marks, assets, and moving a
laptop canvas in once. Every read and write goes through canvas-core's
`canvas rpc` (factory/canvasrpc), so nothing about a canvas is
re-implemented in Go; the server decides who may (the access core: view,
comment, edit, full) and stamps every op as person:<handle>. Two people
never write one frame at once: a write into, or a hand on, a frame another
person's hand is on answers 409 with who and the ops not yet seen.
canvas.changed {id,seq,by} and canvas.removed reach only those who may
view. A server with no `canvas` program keeps no canvases and leaves the
routes off.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
… in hello

Seventeen methods, one request each, built from checked ids; canvas-core
shapes pass through unchanged. An asset's bytes travel raw to the server
and base64 to the desk; a canvas answer may be up to 64 MB. A write into
another person's frame is conflict whose detail carries frame, holder,
seq and the ops not yet seen. canvas.changed {id,seq,by} and
canvas.removed are relayed as factory.org_changed.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
The deploy builds a static linux/amd64 `canvas` from the desk repository
(cargo-zigbuild off linux/amd64) or takes CANVAS_BIN, and install.sh puts
it at /usr/local/bin/canvas, where the server looks for it.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
… tests' itoa

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
…ho may view it

The canvas registers its presence kind with E3a's presence (part = frame
id) once presence routes exist; canvas-core's program path is read
through internal/env.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
A frame's document (canvas/<id>/frame/<fid>, E7) is found when the caller
may view the canvas and the frame is on it, read with view, written with
edit, and dropped when a batch, a restore or a canvas delete removes it.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
E1's #2637 brought OrgShare and orgShareList into appwire; the canvas
methods now use them instead of a second copy.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
@santoshkumarradha

Copy link
Copy Markdown
Member Author

Gate on 381550c against work/teams c3f8fb1 (checked with ls-remote): make test-touched-preflight, test-quick and test-touched green, every selected test passed on its first run (cmd/codeaf 8 shards 316s; appwire, factory, factory/api, factory/serve, factory/store). Canvas tests ran against the real canvas-core binary (CODEAF_CANVAS_BIN). Tooling: all scripts green on the previous base except scripts/one-suite_test.sh, which cannot run on this box (bwrap: setting up uid map: Permission denied) and is untouched by this change. Desk side merged: codeaf-desk#433 (b495afaa1). E7 frame documents wired (TestAFramesWordsFollowItsCanvas).

@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 13, 2026 22:16
@santoshkumarradha
santoshkumarradha merged commit 7a045d1 into work/teams Nov 13, 2026
1 check passed
@santoshkumarradha
santoshkumarradha deleted the w2/e4-canvas branch November 13, 2026 22:18
santoshkumarradha added a commit that referenced this pull request Nov 16, 2026
…operator plumbing

Both pins reached the tree without a registry line (#2638, #2609), which
left TestRegistryCoversEveryUserFacingEnvironmentPin red on santosh/work.
Each is a path an operator sets for one server or one launch, never a row a
project file could write.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
santoshkumarradha added a commit that referenced this pull request Nov 17, 2026
…operator plumbing

Both pins reached the tree without a registry line (#2638, #2609), which
left TestRegistryCoversEveryUserFacingEnvironmentPin red on santosh/work.
Each is a path an operator sets for one server or one launch, never a row a
project file could write.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
santoshkumarradha added a commit that referenced this pull request Nov 17, 2026
…operator plumbing

Both pins reached the tree without a registry line (#2638, #2609), which
left TestRegistryCoversEveryUserFacingEnvironmentPin red on santosh/work.
Each is a path an operator sets for one server or one launch, never a row a
project file could write.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
ZeroPoint95 pushed a commit that referenced this pull request Nov 24, 2026
…s-core (E4) (#2638)

The server execs canvas-core's `canvas rpc` for every canvas read and write; routes /v1/canvases*, access through the E1 core, per-person frame hands with a 409 conflict, canvas.changed/removed events, Personal-canvas import, canvas presence, frame text as E7 documents, engine factory.org_canvas* and the org_canvases hello word; the demo server ships `canvas`.

Assisted-by: CodeAF
Co-Authored-By: CodeAF <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant