Skip to content
Toolkit

006-collaboration — a workspace behaves like more than one person is in it

Status: ACTIVE · Phase: DEFINE · Chartered: 2026-08-30 · Starts: now — nothing gates it. The transport shipped in 003 and was channelled for exactly this; 008 is DONE, so the front is free

Problem

Workspaces, membership and roles are real — workspaces + workspace_members with owner/admin/member roles, personal-workspace backfill, workspace_id on ~14 tables (migrations/000026), member CRUD and UI — and the product behaves as though one person is using it. The overview sells this pillar as "workspaces with people and agents, versions, backups"; the assessment §Collaborate .archives/removal-safe/docs/assessments/PRODUCT-GAP-ASSESSMENT-082926.md rates it Partial and is not restated here. Each finding below was re-verified on this tree (21a29b5) rather than inherited from .station/jobs/001-renaissance/plans/05-collaboration.md, and two of them correct that plan:

  1. Every session already subscribes to a channel nothing writes to. handlers/realtime.go:47-50 subscribes each SSE connection to user:{id} and workspace:{id}. The tree's only publisher is handlers/internal_notifications.go:193, on user:{id}. There is no publisher on any workspace channel anywhere — the workspace half of the gateway is a subscription wired to nothing, which is the shape docs/guides/workstream.md forbids shipping and which this track exists to consume.
  2. There is no canonical channel helper, so the 001 plan's gate rule 1 — "a publisher writes to a channel key not derived from the canonical helper" — has nothing to derive from. services/realtime.go exposes Publish and Subscribe over raw strings; the convention is a comment (realtime.go:13) and both existing call sites hand-build their key with fmt.Sprintf. The channel key is the only thing separating tenants on a shared bus. The helper is phase 00's, not a later refinement.
  3. The client has one consumer and one callback. apps/web/src/services/realtime.ts exports connectRealtime(onEvent) — a single callback for the whole stream — consumed only by components/layout/Topbar.tsx. A second event type needs a fan-out point before it needs a feature.
  4. The hard half of conflict handling is built and invisible. Migration 000027 added biolinks_blocks.version; repository/biolink_blocks.go compare-and-swaps on (block, workspace, version) and returns ErrVersionConflict; handlers/biolink_blocks.go:316 answers 409 with "Block was modified elsewhere — reload it and reapply your change". It names nobody — and no column on the row records who last wrote it (version, datetime, last_datetime, no author), so attribution is a storage or an event question, not a wording one.
  5. Presence, comments, agent members and backups are absent — no schema, no handler, no page, no type, in apps/api/internal, apps/web/src or packages. What handlers/history.go provides is per-tab, session-scoped undo/redo, which is not document version history.
  6. No collaboration capability exists. packages/capabilities carries six keys, all enforced (004); none of them bills presence, comments or seats.

Objective

A workspace's members can see each other, see what changed, and say something about it — in the product, without reloading. Presence on the workspace and on the resource; the editor canvas refreshing from a published block.changed rather than a reload; the existing 409 becoming "Alex changed this block" rather than a dead end; threaded comments on a resource and on a block within it; and a workspace activity feed assembled from what is already recorded. Every one of them is a workspace-channel publisher with a consumer, keyed through one helper, and an event published to workspace A is never delivered to a subscriber of workspace B — asserted as a security test, never skipped.

Redis is optional throughout (AGENTS.md §4). Every phase must work, degraded, without it.

Phases

