ADR-0112 — An activity feed is derived, and derived from the rows that carry the tenant
Status: Accepted · Date: 2026-08-30 · Track: 006 collaboration, phase 05 · Extends: ADR-0107, ADR-0109
Context
The charter's phase 05 asks for a 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
system.
Building it found that the two streams it names cannot answer the question.
Neither carries a workspace. users_logs is per-user and per-request — a
user_id, an IP, a city, a browser — and has no tenant column at all; a feed
built on it would either disclose another member's IP and location or answer
only for yourself. user_history_events is per-user and per-tab
(session_id) by construction, which the charter's own Blocker 2 already says
about version history: deriving a shared history from it produces one missing
whatever the other member did. Its entity_type/entity_id pair could have
its workspace inferred by joining each entity to its own table, which is a
tenancy boundary rebuilt at read time, once per entity kind, in the one query
that must never get it wrong.
Decision
The feed is assembled from the rows that carry workspace_id. Comments
(000036), blocks — created, and last edited through 000035's attribution —
resources (links), and the roster itself. Each arm is a WHERE workspace_id = $1, so the tenant is the query rather than something inferred
after it, and the workspace comes from the request context the middleware
already proved, never from a parameter (ADR-0107's rule for presence, which a
query string could otherwise undo).
users_logs and user_history_events are not read. Recording that here is
the point: the charter named them, and the reason they are absent is a property
of the schema rather than a preference.
Nothing is written for the feed. It is a projection: no table, no publisher, no logging system. An action it can report is one some existing write already recorded, and "block edited" therefore reports the last editor and no earlier ones, because that is what the column stores — reporting more would be inventing history.
The feed goes live off the events its sources already publish, and the
ledger says so: a third carrier, derived, whose row names its sources —
rows in the same ledger, each of which must itself be wired — instead of a
publisher, and names no channel and no event. A activity.changed event would
be a second announcement of the first one, published by the same write, and a
gate that demanded one would be making the tree lie to it. This is ADR-0109's
refusal carrier one shape over: the ledger describes how a surface arrives,
rather than assuming every surface is an event.
The nouns come from the registries that own them — the link-type registry
for a resource, the served block-type catalogue for a block (ADR-0030,
ADR-0057). The feed's own vocabulary is its verbs, as tokens both ends
spell, and the actor's name is resolved through this workspace's roster, never
users alone (ADR-0109).
Consequences
- The feed is complete for what the product stores and no more. "Who deleted this block" is not answerable, because deletion leaves no row; making it answerable is a write path, which is the thing this phase must not add.
- A new action is only ever added beside a write that already stores what it would need. The client draws an unknown action as who and when rather than hiding it, so a server ahead of a build degrades rather than lies.
- The read is a five-way
UNION ALLand is capped at 100 rows: uncapped, it is a way to ask the database for the whole workspace. users_logsremains what it is — a security and audit log, per user. If the product ever wants a workspace audit trail, that is a tenant column and a decision about retention, not a feed.
Evidence
.station/jobs/006-collaboration/evidence/phase-05-activity-feed-running-stack-2026-08-30.md
— two browser contexts, and the widened gate watched failing five ways plus
the surface watched failing twice, including the exact inversion: the tenant
dropped from one arm of the union (the isolation test fails) and the consumer
listening for nothing (the feature test fails).
Source: docs/decisions/0112-an-activity-feed-is-derived-from-the-rows-that-carry-the-tenant.md