fix(api): reject unsupported health methods - #100
Conversation
|
Warning Review limit reached
Next review available in: 6 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
|
@coderabbitai review Please review unchanged exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='c85d710804139c0697d7ef8fa47d02b1389e6d84'
head='c3b767c1c5b45801151d8a72475f815ff458ac8e'
printf '%s\n' '== Revision identity =='
git rev-parse HEAD
git cat-file -t "$base"
git cat-file -t "$head"
git show -s --format='base: %H%nsubject: %s' "$base"
git show -s --format='head: %H%nsubject: %s' "$head"
printf '%s\n' '== Changed files and diff stat =='
git diff --stat "$base" "$head"
git diff --name-status "$base" "$head"
printf '%s\n' '== Full bounded diff =='
git diff --no-ext-diff --unified=80 "$base" "$head" -- src/index.ts test/health-method-contract.test.ts
printf '%s\n' '== Runtime module outline =='
ast-grep outline src/index.ts --items all --view expanded
printf '%s\n' '== Runtime health and shared error-path references =='
rg -n -C 12 -e 'health' -e 'ApiError' -e 'Allow' -e 'ERR_VALIDATION_INPUT' -e 'x-content-type-options' -e 'cache-control' -e 'pragma' src/index.ts
printf '%s\n' '== Health contract test outline and assertions =='
ast-grep outline test/health-method-contract.test.ts --items all --view expanded
cat -n test/health-method-contract.test.tsLength of output: 35256 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Shared response builders =='
sed -n '120,290p' src/index.ts
printf '%s\n' '== Health API contract references =='
rg -n -i -C 8 \
-e '(/health|health endpoint|health check|liveness)' \
-g '!node_modules/**' -g '!dist/**' -g '!build/**' .
printf '%s\n' '== Explicit HTTP-method declarations near health references =='
rg -n -i -C 6 \
-e '(GET\s+/?health|/health\s*.*GET|method.*GET|allowed_methods.*GET)' \
-g '!node_modules/**' -g '!dist/**' -g '!build/**' .Length of output: 125512
I found no issues in the requested scope.
This is diagnostic review evidence only. It is not independent merge approval authority.
|
Purpose
Make runtime liveness behavior match the public API contract:
/healthmust not return a false 200 liveness success for unsupported HTTP methods.Exact source identity
mainatc85d710804139c0697d7ef8fa47d02b1389e6d84;fix/health-method-contract-on-main;afd829e80bdb1e52ca543bdd2b135cf3f0722a22;f59951e13da25384244e337c02c4e860a9932763;c3b767c1c5b45801151d8a72475f815ff458ac8e;src/index.tsplustest/health-method-contract.test.ts.RCA and test-first proof
The first failing boundary was the deployed runtime route itself: the
/healthbranch returned success solely from pathname matching and never validated the request method. Exact-head application CI run31398252729checked outafd829e80bdb1e52ca543bdd2b135cf3f0722a22and failed only the new health-method regression: unsupported methods returned200instead of405; 647 existing tests passed.The narrow production repair reuses Noema's existing
ApiErrorand standard response/logging path before liveness success. Unsupported methods now return405,Allow: GET,ERR_VALIDATION_INPUT, and the normal diagnostic/security headers.GET /healthremains unchanged.A follow-up executable contract on current head
c3b767c1c5b45801151d8a72475f815ff458ac8eexpands the unsupported-method boundary toHEAD,POST,PUT,PATCH,DELETE, andOPTIONS, and pinscontent-type,cache-control: no-store,pragma: no-cache,x-content-type-options: nosniff, trace presence, and body/header trace-ID consistency. This matches the protected API specification, which defines onlyGET /health.Current exact-head evidence
For unchanged head
c3b767c1c5b45801151d8a72475f815ff458ac8e:cirun31402062203: terminal success; verify job93499202012completed exact checkout, toolchain validation, install, andrelease verifysuccessfully;reviewer-cirun31402062029: terminal success; reviewer job93499201726completed exact checkout, 100% reviewer line/branch coverage, 100% docstring gate, immutable sandbox-image scanning, and real no-network sandbox smoke successfully;Security Scanrun31402061961: terminal success under its own scanner/revision semantics;Merge / operational boundary
Technical success is not merge authority. Live enforceable governance under #27 and an eligible qualifying independent non-author formal-review path under #29 remain separate fail-closed gates where required. No self-approval, protection weakening, synthetic status, release, deployment, outbound-license decision, or acquisition-readiness claim is made.