PhaseWhatDone when
00 — The channel helper and the realtime ledgerOne canonical Channel* helper both call sites are moved onto, plus scripts/realtime-ledger.json and check-realtime-parity.mjs (npm run check:realtime): one row per collaboration surface this track adds, naming its channel, its publisher, its consumer and its isolation test. Default state unwiredThe gate is watched failing on deliberately broken inputs — a hand-built channel key, a row claiming wired with no publisher, an event type with a publisher and no consumer (and the reverse) — and check:realtime prints N of M wired, committed. It starts at 0 of 5
01 — Measure before choosing a transportDecision 006, answered by instrumentation rather than taste: the existing gateway under synthetic multi-user load — latency, message rates, connection ceiling, degraded (no Redis) — and an explicit finding on whether SSE plus batched POSTs carries cursorsreports/TRANSPORT-MEASUREMENT.md exists with numbers and a recommendation. A recommendation to defer cursors is a passing outcome, recorded as the ledger's deferred-by-measurement row
02 — PresenceWho is in this workspace, and who is on this resource. The first real workspace-channel publisher and consumer. Ephemeral — Redis when configured, in-process otherwise, never the databaseA two-context live spec: each member sees the other arrive and drop, including an ungraceful disconnect; presence reconciles after a reconnect rather than duplicating a member; and the cross-workspace isolation test passes at both Go and UI level
03 — Live document state and an attributed 409Publish block.changed from the block handlers; the canvas refreshes live. Then make the existing 409 human: who changed it, and the newer version offeredTwo contexts, one block: A's edit reaches B's canvas with no reload (asserted against a database read), and B's stale write is refused with A named. How "who" is carried — a column or the event — is settled in an ADR before it merges
04 — CommentsThreaded comments on a resource, and on a block within it. New schema at the next free migration number with its .down.sql, workspace-scoped, role-gated, notifications routed through the existing internal-notifications pathA thread survives a reload, a member of another workspace gets 404, not 403 (no existence leak) on every route, and the notification arrives by the path that already exists. Live spec, two contexts
05 — Member activityA workspace activity feed assembled from what is already recorded — users_logs, user_history_events — plus this track's comment and presence events. Read-only, and explicitly not a new logging systemThe feed shows another member's action without a new write path being added for it; vocabulary comes from the product registry (003), not a second one

Phase 00 comes before the rest for the reason 004, 007 and 008 each earned: a scoreboard minted after the work measures nothing — and here the helper is load bearing, because the channel key is the tenant boundary. 01 gates only cursors; 02–05 are independent of it and of each other once 00 lands, and may be claimed in any order. Live cursors are built only if 01 says the transport carries them, and a recorded deferral is the deliverable in the other case.

Out of scope

Operational transforms / CRDTs — block-level optimistic concurrency is the model; character-level co-editing is a different product. Cross-workspace collaboration (ADR-0006). Replacing the notification poll — it stays as the correctness fallback. Guest or anonymous collaboration. Comment resolution workflows, mentions-as-permissions, approval chains — phase 04 ships threads, not a review system. Subdomains and the URL lifecycle — 009. Artifact hosting — 010. Pricing and the seat axis — 011, which is where "how many members" becomes a quota. AI-agent membership, document version history and backups — the three the overview names and this charter does not answer; they are blockers 1–3 below, not silent omissions.

Blockers — owner decisions

