Job 006: collaboration
Status: DONE Owner: @work, the routine
Phase: CLOSED — every charter phase met, close-out written, 009 chartered ·
Status: DONE · Updated: 2026-08-30
Scoreboard: npm run check:realtime — 5 of 5 wired (1
deferred-by-measurement). The committed number, not a census: rule T6 fails the
build when it drifts from the tree.
Dependencies: none open. 008 is DONE; the transport this track consumes
shipped in 003 and was channelled user:{id} / workspace:{id} from day one
for exactly this purpose.
Charter: ./README.md. Routine: ./ROUTINE.md
(batch loop, claim refs claim/006-*, budgets — inherited from 008 unchanged,
plus two browser contexts, always).
Source: product gap assessment .archives/removal-safe/docs/assessments/PRODUCT-GAP-ASSESSMENT-082926.md
§Collaborate, re-scoped against the overview's Collaborate pillar as ROADMAP
directs; prior plan at
.station/jobs/001-renaissance/plans/05-collaboration.md,
two of whose claims this charter corrects.
Objective
A workspace's members can see each other, see what changed, and say something about it — in the product, without reloading — with every event keyed through one helper and never delivered to another tenant. The charter's phase table carries the bars; they are not restated here.
Completed
- Phase 05 — the member activity feed (#430,
ADR-0112).
Read-only and derived: no table, no publisher, no logging system. The
charter named
users_logsanduser_history_events; building it found that neither carries a workspace — one is per-user with an IP and a city besides, the other per-tab by construction — so the feed reads the rows that do: comments, blocks created and last-edited (000035's attribution), resources, the roster. It goes live off the events its sources already publish, which the ledger now says out loud as a third carrier,derived, naming sources that must themselves be wired instead of a publisher. The nouns come from the link-type registry and the served block-type catalogue, so the feed is not a second vocabulary. Proved on a running stack with two browser contexts, watched failing twice on the surface — the tenant dropped from one arm of the union, and the consumer listening for nothing, the exact inversion — and five times on the widened gate (evidence.station/jobs/006-collaboration/evidence/phase-05-activity-feed-running-stack-2026-08-30.md), with no Redis throughout. - Phase 04, second slice — a comment on a block within the resource
(#429,
ADR-0111).
Migration
000037adds a nullable column, not a second table: the block thread is the same document filtered, and nothing about the tenant column, the depth trigger or the delete rule is worth duplicating. A block id is a number the caller sent, so it is proved by the block's own row — itslink_idandworkspace_idmust both agree with the link already proved — and every failure is 404, including a block on another page of the caller's own workspace and a missing block store. A reply inherits its root's scope, returned with the answer to "is this a root here" so no second read can disagree, with a trigger making the disagreement unreachable. No new event:comment.changednames the document. The canvas gained one affordance — a block's toolbar opens its thread. Proved on a running stack with two browser contexts, watched failing three ways (evidence.station/jobs/006-collaboration/evidence/phase-04-block-comments-running-stack-2026-08-30.md), with no Redis throughout. - Phase 04, first slice — threaded comments on a resource (#428,
ADR-0110).
The first thing this track stores. Migration
000036targets alinksrow, not a(type, id)pair:linksalready holds every public resource and already carriesworkspace_id, so the target and the tenant are one fetch — and both are taken from the link the handler proved, never from the body. Threading is one level, enforced by a trigger; the handler's own check exists to answer 4xx rather than let an exception surface as a 500, and to refuse a parent on another workspace's resource, which the trigger cannot see. Every route answers 404, never 403, for an outsider: 403 says the thing exists, which makes any numeric id a membership oracle. DELETE is gated in the handler — not by the matrix's blanket prefix rule, which would stop a member deleting their own comment. Notifications go out on the existingCreateBatchpath to every member but the author.commentsis closed to API tokens, recorded in the scope table. Proved on a running stack with two browser contexts, watched failing three ways (evidence.station/jobs/006-collaboration/evidence/phase-04-comments-running-stack-2026-08-30.md), with no Redis throughout. - Phase 03, second slice — the attributed 409 (#427,
ADR-0109).
Migration
000035addslast_editor_user_id, written by every path that bumps the version and by nothing else —user_idis the owner-of-record and answers who created the block, the same person exactly until a second member edits. The name is resolved through the roster of the block's own workspace, never a user lookup: ADR-0107's intersection rule one surface over, and the sharper case, becauseSELECT name FROM userscompiles, reads correctly, and names another tenant's member. Nobody named is a complete answer (former member, deleted account, pre-000035row, unwired roster) and the refusal is otherwise unchanged. The 409 carries the fact, the client says the sentence. The row's carrier is the response, not the bus — nothing is published, because the write that won already publishedblock.changed— socheck:realtimegained acarrierfield rather than the row claiming an event it does not have. Proved on a running stack with two browser contexts, watched failing three ways (evidence.station/jobs/006-collaboration/evidence/phase-03-attributed-409-running-stack-2026-08-30.md), with no Redis throughout. - Phase 03, first slice — the canvas is live (#426,
ADR-0108).
Every block write — create, update, delete, reorder — publishes one
block.changedon the workspace channel naming the document, never one per affected row (phase 01 measured a 200-event burst delivering 17). The event carries no block: the consumer refetches the workspace-scoped endpoint that already decides what a member may read. It carries anorigin— the writing tab'sX-Session-ID— so that tab ignores its own echo rather than refetching over its optimistic state, while a second tab of the same member still updates: the unit is the tab, not the account. Reorder now sends the header too, for the origin and not for history. Proved on a running stack with two browser contexts editing one document in both directions, watched failing three ways — publisher removed and the API rebuilt, consumer neutered with the server still publishing, and the gate on two broken inputs (evidence.station/jobs/006-collaboration/evidence/phase-03-live-canvas-running-stack-2026-08-30.md) — and run with no Redis throughout, so degraded mode is the run rather than a claim. - Phase 02 — presence, derived from the connection (#425,
ADR-0107).
The first real workspace-channel publisher: every session already
subscribed to a channel nothing wrote to.
PresenceServiceis ephemeral — Redis when configured, in-process otherwise, never the database — keyed offChannelWorkspacerather than a second composed key, and its unit is a connection, so the first of two tabs to close does not report its owner as gone. The SSE stream is the only writer: touch on connect, refresh on the heartbeat that already proves the stream, drop on disconnect, expire when a process dies first.presence.changedcarries no member list; the consumer refetchesGET /api/v1/realtime/presence, which answers from the intersection of store and roster. The client fan-out landed with it (open item closed) and is load-bearing, not frugality: a second stream per tab would be one member counted twice. Proved on a running stack with two browser contexts, watched failing two ways (evidence.station/jobs/006-collaboration/evidence/phase-02-running-stack-2026-08-30.md), and proved degraded with no Redis. - Phase 01 — transport measurement: live cursors deferred (#424,
report
.station/jobs/006-collaboration/reports/TRANSPORT-MEASUREMENT.md). Decision 006 answered by instrumentation, with a re-runnable harness in the tree (REALTIME_MEASUREMENT=1 go test ... -run Measurement, skipped otherwise — a wall-clock assertion is a flake). Fan-out is microseconds at every workspace size; the product's own event rate drops nothing at 25 members. Cursors: 0% dropped at 5 members, 34.7% at 25, and 55 B a frame / ~13 KB/s a stream. The deciding finding is structural, not a ceiling — there is no inbound realtime path at all, so cursors alone would buy a second authenticated transport with the tenant boundary drawn across it again. Deferred; the ledger row carries the reason and cites the report, which rule T3 was tightened to require as a resolving path after it passed on prose that merely named the file. - Phase 00 — the channel helper and the realtime ledger (#423,
ADR-0106).
services/channels.goexportsChannelUser/ChannelWorkspaceover unexported prefixes; both hand-built call sites moved onto it, producing byte-identical keys.scripts/realtime-ledger.jsonmints six rows — fiveunwired, live cursorsdeferred-by-measurement— andcheck:realtime(T1–T6) runs innpm run verifyat 0 of 5. T4 is the tenant-boundary rule: it reads the call sites rather than grepping, so the cache's ownuser:%dkeys stay out of it. Watched failing three ways (evidence.station/jobs/006-collaboration/evidence/phase-00-gate-watched-failing.md); Go-level isolation proved and watched failing against a shared workspace key (evidence.station/jobs/006-collaboration/evidence/isolation-test.md). - Chartered — README, ROUTINE (008's protocol, claim namespace
claim/006-*, plus the two-context rule), this file; ROADMAP's 006 row flippedACTIVEand 008 closedDONEin the same PR. Findings re-verified on21a29b5rather than inherited, and two correct the 001 plan: there is no canonical channel helper (both call sites hand-build keys withfmt.Sprintf, so the plan's gate rule 1 had nothing to derive from), and no publisher writes to any workspace channel although every session subscribes to one — the workspace half of the gateway is wired to nothing. Also verified: the 409 names nobody and no column records who last wrote a block; presence, comments, agent members and backups are absent entirely;packages/capabilitiesholds no collaboration key.
Active
Nothing claimed.
Open items
None in flight. Residue handed back to the owner is listed here, once:
- Coalesce; never publish per row. Phase 01 measured a burst of 200 events on one connection delivering 17 — the bus drops over a 16-slot buffer rather than blocking, silently. A bulk operation publishing one event per affected block loses most of them. One event describing what changed is inside every number in the report; phases 02–05 inherit this.
Closed by phase 02:connectRealtimeis one callback for the whole stream.subscribeRealtime(type, handler)multiplexes one connection andTopbar.tsxmoved onto it.- Playwright's browser build does not match the pre-installed Chromium.
The live suite needs
executablePathpinned to run here at all. Not this track's to fix — recorded so the next run does not rediscover it. - An inserted paragraph renders nothing.
lib/blockDefaults.tsseedssettings.paragraph, while the registry collects and the renderer readstext— ADR-0064's finding one block over. Found while writing the live spec, which asserts the canvas's blocks rather than their text because of it. One PR, not this slice's; the wholeblockDefaultsmap wants the same census. @csxbase/studio-reactexportsText,KickerandProsethatindex.d.tsdoes not declare. #274's finding, three components over: the runtime has them, TypeScript refuses them, so a consumer reaches for app markup instead. Found writingCommentsPanel, which now usesField+ plain spans. One PR, not this slice's — it belongs with 003's residue row on ROADMAP.- A
membercannot delete a block (403) but can create one. Correct or not, it is a role-matrix question rather than a defect this track owns — recorded because it shaped the live spec's second direction.
Blockers
All four are owner decisions with options and a recommendation in the charter; none blocks the buildable remainder, and each is re-presented at this track's close.
- Do workspaces have AI-agent members? Recommendation: an agent is an existing member's API token (attribution on an identity that exists), not a new member kind — the kind is a track's worth of auth work.
- Does a document have version history? Recommendation: snapshot-on-save
with restore, one resource type first, if versions are sold. Deriving them
from
user_history_eventsis the tempting wrong answer — that stream is per-tab and session-scoped by construction, so it would produce a history missing whatever the other member did. - What does "backups" mean here? Recommendation: document the operational posture, and ship a per-workspace export. Restore is where the cost and the risk are and should not be bought by accident.
- Are presence and comments plan-gated? Recommendation: one
comments_is_enabledkey minted at phase 04, default deny, granted to existing plans on migration000031's precedent; presence ungated, because it has no separable write path and billing a workspace for knowing who is in it is not a capability. 011 meets the seat axis from pricing's side.
Decisions
- The helper before the publishers — the canonical channel key is the tenant
boundary, so it is minted while there are only two call sites to move, not
after a feature has copied a
fmt.Sprintfa third time (charter phase 00). - A deferral is a deliverable — phase 01 measures; if it says the transport
does not carry live cursors, that recommendation is the output and the ledger
carries a
deferred-by-measurementrow saying so. - Isolation is a security test — an event published to workspace A is never delivered to a subscriber of workspace B, asserted at Go and UI level, never skipped, evidence kept in its own file.
Files changed
.station/jobs/006-collaboration/— charter, routine, this file,evidence/apps/api/internal/services/channels.go(+_test.go) — the canonical keysapps/api/internal/handlers/—realtime.go,internal_notifications.goscripts/realtime-ledger.json,scripts/check-realtime-parity.mjs,package.jsondocs/decisions/0106-…— the channel key is the tenant boundaryapps/api/internal/services/presence.go,internal/handlers/presence.go(+tests)apps/web/src/{services/realtime.ts,hooks/queries/usePresence.ts,pages/workspaces/WorkspacePage.tsx}apps/web/tests/e2e-live/presence.spec.ts— the two-context specdocs/decisions/0107-…— presence is a property of the connection.station/jobs/006-collaboration/reports/TRANSPORT-MEASUREMENT.mdapps/api/internal/{services,handlers}/realtime_measurement_test.go— the harnessapps/api/internal/handlers/biolink_blocks.go(+_realtime_test.go) — theblock.changedpublisherapps/web/src/hooks/useBlockChanges.ts(+test),pages/biolinks/BiolinkEditorPage.tsx,services/biolinks.tsapps/web/tests/e2e-live/block-changed-live.spec.ts— the two-context canvas specdocs/decisions/0108-…— a change event names the document and the tab that made itapps/api/migrations/000035_attribute_the_last_writer_of_a_block.{up,down}.sqlapps/api/internal/repository/biolink_blocks.go—VersionConflictError, the attributed probeapps/api/internal/handlers/biolink_blocks.go(+_conflict_test.go) — the refusal and its rosterapps/web/tests/e2e-live/attributed-conflict.spec.ts— the two-context refusal specdocs/decisions/0109-…— a refusal names a member only through the roster that may name themapps/api/migrations/000036_add_resource_comments.{up,down}.sqlapps/api/internal/{models/comment.go,repository/comments.go,handlers/comments.go}(+_test.go)apps/api/internal/middleware/scopes.go—commentsclosed to tokens, with the record of whyapps/web/src/{services/comments.ts,hooks/useCommentChanges.ts,components/editor/CommentsPanel.tsx}apps/web/tests/e2e-live/comments.spec.ts— the two-context thread specdocs/decisions/0110-…— a comment targets a link row, and an outsider is answered with absenceapps/api/migrations/000037_target_a_comment_at_a_block.{up,down}.sqlapps/api/internal/{handlers/comments.go,repository/comments.go,models/comment.go}— the proved block target and the inherited scopeapps/web/src/components/{editor/CommentsPanel.tsx,editor/CanvasFrame.tsx,blocks/SortableBlock.tsx}— the scope control and the canvas affordanceapps/web/tests/e2e-live/block-comments.spec.ts— the two-context block-thread specdocs/decisions/0111-…— a reply inherits its scope, and a block target is proved by its own rowapps/api/internal/{models/activity.go,repository/activity.go,handlers/activity.go}(+_test.go) — the derived feedapps/web/src/{hooks/queries/useWorkspaceActivity.ts,components/workspaces/ActivityFeed.tsx,services/workspaces.ts}scripts/{realtime-ledger.json,check-realtime-parity.mjs}— thederivedcarrier and its sources ruleapps/web/tests/e2e-live/activity-feed.spec.ts— the two-context feed specdocs/decisions/0112-…— an activity feed is derived, and derived from the rows that carry the tenant
Verification
Phase 05: npm run verify exit 0, go vet/go test green, and the charter's
own bar met — the feed shows another member's action with no new write path
added for it, and its vocabulary comes from the product registries rather
than a second one. Two browser contexts: the guest's open feed gains the
owner's comment with no reload, asserted after a database read of the comment,
and the feed is already populated before anyone acts, which is the "assembled
from what is already recorded" half. The isolation test reads the query rather
than the panel — one of each kind of fact written in a second workspace, none
of it in this one's feed, and a workspace_id query parameter unable to change
the answer. Watched failing twice on the surface and five times on the widened
gate. No Redis was configured for the run.
Phase 04 (second slice): npm run verify exit 0, go vet/go test green, and
the charter's own bar met for the block half of the comments row — two
browser contexts on one document, one member opening a block's thread from the
canvas and writing in it, the other's block thread gaining it with no reload
while both page threads stay unchanged, all asserted against database reads.
000037 was applied, exercised and rolled back against the live database
before any handler ran, its scope trigger refusing a reply that wandered out of
its root's thread. Watched failing three ways: the declared scope dropped (both
specs fail — an unstored scope is also an unchecked target), the block target
trusted without proof (the exact inversion: the feature spec passes, the
isolation spec fails, at Go level and in a browser), and a reply keeping the
scope it declared, where the database refuses the write the handler no
longer shapes. The first slice's spec re-run green on the final tree. No Redis
was configured for the run.
Phase 04 (first slice): npm run verify exit 0, go vet/go test green, and
the charter's own bar met for the comments row — a thread survives a reload,
another workspace gets 404 on every route (asserted from a second real account,
with a database read proving the comment survived), and the notification arrives
by the path that already exists, asserted as a row in internal_notifications.
Two browser contexts, both writing. 000036 was applied, exercised and rolled
back against the live database before any handler ran. Watched failing three
ways: the publisher removed (both specs fail — the isolation spec carries a
positive control, so it cannot pass by nothing being published), 403 instead of
404 (the exact inversion: the feature spec passes and the isolation spec fails,
at Go level and in a browser), and the ledger gate on two broken anchors. No
Redis was configured for the run.
Phase 03 (second slice): npm run verify exit 0, go vet/go test green, and
the charter's own bar met for the attributed-conflict row — two browser
contexts on one document, the attribution asserted as a database read before
the refusal is read on screen, watched failing with the naming removed and the
API rebuilt from that tree (the feature test fails, the isolation test passes),
again with the roster boundary replaced by a global name lookup (the exact
inversion: the feature test passes and the isolation test fails, at Go level and
in a browser), and the widened gate watched failing on five broken inputs. No
Redis was configured for the run.
Phase 03 (first slice): npm run verify exit 0, go vet/go test green, and
the charter's own bar met for the live-canvas row — two browser contexts on
one document, asserted against a database read, watched failing with the
publisher removed and the API rebuilt from that tree, again with only the
browser consumer neutered (which fails the canvas assertion while the wire-level
isolation spec stays green), and the gate watched failing on a renamed event
type and on a drifted scoreboard. No Redis was configured for the run, so the
degraded path is what was proved.
Phase 02: npm run verify exit 0, go vet/go test green, and the charter's
own bar met — a two-context live spec asserting a database read for the
membership and the running API for presence, watched failing with the reader
neutered and again with the announcement neutered (which fails the browser
assertion alone, so the push is proved to be what it buys). Degraded mode run,
not assumed.
Phase 01: npm run verify exit 0, go vet/go test green; the measurement
harness re-runnable and its numbers transcribed in the report rather than
summarised. T3 watched failing before the ledger row cited the report.
Phase 00: npm run verify exit 0, go vet ./... && go test ./... green in
apps/api. check:realtime watched failing on three deliberately broken
inputs and the isolation test on a fourth — the four runs are transcribed in
evidence/, not summarised. No surface claims a row, so no two-context spec is
owed yet; the first is phase 02's, and it appends to evidence/isolation-test.md
rather than to a feature report.
Next actions
Nothing. The track is closed — reports/CLOSE.md — and
009, URL lifecycle, carries the front from here
(charter). The four owner decisions above
are re-presented in the close-out and stay open; none of them is work this
track left undone.
The handoff item (close-and-charter-009) wrote the close-out, chartered 009
per docs/guides/workstream.md — README, ROUTINE inheriting this track's
protocol, and its own SESSION, with the archive domain, subdomain rollout and
retention windows named as Blockers with options and a recommendation rather
than answered — and flipped both rows on ROADMAP.
Source: .station/jobs/006-collaboration/SESSION.md