Repository navigation
chore(quality): arch-review fix-packet — delete shadow channel denylist, import profile-marker consts in tests, RequestSubject boundary comment - #65
Conversation
…annel denylist, DRY profile markers, RequestSubject boundary comment (openclaw#3630) 3 code-quality items from the cross-repo architecture review (openclaw#3630), one branch, normal QG: (1) DELETE KNOWN_THIRD_PARTY_CHANNELS (render-policy.ts): it was an exact reordered copy of registry CHAT_CHANNEL_ORDER, its own comment said it was inert (not enforcement — the deny-unknown FIRST_PARTY_PHI_CHANNELS allowlist is), and its test was tautological. Deleted the export + the tautological test + the SEC-IRC toContain assertion + the test import; verified 0 remaining consumers. The load-bearing registry-completeness test (isThirdPartyChannel===true for every CHAT_CHANNEL_ORDER channel) + the deny-unknown posture are untouched. Negative diff; the doc anchor is now derived from the registry (referenced in the FIRST_PARTY docstring). (2) DRY the profile markers: profile.ts now EXPORTS OPEN/CLOSE ('[SYNTROPY_PROFILE]' / '[/SYNTROPY_PROFILE]') as the single source of truth; profile-context.test.ts (4 literal sites) + index-injection.test.ts (2 sites) now import + use the consts instead of re-hardcoding — prevents drift if the marker changes. Sealed suites left as-is (and hook-barred from me anyway). (3) RequestSubject boundary comment (syntropy-mcp/src/index.ts): documented that ExchangeSubject (token-exchange.ts) is the VALIDATED discriminated-union form and toExchangeSubject is the ONLY bridge — never pass a loose RequestSubject to the exchange directly. 90 tests pass (render-policy 28 + deliver 36 + profile-context 24 + index-injection ...), tsgo clean, oxlint clean, oxfmt clean. Off fresh main c48edf0 (post #62/#63/#64). Generated-With: Claude Code Co-Authored-By: cto <[email protected]> Co-Authored-By: Claude <[email protected]>
📝 WalkthroughWalkthroughThe changes export shared Syntropy profile delimiters for test reuse, update profile-related fixtures, remove the static third-party channel registry in favor of runtime policy classification, refine policy tests, and document token-exchange subject validation boundaries. ChangesSyntropy profile delimiters
Outbound PHI policy
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
The formal models extracted constants ( This check is informational (not blocking merges yet). If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/syntropy-mcp/src/index.ts`:
- Around line 254-259: Update the boundary comment near toExchangeSubject to
describe ExchangeSubject as the narrowed discriminated-union form rather than
“validated,” and state that toExchangeSubject only performs presence checks
without validating token claims, channel membership, or provenance. Preserve the
instruction that RequestSubject must not be passed directly to the exchange.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 029a2b9a-2c5f-426d-819a-564a4589dc74
📒 Files selected for processing (6)
extensions/syntropy-mcp/src/index.tsextensions/syntropy/src/index-injection.test.tsextensions/syntropy/src/profile-context.test.tsextensions/syntropy/src/profile.tssrc/infra/outbound/render-policy.test.tssrc/infra/outbound/render-policy.ts
💤 Files with no reviewable changes (1)
- src/infra/outbound/render-policy.test.ts
| * | ||
| * BOUNDARY: this is the LOOSE inbound shape (all-optional). `ExchangeSubject` | ||
| * (token-exchange.ts) is the VALIDATED discriminated-union form the exchange | ||
| * requires; `toExchangeSubject` (below) is the ONLY bridge — it validates/narrows | ||
| * a RequestSubject into an ExchangeSubject (or null). Never pass a RequestSubject | ||
| * to the exchange directly. |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔵 Trivial | 💤 Low value
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n -C4 '\b(toExchangeSubject|RequestSubject|ExchangeSubject|getUserToken)\b' extensions/syntropy-mcp/srcRepository: Syntropy-Health/openclaw
Length of output: 50380
🏁 Script executed:
sed -n '230,290p' extensions/syntropy-mcp/src/index.ts && printf '\n---\n' && sed -n '680,705p' extensions/syntropy-mcp/src/index.ts && printf '\n---\n' && sed -n '55,95p' extensions/syntropy-mcp/src/token-exchange.tsRepository: Syntropy-Health/openclaw
Length of output: 6332
Clarify the boundary wording toExchangeSubject only narrows RequestSubject to ExchangeSubject with presence checks; it doesn’t validate token claims, channel membership, or provenance, so “validated” overstates the guarantee.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@extensions/syntropy-mcp/src/index.ts` around lines 254 - 259, Update the
boundary comment near toExchangeSubject to describe ExchangeSubject as the
narrowed discriminated-union form rather than “validated,” and state that
toExchangeSubject only performs presence checks without validating token claims,
channel membership, or provenance. Preserve the instruction that RequestSubject
must not be passed directly to the exchange.
CTO architecture-review fix-packet: (1) KNOWN_THIRD_PARTY_CHANNELS deleted (exact reordered copy of registry CHAT_CHANNEL_ORDER, inert, tautological test) — deny-unknown allowlist + registry-completeness pin untouched, doc anchor derived from registry, negative diff, 0 consumers (tsgo clean); (2) profile-marker consts imported in 5 non-sealed test sites; (3) RequestSubject/ExchangeSubject boundary comment. 90 tests pass, all gates clean.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Maintenance