Skip to content
Toolkit

ADR-0111 — A reply inherits its scope, and a block target is proved by its own row

Status: Accepted · Date: 2026-08-30 · Track: 006 collaboration, phase 04 (second slice) · Supersedes: nothing · Extends: ADR-0110

Context

ADR-0110 put a thread on a resource: a links row, so the target and the tenant are one fetch. The charter's phase 04 also asks for a comment on a block within that resource, which is a second question of the same shape and two new ones of its own.

The second question is where the scope lives. A comments_on_blocks table would duplicate the tenant column, the depth trigger, the delete rule and the one read the panel makes. A nullable column on comments does not: the thread on a block is the same document filtered, and the filter is the column (000037).

The new ones are these. A block id is a number the caller sends, so it is a target that must be proved — links proved the resource, and nothing yet proves the block. And a reply now has a scope it could contradict: a reply naming a different block than its root would be a second thread wearing its parent's id, drawn in a filter its root is not in.

Decision

A block target is proved by the block's own row, and an unprovable one is absence. The handler fetches the block by id and requires that its link_id and workspace_id both agree with the link it already proved. Anything else — another workspace's block, a block on another page of the caller's own workspace, an id that never existed, or no block store wired at all — answers 404, the same answer ADR-0110 gives for the resource, for the same reason: 403 confirms the thing exists, and a numeric id then reads a membership oracle one page over.

A reply inherits its root's scope and is never asked for one. The repository returns the root's scope with the answer to "is this a root on this resource", so there is no second round trip in which the two could disagree; the client sends no scope on a reply at all. 000037 adds the trigger that makes this unreachable rather than merely unwritten — a reply whose scope differs from its root's is refused by the database, as 000036's depth rule is.

The scope is a filter on the same fetch, and buys no second event. comment.changed names the document (ADR-0108's rule, which ADR-0110 already took), and a thread on a block within that document moved when the document's did. The panel filters roots by scope; the ledger row keeps its one publisher and its one consumer.

Consequences

  • A block-scoped comment dies with its block (ON DELETE CASCADE). A remark about a block that no longer exists is addressed to nothing, and falling back into the page thread would silently turn it into a remark about the page.
  • The canvas grows one affordance — the block toolbar opens that block's thread — and the panel a two-way scope control. Nothing else about the surface changes: the same endpoint, the same event, the same 404s.
  • CommentTargetBlockStore is a read-only lookup rather than a reuse of BiolinkBlockStore: this surface proves a target and writes nothing.
  • Blocks are the only sub-resource with a thread. A second one would repeat this shape — its own nullable column and its own proof — rather than generalising into the (type, id) pair ADR-0110 refused.

Evidence

.station/jobs/006-collaboration/evidence/phase-04-block-comments-running-stack-2026-08-30.md — two browser contexts, the migration exercised in both directions before any handler ran, and three watched failures: the declared scope dropped, the block target trusted without proof (the exact inversion — the feature test passes and the isolation test fails), and a reply keeping the scope it declared, which the database refuses.

Source: docs/decisions/0111-a-reply-inherits-its-scope-and-a-block-target-is-proved-by-its-own-row.md

Library