Named with options and a recommendation, never invented. Each is re-scoped from the overview's Collaborate pillar as ROADMAP directs, and none blocks the buildable remainder above.

  1. Do workspaces have AI-agent members? The overview sells "people and agents"; the tree has no agent or bot member kind. Options: (a) out of scope — an agent is an identity and credential question, not a collaboration one, and belongs with its own track; (b) a new member kind on workspace_members with its own credential, presence and attribution flowing through this track's channels; (c) an agent is an existing member's API token — 004's api_is_enabled already mints per-account tokens, so "an agent acted here" becomes attribution on an identity that exists. Recommendation: (c) now, (b) only if agents must be members rather than actors — (c) is nearly free once phase 03 carries an author on a change, and (b) is a track's worth of auth work whose cost belongs where it is decided.
  2. Does a document have version history? What exists is per-tab, session-scoped undo/redo (handlers/history.go), which is not what the overview means. Options: (a) leave it and say so — undo/redo is the model; (b) snapshot a resource on save into a versions table with restore, biolinks first; (c) derive versions from the existing user_history_events stream. Recommendation: (b) if versions are sold, scoped to one resource type first. (c) is the tempting one and it is wrong: that stream is per-tab and session-scoped by construction (003 stream D), so it cannot reconstruct a workspace-level document state — it would produce a history that is missing whatever the other member did.
  3. What does "backups" mean here? Zero references in the tree. Options: (a) operational, not product — document the deployment's database backup posture and ship nothing in-product; (b) a per-workspace export: the workspace's resources downloadable as data; (c) in-product backup and restore. Recommendation: (a) plus (b). An export is buildable, honest and useful on its own; restore is where the real cost and the real risk live, and it should not be bought accidentally by shipping (b) and calling it backups.
  4. Are presence and comments plan-gated, and on what key? 004's registry is the one canonical place and holds no collaboration key; the 001 plan's own dependency table says gate from birth rather than retrofit. Options: (a) ungated — collaboration is what a workspace is, and the seat count is the real lever (011); (b) one comments_is_enabled key minted at phase 04, default deny, granted true to existing plans on migration 000031's precedent, with presence ungated; (c) a key per surface. Recommendation: (b). Comments have a write path, which is ADR-0075's test for whether a capability is real; presence has no separable write path and gating it would bill a workspace for knowing who is in it. 011 meets the seat axis from pricing's side and this track does not pre-empt it.

Verification

Gate — scripts/check-realtime-parity.mjs (phase 00), in npm run verify as check:realtime. It must fail when a channel key is built anywhere but the canonical helper, when a ledger row claims wired with no publisher or no consumer in the tree, when an event type appears on one side of the wire only (client with no server publisher, or the reverse), and when a workspace-scoped event type has no row at all — the enforcement and renderer ledgers' shape, one concept over. Rows flip only in the commit that adds the reader.

Tests. Go: channel-key derivation through the helper; cross-workspace isolation — an event published to workspace A is never delivered to a subscriber of workspace B — treated as a security test that runs always and is never skipped; fan-out equivalence across the in-process bus and Redis; presence expiry including ungraceful disconnect; comments' workspace scoping and role gating on every route, with a foreign member getting 404 rather than 403. Unit: reconnect with capped backoff; presence reconciling rather than duplicating; the connection-state indicator reflecting the stream's real state — the test that stops "silent failure" meaning "silently wrong".

Live E2E, two browser contexts always. A collaboration feature proved with one context is not proved. Per the standard, live specs assert a database read, not just rendered text. Minimum: presence-two-members, block-changed-live, stale-write-attribution, comments-thread, workspace-isolation (the security assertion at UI level), realtime-degraded (Redis down: still works, nothing errors, the connection state says so).

Evidence. evidence/ carries every gate-failure observation and two-client run, one file per phase; evidence/isolation-test.md is kept separately because it is a security assertion and should be findable without reading a feature report. reports/TRANSPORT-MEASUREMENT.md is phase 01's deliverable.

Merge policy: the standing policy on ROADMAP.md.

Risks

RiskMitigation
Presence state leaking across workspaces — the channel key is the only thing separating tenants on a shared busThe helper is phase 00, before any publisher exists, and the isolation test is a security test at both Go and UI level rather than a feature assertion
Building on SSE and discovering it does not stretchPhase 01, before anything is built on the assumption; and 02–05 are chosen so that none of them needs more than the transport already demonstrates
Realtime hiding failures — a silent-failure client makes a broken stream look like a quiet workspaceA visible connection state, and a unit test that the indicator reflects the stream rather than the last thing that worked
Comments becoming the product's centre of gravity — threads attract mentions, reactions, resolution, permissionsThe out-of-scope list is the contract; an addition goes through a new DEFINE, not a slice
A second place defines what is publishedThe ledger's rows reference event types the helper keys and the gate reads both sides of the wire; a row that invents a type fails
This track being taken as licence to answer the overview's three open questions in codeThey are blockers 1–3, each with options and a recommendation. A phase that starts answering one has left the charter

Source: .station/jobs/006-collaboration/README.md

Library