Skip to content

Rename the origin-filtered event channel to subscribe_to_events_excluding_origin #3338

Closed

Description

@mstomar125

Summary

Rename the origin-filtered mirror of the domain-event channel for what it does, as ADR-083 §4 recommends (proposed; decision 4-A):

  • subscribe_for_push becomes subscribe_to_events_excluding_origin.
  • set_push_excluded_origin becomes set_excluded_event_origin.
  • The internal names follow.

Behaviour does not change. There is no gate: only the pinned Pro daemon calls these methods, and it switches to the new names in its pin-bump PR.

Context

What the channel is. A second broadcast of domain events that withholds events tagged with one configured source_client_id. This stops one origin's bulk re-apply from flooding a consumer's buffer. Core itself configures no origin, and nothing outside tests subscribes. ADR-082 (proposed) lists it as core's outbound change feed.

Where it lives. packages/core/src/services/node_service/mod.rs (lines at af8ddb61):

  • push_forward_allowed (~644-667).
  • BatchEmitGuard.push_tx and .push_excluded_origin (~680-683), used in its Drop (~701-702).
  • flush_envelopes (~796-811), called at ~1003-1007 and ~3118-3119.
  • The NodeService.push_event_tx and .push_excluded_origin fields and their docs (~1315-1332).
  • Where those fields are cloned (~1454-1455) and constructed (~1503-1521, ~1573, ~1592-1593), and where the batch guard is built (~3087-3088).
  • subscribe_for_push (~2920-2932) and set_push_excluded_origin (~2934-2948).
  • The tests, under the block header at ~8141. They pass the literal "sync-service" as the excluded origin:
    • push_channel_mirrors_main_when_no_origin_excluded (~8163);
    • push_channel_excludes_configured_origin_for_node_events (~8200);
    • push_channel_excludes_configured_origin_for_relationship_events (~8245);
    • create_parent_edge_reparent_emits_former_parent_delete (~8300), which calls the setter;
    • push_channel_excludes_configured_origin_for_batched_flush (~8386).

One reference elsewhere. The is_sync_originated doc in packages/core/src/playbook/engine.rs (~1520-1523) cites push_forward_allowed and push_excluded_origin.

The Pro daemon. At sync 17f9557 it calls the setter at nodespaced-pro/src/cloud_sync/orchestrator.rs ~111 and subscribes at ~324. It builds against pinned core 680c35d8, so this rename shows up as two compile errors in its next pin-bump PR.

Scope

Renames:

Old New
subscribe_for_push subscribe_to_events_excluding_origin
set_push_excluded_origin set_excluded_event_origin
NodeService.push_event_tx origin_filtered_event_tx
NodeService.push_excluded_origin, BatchEmitGuard.push_excluded_origin excluded_event_origin
BatchEmitGuard.push_tx filtered_tx
push_forward_allowed passes_origin_filter
flush_envelopes params push_tx and push_excluded_origin, and the local push_excluded_origin_ref filtered_tx, excluded_origin, excluded_origin_ref
tests push_channel_* origin_filtered_channel_*

Also:

  • the docs of everything in the table;
  • the two names in the is_sync_originated doc.

Out of scope

Steps

  1. Start. Follow core CLAUDE.md's startup sequence:
    • EnterWorktree({name: "issue-<N>-event-channel-names"});
    • bun install;
    • the bun run test baseline;
    • gh:assign, then gh:status.
  2. Rename everything in the Scope table. Use rust-analyzer rename, or git grep each old name and edit by hand. The names occur only in this file and the engine doc.
  3. Rewrite the docs. Name no consumer, and don't use "push" or "cold pull".
    • subscribe_to_events_excluding_origin:
      • It delivers every domain event except those whose source_client_id equals the origin set by set_excluded_event_origin.
      • With no origin set, it behaves like subscribe_to_events.
      • It is for a consumer whose buffer one origin's bulk writes must not flood.
    • set_excluded_event_origin: the setting is shared by every clone of the service, and core assumes no particular id.
    • Keep the existing caveat that create_node_streaming stamps a fixed source.
  4. Tests.
    • Replace the "sync-service" literal with a test-local const EXCLUDED_ORIGIN: &str = "bulk-apply";, both in the setter calls and in with_client(..).
    • Reword "push channel" in the assertion messages and in the block header comment.
  5. Grep. git grep -n -E 'subscribe_for_push|set_push_excluded_origin|push_event_tx|push_excluded_origin|push_forward_allowed|push_channel_' -- packages prints nothing.
  6. Ratchet. Run bun run scripts/check-pro-boundary.ts, then set BASELINES to the printed counts. This rename probably changes no count, but the step is required.
  7. Finish.
    • Run bun run test:changed, then bun run quality:fix, then commit.
    • git push origin HEAD:issue-<N>-event-channel-names.
    • gh pr create --repo NodeSpaceAI/nodespace-core --base main --head issue-<N>-event-channel-names.
    • bun run gh:status <N> "In Review".
    • After approval, run bun run merge <PR#> in the background.

Acceptance criteria

  • The step 4 grep prints nothing.
  • The renamed tests pass:
    • the channel still withholds the excluded origin's node, relationship and batched-flush events;
    • with no origin set, it mirrors every event.
  • No doc or identifier on this seam names a consumer, and none says "push" or "sync".
  • bun run scripts/check-pro-boundary.ts exits 0, and BASELINES equals its printed counts.
  • Core builds, all tests pass, and the free app is unchanged.

Tests and verification

  • bun run test:changed
  • .tools/bin/cargo-nextest nextest run -p nodespace-core --lib origin_filtered_channel
  • .tools/bin/cargo-nextest nextest run -p nodespace-core --lib create_parent_edge_reparent
  • cargo clippy -p nodespace-core --all-targets -- -D warnings -D clippy::unused-async

Dependencies

Risks and rollback

  • No runtime risk. This is a pure rename, and the tests are unchanged apart from names.
  • Sync's next pin bump fails to compile until it renames two call sites. That failure is the intended signal.
  • Rollback: revert the PR.

Plan key: C7.3 (pro-boundary DAG).

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Sep 30, 2026
  2. added
    pro-boundary
    on Sep 30, 2026
  3. mstomar125 commented on Sep 30, 2026

    @mstomar125
    ContributorAuthor

    Completed in #3394 (merged). Auto-close did not fire; closing manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions