Repository navigation
Pipeline inbound message policy in Router - #77
Merged
Merged
Conversation
Extract inbound gate into InboundFilterPolicy (self-message, body-type, global-disabled + /enable bypass) reading a RuntimeFlags port instead of UserDefaults directly. Router becomes a thin pipeline runner: notify delegates -> filter -> match -> invoke. UserDefaultsRuntimeFlags centralizes the disabled-state read; Jared.send outbound check uses the same port. RuntimeFlags is injectable so policy and router are testable without touching global UserDefaults. Adds InboundFilterPolicyTests (policy stages + /enable bypass, explicit), UserDefaultsRuntimeFlagsTests, and Router integration tests for disabled state. Built TDD, one behavior per cycle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Skeyelab
enabled auto-merge (squash)
June 17, 2026 02:30
Skeyelab
force-pushed
the
Skeyelab/gh-issue-70-router-pipeline
branch
from
June 17, 2026 02:30
1b2c223 to
8f79ee5
Compare
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.
Closes #70
Summary
Router.routepreviously hid four unrelated policy concerns inline. This pulls the inbound gate into a named, testable stage and abstracts the disabled-state read behind a port.RuntimeFlagsport +UserDefaultsRuntimeFlags— abstracts Jared's global disabled state away from directUserDefaults.bool(forKey:)reads. Injectable.InboundFilterPolicy— concentrates self-message, body-type, and global-disabled +/enablebypass policy. ReadsRuntimeFlags. Pure and unit-testable without mock routes.Router— now a thin pipeline runner: NotifyDelegates → FilterPolicy → MatchRoutes (MessageMatcher) → InvokeRoute. TakesRuntimeFlagsinjected (defaultUserDefaultsRuntimeFlags).Jared.sendoutbound disabled check now reads the sameRuntimeFlagsport, so runtime-flag reads live behind one abstraction.Scope note
The issue lists
NotifyDelegates/MatchRoutes/InvokeRouteas separate stage types. Those are one-liners andMessageMatcheralready is MatchRoutes — extracting them into wrapper types would add shallow modules against the deep-module goal. The real depth (the four hidden policy checks) is now inInboundFilterPolicy; the rest stays as a readable loop inRouterwith stage comments.Built with TDD
One behavior per red→green cycle: normal-allow (tracer) → self-message → body-type → disabled →
/enablebypass (+ case-insensitive) → reaction →UserDefaultsRuntimeFlags→ Router integration. RefactoredJared.sendonto the port only after green.Test plan
bash ./.github/scripts/test-macos.sh— 117 tests, all passInboundFilterPolicyTests— allow/block per policy stage,/enablebypass explicit + case-insensitive, reaction bodyUserDefaultsRuntimeFlagsTests— key set/unset via isolated suiteRouterTests— newtestDisabledFlagsSkipPluginRoutes,testEnableCommandRoutesEvenWhenDisabled; existing Router/MessageMatcher tests unchanged and greenAcceptance criteria
InboundFilterPolicystandalone)RuntimeFlagsabstractsUserDefaults/ disabled state/enablebypass preserved and explicitly testedRouterTestsandMessageMatcherTestspass🤖 Generated with Claude Code