receiver: graceful shutdown・/healthz・実効設定サマリを追加する (#99) - #104
Merged
Conversation
アーキテクチャレビュー F-2 / F-3 の運用ハードニング。 - SIGTERM / SIGINT で graceful shutdown: server.close() で新規接続を 止めて in-flight リクエストの完了を待ち、store.close() 後に exit 0。 ハング対策に 10 秒の drain deadline(unref なので正常終了は遅延しない) - GET /healthz を追加: store 疎通(count)込みで 200、draining 中と store 異常時は 503。認証不要(liveness しか返さない)・rate limit 対象外(route table の rateLimit: false 宣言。厳しい制限設定でも ヘルスチェックがフラップしない)。404/405 を含む他のパスは従来通り rate limit の対象 - 数値系設定の不正値(非数値・上限系の 0/負/小数)は fallback 時に 「ignored invalid setting <名前>」を起動ログに警告し、実効値を limits: / rate limit: のサマリ行で出力(secret 値は出さない) Closes #99 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau
Owner
Author
🔍 レビュー依頼(→ Codex)
|
- SIGTERM/SIGINT ハンドラをモジュールロード時(async startup 前)に登録。 legacy migration や screenshot scan 中の停止でも graceful に drain する (Codex レビュー 🔴)。server 未 listen・store 未初期化でも安全に畳む - MAX_BODY_BYTES / SCREENSHOT_MAX_BYTES を positiveIntSetting に変更。 0/負は POST を全部壊す誤設定なので警告 + fallback(Codex レビュー 🟡、 README の記述とも一致) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau
Owner
Author
📋 レビュー結果(by Codex GPT-5.5)初回判定: ⛔ 要対応(must 1 件)→ 対応後の再レビューで ✅ merge 可(must 0 件) 🔴 must(→ fa64807 で対応済み、再レビューで解消確認)
🟡 should(→ fa64807 で対応済み)
⚪ nit
再レビュー(fa64807)✅ 解消確認: 二重シグナルの idempotent 抑止 / 未 listen 検証範囲(要旨)diff と receive.js / store.js / テスト / 両 README の静的突き合わせ。dispatch の 404/405/401 rate limit・OPTIONS/CORS 順序・healthz の auth/rateLimit 免除は目的通り。sandbox 制約によりテスト実行は依頼元がローカル代替( |
kosako
marked this pull request as ready for review
July 5, 2026 11:55
kosako
added a commit
that referenced
this pull request
Jul 5, 2026
#103(inbox ログイン + CORS 制限)・#104(healthz / graceful shutdown / 設定警告)・#106(ingest key)で README.md に入れた receiver 契約の変更を 英語版にミラーする: - RECEIVER_TOKEN の説明を「閲覧系も保護 + inbox ログイン(HMAC cookie)」に更新 - INGEST_KEYS / ALLOWED_ORIGINS の項目を追加 - healthz・graceful shutdown・invalid setting warning を追記 - Public Deployment (EC2 etc.) 節を新設 - Init options に ingestKey を追加、Current Boundary の Auth 行を更新 Closes #105 Claude-Session: https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
概要
Issue #99(receiver 運用ハードニング)。アーキテクチャレビュー(2026-07-02)の F-2 / F-3 に対応し、公開デプロイ(systemd / ALB 配下)の最低要件を揃えます。
変更内容
graceful shutdown(F-2)
server.close()→ in-flight リクエストの完了を待つ →store.close()→ exit 0/healthzは 503(draining)を返すGET /healthz(F-2)
count())込みで 200 / 異常時 503rateLimit: falseを宣言。厳しいRATE_LIMIT_MAX設定でもヘルスチェックがフラップしない。404/405 を含む他の全パスは従来通り rate limit の対象(スキャン flood は引き続き数える)実効設定サマリ + 不正値の警告(F-3)
numberSetting/positiveIntSettingにラベルを渡し、不正値の silent fallback 時にignored invalid setting MAX_IMPORT_ITEMS (env): "0" — using 500形式で警告limits:(body/screenshot/disk/count/importItems/fieldLength/arrayLength/objectDepth)とrate limit:(req/window/maxClients/trustProxy)の実効値を 1 ブロック出力。secret 値は出さない受け入れ条件との対応
/healthzが 200 / 異常時に非 200(認証: 不要、rate limit: 対象外と決定)テスト
npm run check全 103 件パス(新規 3 件: healthz + rate limit 免除 / SIGTERM drain の in-flight 完了 / 設定警告 + サマリ)。実機スモーク済み(不正 env → 警告 + サマリ出力、healthz 200、SIGTERM → draining ログ + exit 0)。Closes #99
🤖 Generated with Claude Code
https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau