feat(fabric): add tenant-wildcard comms subscribe (RIG-3107) - #903
Open
rigel-mintaka wants to merge 1 commit into
Open
Conversation
The T3 delivery consumer is a per-Server singleton serving every tenant, so it must receive one event kind across all tenants. Each event publishes to a concrete `compass.<tenant>.comms.<kind>`, so the singleton needs a tenant-wildcard subscribe. - `CommsWildcardSubject(kind)` builds `compass.*.comms.<kind>`: the tenant token is the literal `*`, the kind stays concrete and `ValidSubjectToken`-checked so a wildcard kind can never widen the subject to all kinds. - `(*Fabric).SubscribeKind(ctx, kind, fn)` subscribes on that subject via one durable queue-group consumer, sharing the exact ack/park/teardown machinery of `Subscribe` (both now route through a private `subscribeSubject` helper). `Subscribe` keeps its strict concrete-only grammar; the wildcard is reachable only through `SubscribeKind`'s own validated builder. - Publish is untouched and still cannot target a wildcard: it derives its subject from the ref, and `EventRef.valid` rejects a `*` tenant. - DLQ provenance + per-message logs record `msg.Subject()` (the concrete delivered subject), so a parked message on the wildcard consumer keeps its tenant. - design.md's frozen `EventFabric` interface + SUBJECTS.md document the new read-side seam; the wildcard and concrete consumers are independent durables, so a later migration must retire the concrete subscribes rather than run both. Co-authored-by: Matt Wilkinson <matt@rigel.build>
This was referenced Sep 5, 2026
rigel-mintaka
marked this pull request as ready for review
September 5, 2026 19:53
|
Compass engineering docs preview: https://compass-managed-rig-3107-fab.compass-eng-docs.pages.dev Deployed from Changed pages: |
mattwilkinsonn
approved these changes
Sep 6, 2026
|
❌ This stack was removed from the merge queue because it failed tests. PR #917 was used for testing. See more details here.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack containing 3 PRs:
mainThe T3 delivery consumer is a per-Server singleton serving every tenant, so it
must receive one event kind across all tenants. Each event publishes to a
concrete
compass.<tenant>.comms.<kind>, so the singleton needs atenant-wildcard subscribe.
CommsWildcardSubject(kind)buildscompass.*.comms.<kind>: the tenant tokenis the literal
*, the kind stays concrete andValidSubjectToken-checked soa wildcard kind can never widen the subject to all kinds.
(*Fabric).SubscribeKind(ctx, kind, fn)subscribes on that subject via onedurable queue-group consumer, sharing the exact ack/park/teardown machinery of
Subscribe(both now route through a privatesubscribeSubjecthelper).Subscribekeeps its strict concrete-only grammar; the wildcard is reachableonly through
SubscribeKind's own validated builder.subject from the ref, and
EventRef.validrejects a*tenant.msg.Subject()(the concretedelivered subject), so a parked message on the wildcard consumer keeps its
tenant.
EventFabricinterface + SUBJECTS.md document the newread-side seam; the wildcard and concrete consumers are independent durables,
so a later migration must retire the concrete subscribes rather than run both.
Co-authored-by: Matt Wilkinson matt@rigel.build