Skip to content

Extend review_project with method-dispatch, policy-duplication and registration signals (#428) - #449

Merged
jimhoyd merged 1 commit into
mainfrom
claude/428-review-remaining-signals
Sep 22, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/428-review-remaining-signals

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR #437 shipped the initial review_project tool (urlcode review / MCP review_project) covering 4 static signals from #428, explicitly deferring the rest. This implements the remaining deferred scope:

  • method-dispatch — detects hand-written request.method === 'X' (≥2 comparisons) or switch(request.method) (≥2 cases) inside a function. Always native-alternative, pointing at get_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 (via effectivePolicies(), the same resolution compilePolicies uses): native-alternative when the route doesn't declare policies.throttle/policies.security, manual-review when it already does (a real conflict, not a missed opportunity — never a false duplication claim).
  • Registered-vs-declared extensions — added registered/revisionPinned fields to ReviewObservation, populated only when the caller supplies operator registrations via --host-file (CLI) or the MCP host channel (the same trusted mechanism explain/plan-feature already 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 typecheck
  • npm run check:docs
  • npm test — 751/758 pass, 1 skipped (pre-existing TLS-cert skip). The 6 failures (5 in test/install.test.ts, 1 in test/release-rehearsal.test.ts) are pre-existing worktree/environment issues (missing node_modules/typescript binary, workspace-symlink ownership check) unrelated to this change — confirmed test/review.test.ts passes 26/26 in isolation.
  • 20 new fixture tests added: positive/negative cases for each new signal, plus registered/pinned/unregistered/no-registrations-supplied cases and a CLI --host-file end-to-end test.

Refs #428 (remaining scope after #437).

🤖 Generated with Claude Code

…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]>
@jimhoyd
jimhoyd merged commit c519959 into main Sep 22, 2026
204 of 206 checks passed
@jimhoyd
jimhoyd deleted the claude/428-review-remaining-signals branch September 22, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant