Skip to content

feat(registrar): demand-scoped watch with per-service fan-out (004 Phase 2) - #162

Merged
bpalermo merged 1 commit into
mainfrom
feat/demand-scoped-phase2
Jun 12, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/demand-scoped-phase2

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Phase 2 of proposal 004 (rebased onto main after #158; replaces #159, which was auto-closed when the stack base branch was deleted).

  • WatchEndpointsRequest.filter (ServiceFilter): scoped snapshot + incremental events. Unset = full watch (compat); explicitly empty = watch nothing.
  • Broadcaster indexes subscribers by service → fan-out per endpoint change is O(consumers), not O(nodes). Slow-watcher force-resync preserved (index-aware).
  • Agent (RegistrarRegistry.SetServiceFilter, registry.WatchScoper): filter asserted from the node dependency set at PreListen and on every dep-set change; a change cancels the stream and reconnects with the resume token cleared (a version resume would skip newly in-scope services). Re-asserted on every reconnect, same as registrations (fix(agent,registry): ghost sweep diffs against authoritative listing, not the watch cache #149).
  • Gauge: aether.registrar.watch.filtered_subscribers.

🤖 Generated with Claude Code

…ase 2)

WatchEndpointsRequest gains a ServiceFilter: a filtered watch receives
the snapshot and incremental events for its services only. Unset filter
= full watch; explicitly empty = watch nothing (a node with no mesh
pods). The broadcaster indexes subscribers by service, so an endpoint
change fans out to its consumers instead of every node.

The agent asserts its dependency set as the filter at PreListen and
re-asserts it on every refresher reload (no-op when unchanged); a
changed filter cancels the live stream and reconnects with a cleared
resume token, since newly in-scope services were never delivered to
the old stream. Filter re-assertion on reconnect follows the same
discipline as endpoint re-assertion (#149).

New gauge: aether.registrar.watch.filtered_subscribers.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@bpalermo
bpalermo merged commit f5c7e21 into main Jun 12, 2026
9 checks passed
@bpalermo
bpalermo deleted the feat/demand-scoped-phase2 branch June 12, 2026 13:11
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