feat(protocol): add EGRESS as a sixth categorization (Phase 2c-2d)#507
Merged
Conversation
Fourth in the daemon-as-process arc. Resolves the open question surfaced in PR #505: ``egress.deliver`` was on the namespace-invariant allowlist because the 2c-1 categorization committed to five prefixes and didn't include outbound delivery. Option 1 chosen (with @jinhongkuan): add ``EGRESS_PREFIX = "egress."`` as a sixth category symmetric with ``IngestAdapter`` ↔ ``EgressAdapter`` in the Protocol surface. Egress is structurally distinct from ``write.*`` (pushes NotificationEvents to channel adapters, not rows to the ledger); conflating them at the wire level would force adapter authors to reason about which ``write.X`` mutates state vs which fans out a notification. Changes: - protocol/categorization.py: - new EGRESS_PREFIX constant - Category.EGRESS enum value - _PREFIX_BY_CATEGORY mapping entry - egress_tool() decorator function - docstring updated 5 → 6 categories - protocol/__init__.py: export egress_tool, EGRESS_PREFIX - tests/test_protocol_categorization.py: - _PREFIX_BY_CATEGORY mapping extended - test_all_five_categories_smoke → test_all_six_categories_smoke (now includes egress assertion) - new test_egress_tool_rejects_mismatch (parallel to existing read_tool mismatch test) - tests/test_protocol_namespace_invariant.py: - egress.deliver removed from WIRE_METHOD_ALLOWLIST (now matches proper EGRESS_PREFIX) - EGRESS_PREFIX added to _CATEGORIZED_PREFIXES tuple Timing rationale: egress dispatch is still a stub today. Renaming-the- namespace cost is zero now; once 2c-3 spins up real egress dispatch, the wire name becomes load-bearing and a hosted-mode rename means coordinated client+server release. Bicameral preflight unavailable this session (MCP disconnected); will validate against ledger before 2c-3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced May 23, 2026
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.
Summary
Resolves the open question surfaced in #505:
egress.deliverwas on the namespace-invariant allowlist because the 2c-1 categorization committed to five prefixes and didn't include outbound delivery.Option 1 chosen (with @jinhongkuan): add
EGRESS_PREFIX = "egress."as a sixth category symmetric withIngestAdapter↔EgressAdapterin the Protocol surface.Egress is structurally distinct from
write.*— it pushesNotificationEventto channel adapters, not rows to the ledger. Conflating them at the wire level would force adapter authors to reason about whichwrite.Xmutates state vs which fans out a notification. Cleaner mental model under its own prefix.What changed
protocol/categorization.py:EGRESS_PREFIXconstantCategory.EGRESSenum value_PREFIX_BY_CATEGORYmapping entryegress_tool()decorator functionprotocol/__init__.py— exportegress_tool,EGRESS_PREFIXtests/test_protocol_categorization.py:_PREFIX_BY_CATEGORYmapping extendedtest_all_five_categories_smoke→test_all_six_categories_smoketest_egress_tool_rejects_mismatch(parallel to existing read_tool mismatch test)tests/test_protocol_namespace_invariant.py:egress.deliverremoved fromWIRE_METHOD_ALLOWLIST(now matches properEGRESS_PREFIX)EGRESS_PREFIXadded to_CATEGORIZED_PREFIXEStupleTiming rationale
Egress dispatch is a stub today — no hosted-mode adapter speaks it yet. Renaming-the-namespace cost is zero now. Once 2c-3 spins up real egress dispatch and the daemon becomes a real process, the wire name becomes load-bearing and a hosted-mode rename means coordinated client+server release. Cheaper to settle the contract while no one's compiling against it.
Test plan
pytest tests/test_protocol_categorization.py— 9 passing (was 8 + newtest_egress_tool_rejects_mismatch)pytest tests/test_protocol_namespace_invariant.py— 3 passing (allowlist now empty)ruff format --check . && ruff check .cleanmypy protocol/cleanKnown limitation
Bicameral preflight unavailable this session (MCP server disconnected). Will validate against the ledger before opening 2c-3.
Plan refs
thoughts/shared/plans/2026-05-22-daemon-as-process-arc.md🤖 Generated with Claude Code