Repository navigation
Extend review_project with method-dispatch, policy-duplication and registration signals (#428) - #449
Merged
Merged
Conversation
…y duplication, extension registration) PR #437 shipped review_project with 4 signals and explicitly deferred the rest of #428's scope. This closes the remaining signals: - method-dispatch: hand-written request.method branching/switch, reported as native-alternative pointing at per-method routes (get_capability "methods"); URLCode has no per-method-function YAML shape, per YAML-REFERENCE.md's explicit "a methods: map... is not implemented". - manual-rate-limit / manual-security-headers: hand-rolled counting+429 and hand-set security headers, cross-referenced against each route's actual *effective* policies.throttle/policies.security (via compilePolicies' own effectivePolicies resolution) so the finding reads "you could declare this" (native-alternative) when the policy isn't declared for the route, or "this duplicates what's already declared" (manual-review) when it is — never a false duplication claim. - Registered-vs-declared extension distinction: manual-cookie-session and global-mutable-state's extension-alternative findings now carry registered/revisionPinned booleans when the caller supplies operator registrations (InspectOptions.extensions, the same shape explain/ plan-feature already accept from --host-file/MCP host). Wired `urlcode review --host-file` and the MCP host through to reviewProject. Without registrations, or when the named extension isn't found in them, the wording stays the existing conservative "declared, setup unconfirmed" — a declaration is never reported as active or executable, and a stale (non-revision-pinned) registration is reported as such, not as current. Skipped: hand-written conditional-redirect-vs-match/conditional detection. Ordinary business-logic branching that happens to end in a redirect is too common and too disconnected from routing configuration for a bounded source-text signal to avoid false positives; an uncertain observation beats an incorrect automatic refactor (docs/TOOLING.md now states this). Adds positive/negative fixtures for all three new signals plus the registered/revision-pinned wording, following the existing test pattern. Updates docs/TOOLING.md's Project review section and regenerates llms-full.txt. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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
PR #437 shipped the initial
review_projecttool (urlcode review/ MCPreview_project) covering 4 static signals from #428, explicitly deferring the rest. This implements the remaining deferred scope:method-dispatch— detects hand-writtenrequest.method === 'X'(≥2 comparisons) orswitch(request.method)(≥2 cases) inside a function. Alwaysnative-alternative, pointing atget_capability("methods")since there's no per-method-function YAML shape — the real alternative is declaring one route per method.manual-rate-limit/manual-security-headers(the "policy duplication" signal) — detects hand-rolled rate-limit counters or manually-set security headers, cross-referenced against the route's effective policy (viaeffectivePolicies(), the same resolutioncompilePoliciesuses):native-alternativewhen the route doesn't declarepolicies.throttle/policies.security,manual-reviewwhen it already does (a real conflict, not a missed opportunity — never a false duplication claim).registered/revisionPinnedfields toReviewObservation, populated only when the caller supplies operator registrations via--host-file(CLI) or the MCP host channel (the same trusted mechanismexplain/plan-featurealready use). Wording becomes "registered and revision-pinned" when confirmed, "registered but not revision-pinned" for a stale registration, and stays the original conservative "declared, setup unconfirmed" when no registrations are supplied — this never executes project code or infers registration from project-declared YAML alone.Not implemented: conditional-redirect-reproduces-a-policy detection — too easily confused with ordinary business-logic branching (high false-positive risk), left out per the issue's own "an uncertain observation is preferable to an incorrect automatic refactor" guidance.
Test plan
npm run typechecknpm run check:docsnpm test— 751/758 pass, 1 skipped (pre-existing TLS-cert skip). The 6 failures (5 intest/install.test.ts, 1 intest/release-rehearsal.test.ts) are pre-existing worktree/environment issues (missingnode_modules/typescriptbinary, workspace-symlink ownership check) unrelated to this change — confirmedtest/review.test.tspasses 26/26 in isolation.--host-fileend-to-end test.Refs #428 (remaining scope after #437).
🤖 Generated with Claude Code