Skip to content

fix(api): restack health method contract on current main - #208

Merged
seonghobae merged 2 commits into
mainfrom
fix/health-method-contract-current-main-v2
Aug 12, 2026
Merged

fix(api): restack health method contract on current main#208
seonghobae merged 2 commits into
mainfrom
fix/health-method-contract-current-main-v2

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fresh protected-main successor for historical #100 on exact base 1a8a77d67f61a2c61e88974be9206a91d19acdf4. No predecessor checks, reviews, scanner output, model judgment, or production evidence transfers.

RCA -> RED -> GREEN

Protected src/index.ts returned a liveness success for /health solely by pathname and did not validate the request method. The intended public liveness contract exposes only GET /health; unsupported methods must not become false 200 liveness evidence.

Exact RED head 8f13b389d7ebcef88ee33bba96281a1defa643e5 added only the executable contract: GET remains successful, while HEAD/POST/PUT/PATCH/DELETE/OPTIONS require 405, Allow: GET, no-store/security headers, and trace consistency. Application CI run 31564064301, job 94012184630, checked out that exact head and failed in release verify; exact checkout, toolchain and install steps had already succeeded.

Exact GREEN head c4a92e3e2d00edb88612b3fd9c2a0b3d520d32a7 applies only the narrow production remedy: reject non-GET /health before liveness success through the existing ApiError/standard error path. The pre-repair protected src/index.ts blob on current main was byte-identical to historical #100's base blob (283527e4989b4f069673ec7f8dabc2e75998e685), so the production result reuses the previously reviewed exact replacement blob 7093e381ea87cd29940d4e7ecb9517f5e2a5b443 without importing any stale tree or predecessor evidence. /ready, /exchange, rate limiting, OIDC/GitHub credential handling and all other runtime behavior remain unchanged.

Exact-head technical proof

For unchanged GREEN head c4a92e3e2d00edb88612b3fd9c2a0b3d520d32a7 on unchanged live protected base 1a8a77d67f61a2c61e88974be9206a91d19acdf4:

  • application ci 31564230581: terminal success; exact checkout and release verify succeeded;
  • reviewer-ci 31564230580: terminal success;
  • protected-base eligible central Security Scan 31564230600: terminal success;
  • formal reviews: 0 at the latest fresh read;
  • inline review threads: 0 at the latest fresh read;
  • GitHub reports the content graph mergeable.

The repository release-verification contract retains the exact 100% owned-production coverage gate and package/security checks; successful release verify is current-head technical evidence, not production/release/acquisition evidence.

Governance / authority boundary

Current observable Noema governance is organization ruleset 18794436, requiring central .github/workflows/security-scan.yml@refs/heads/main on the default branch, with no bypass actors and no pull-request approval rule. Therefore no nonexistent independent approval is invented as a current merge blocker; checks, formal reviews, scanner/model evidence and production evidence remain separate.

Historical #100 remains open until this current-main successor integrates and the two-file contract is proven protected truth. This change does not publish a release, deploy production, establish production KPI, choose an outbound license, or create acquisition readiness.

Summary by CodeRabbit

  • 버그 수정

    • /health 엔드포인트가 GET 요청만 허용하도록 변경되었습니다.
    • 지원되지 않는 HTTP 메서드 요청에는 405 오류와 Allow: GET 안내가 제공됩니다.
  • 테스트

    • 허용 메서드와 잘못된 메서드에 대한 응답 상태, 오류 정보 및 추적 ID 검증이 추가되었습니다.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

/health 엔드포인트가 GET 요청만 허용하도록 변경되었습니다. 다른 메서드는 Allow: GET 정보와 표준 입력 검증 오류를 포함한 405 응답을 반환합니다. 관련 동작을 계약 테스트로 검증합니다.

Changes

/health 메서드 계약

Layer / File(s) Summary
메서드 검증 및 계약 테스트
src/index.ts, test/health-method-contract.test.ts
/health는 GET 요청을 처리합니다. 다른 지정 메서드는 allowed_methods: "GET" 세부 정보와 함께 405 ERR_VALIDATION_INPUT 오류를 반환합니다. 테스트는 성공 응답, Allow: GET, 표준 헤더, 추적 ID 및 오류 본문을 검증합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 /health 메서드 계약 변경을 명확히 나타내며 변경 내용의 주요 목적과 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/health-method-contract-current-main-v2

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as ready for review August 12, 2026 04:47
@seonghobae
seonghobae merged commit c1b0d11 into main Aug 12, 2026
15 of 16 checks passed
@seonghobae
seonghobae deleted the fix/health-method-contract-current-main-v2 branch August 12, 2026 04:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@test/health-method-contract.test.ts`:
- Around line 20-23: Update the /health contract tests to assert
success-response trace_id, x-trace-id, x-latency-ms, cache-control, and
x-content-type-options headers, comparing trace_id in the body with the
corresponding header. Extend the 405 response assertions to verify its
trace_id/header relationship and x-latency-ms, while preserving the existing
body assertions.
🪄 Autofix

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: CHILL

Plan: Pro Plus

Run ID: 1b0ca443-1f9f-4790-bf97-a674d9a27eab

📥 Commits

Reviewing files that changed from the base of the PR and between 1a8a77d and c4a92e3.

📒 Files selected for processing (2)
  • src/index.ts
  • test/health-method-contract.test.ts

Comment on lines +20 to +23
expect(await response.json()).toMatchObject({
ok: true,
data: { name: "noema" },
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

/health의 성공 및 오류 프로토콜 헤더를 모두 테스트하세요.

Line 20-23은 성공 응답의 trace_id, x-trace-id, x-latency-ms, cache-control, x-content-type-options를 확인하지 않습니다. Line 40-51은 405 응답의 x-latency-ms를 확인하지 않습니다. 이 계약이 제거되어도 현재 테스트는 통과할 수 있습니다.

성공 및 405 응답에서 본문의 trace_id와 헤더를 비교하고, 두 응답의 x-latency-ms를 검증하세요.

제안 수정
     expect(response.status).toBe(200);
-    expect(await response.json()).toMatchObject({
+    expect(response.headers.get("cache-control")).toBe("no-store");
+    expect(response.headers.get("x-content-type-options")).toBe("nosniff");
+    const traceId = response.headers.get("x-trace-id");
+    expect(traceId).toEqual(expect.any(String));
+    expect(response.headers.get("x-latency-ms")).toEqual(expect.any(String));
+    const body = await response.json() as Record<string, unknown>;
+    expect(body).toMatchObject({
       ok: true,
       data: { name: "noema" },
     });
+    expect(body.trace_id).toBe(traceId);
...
       const traceId = response.headers.get("x-trace-id");
       expect(traceId).toEqual(expect.any(String));
+      expect(response.headers.get("x-latency-ms")).toEqual(expect.any(String));

As per coding guidelines, test/**/*.ts must preserve assertions covering protocol contracts.

Also applies to: 40-51

🤖 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 `@test/health-method-contract.test.ts` around lines 20 - 23, Update the /health
contract tests to assert success-response trace_id, x-trace-id, x-latency-ms,
cache-control, and x-content-type-options headers, comparing trace_id in the
body with the corresponding header. Extend the 405 response assertions to verify
its trace_id/header relationship and x-latency-ms, while preserving the existing
body assertions.

Source: Coding guidelines

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