Skip to content

feat(comms): publish message_posted on the event fabric (RIG-3107) - #1333

Open
rigel-mintaka wants to merge 4 commits into
mainfrom
compass-managed/rig-3107-fabric-publish
Open

rigel-mintaka wants to merge 4 commits into
mainfrom
compass-managed/rig-3107-fabric-publish

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 2 PRs:

  1. main
  2. "feat(comms): publish message_posted on the event fabric (RIG-3107)" (this PR)
  3. feat(fabric): propagate trace context, add OnReconnect, pin serial callbacks (RIG-3107) #1337

Adds the publish side of the delivery cutover in docs/designs/infra/runtime/compass-managed-delivery-cutover/design.md (Plan, T1).

  • NewComms takes a fabric.EventFabric. A nil fabric keeps message_posted on the bus only. Every call site passes nil until server assembly constructs the fabric.
  • After the bus publish, publishMessagePosted publishes EventRef{tenant, message_posted, row id} on CommsSubject(tenant, message_posted). The tenant comes from Store.EffectiveTenant, the exported set-or-bootstrap resolver the hub already uses. The record names it ResolveTenant; this reuses the existing export instead of adding a second one.
  • The auth registry guard now names the internal compass.v1 service files (runner, agent gateway, guest control) as ungated. Linking the fabric into comms put them in the auth test binary, and they are never mounted behind AdminGate.
  • A publish failure after commit is logged and counted on compass.delivery.fabric_publish_failures, never returned to the poster.

Tests (pgtest, fake fabric): a genuine post publishes exactly one ref after the row commits; an idempotent retry publishes nothing; a publish failure still succeeds and increments the counter; RespondToAsk publishes the answer message.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson matt@rigel.build

Enqueue

Do not enqueue this PR alone. Production passes a nil fabric until T3 wires it, so T1 on its own publishes nothing. T2+T5 and T3 will stack on this branch; enqueue at the stack tip (T3) once it exists.

Adds the publish side of the delivery cutover in `docs/designs/infra/runtime/compass-managed-delivery-cutover/design.md` (Plan, T1).

- `NewComms` takes a `fabric.EventFabric`. A nil fabric keeps `message_posted` on the bus only. Every call site passes `nil` until server assembly constructs the fabric.
- After the bus publish, `publishMessagePosted` publishes `EventRef{tenant, message_posted, row id}` on `CommsSubject(tenant, message_posted)`. The tenant comes from `Store.EffectiveTenant`, the exported set-or-bootstrap resolver the hub already uses. The record names it `ResolveTenant`; this reuses the existing export instead of adding a second one.
- The auth registry guard now names the internal compass.v1 service files (runner, agent gateway, guest control) as ungated. Linking the fabric into comms put them in the auth test binary, and they are never mounted behind AdminGate.
- A publish failure after commit is logged and counted on `compass.delivery.fabric_publish_failures`, never returned to the poster.

Tests (pgtest, fake fabric): a genuine post publishes exactly one ref after the row commits; an idempotent retry publishes nothing; a publish failure still succeeds and increments the counter; `RespondToAsk` publishes the answer message.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Sep 25, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@linear-code

linear-code Bot commented Sep 25, 2026

Copy link
Copy Markdown

RIG-3107

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-managed-rig-3107-fab-a0of.compass-eng-docs.pages.dev

Deployed from compass-managed/rig-3107-fabric-publish at e6c0ca2.

Changed pages:

rigel-mintaka and others added 3 commits September 25, 2026 15:29
…3107)

Review of the T1 publish found a lost-trigger window:

- The publish ran on the request ctx. A client hanging up after commit
  canceled it, and an idempotent retry never republishes, so the post
  waited for the floor sweep. It now runs on a WithoutCancel ctx bounded
  by a 5s timeout.
- New tests pin a non-bootstrap request tenant to its subject, and pin
  the publish surviving a cancel mid-ack. The fake keeps its row-read
  error instead of folding it into a bool.
- The design record's T1 interface named Store.ResolveTenant; it now
  names Store.EffectiveTenant, which landed with the same semantics.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson <matt@rigel.build>
The cancellation test proved the publish is detached from the request,
but removing the 5s timeout left it green. The fake now records the
publish deadline, and the test fails when none is set.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson <matt@rigel.build>
The deadline check caught a missing or longer timeout but passed a
shorter one. It now measures from Publish entry and fails on a 2s or
10s bound.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson <matt@rigel.build>
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