receiver: ルーティングを宣言的 route table + auth policy に置換する (#43 PR-1) - #102
Merged
Conversation
手続き的 if 連鎖で認証適用を 4 分岐に手で反復していたルーティングを、
{ method, pattern, auth, handler } のルート表 + 一元 dispatch に置き換える。
#43/#44 で認証種別が operation / inbox / ingest に増える前の準備で、
挙動同一の純リファクタ。
- 各ルートが auth 種別を宣言し、dispatch が一箇所で適用(宣言漏れは起動時 throw)
- 既知 path への未対応 method は 404 → 405 + Allow ヘッダー(監査指摘。唯一の意図した挙動変更)
- OPTIONS 204・rate limit の適用順・404 文言・認証対象 endpoint は不変
- テスト 94 → 96 件(405 の固定/パラメータ付き path、404 回帰)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TZtNiToBjzkwFc2A6Mw7n4
Owner
Author
🔍 レビュー依頼(→ Codex)
|
Owner
Author
📋 レビュー結果(by Codex GPT-5.5)判定: ✅ merge 可(must 0 件) — 🟡 should / ⚪ nit も 0 件 🔴 mustなし 🟡 shouldなし ⚪ nitなし レビュアーのコメント(要旨): route table 化による auth 適用対象・path match 範囲・ 補足(依頼元): Codex 側 sandbox(read-only)では |
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.
概要
#43 完了スライスの PR-1(2 PR 構成の 1 本目)。手続き的 if 連鎖だったルーティングを宣言的なルート表 + 一元 dispatch に置き換える挙動同一の純リファクタです。設計の経緯は #43 の設計コメント(2026-07-05)を参照。
変更内容
{ method, pattern, auth, handler }を導入し、認証適用(従来 4 分岐に手で反復)を dispatch の一箇所に集約none/operationの 2 種。未知の種別はモジュールロード時に throw(宣言漏れ・typo の fail-fast)。公開デプロイ時の receiver ハードニング(認証・CORS 制限) #43 PR-2 / Widget→Receiver 取り込みのペア認証と受信データの安全な取り扱い #44 でinbox/ingestと per-route CORS がここに増えるAllowヘッダー(監査指摘の解消)テスト
npm run check)レビュー観点
挙動同一性(特に認証の適用対象がリファクタ前後で一致しているか)と、405 導入による副作用の見落としがないか。
Closes しない(#43 は PR-2 完了まで open 維持)
🤖 Generated with Claude Code
https://claude.ai/code/session_01TZtNiToBjzkwFc2A6Mw7n4