fix(verify-cli): 失敗ヘッダの矛盾と analysis bundle の integrityValid を直す (#217 #219) - #263
Merged
Merged
Conversation
#217: スクリーンショットだけが改竄された proof を検証すると、ヘッダに 「Error: All hashes verified successfully (including PoSW)」というチェーンの 成功メッセージが失敗理由として出ていた。総合 valid は screenshotsValid で false になる一方、errorMessage は shared のものを素通しするため。exam 束縛の み失敗と同型の矛盾なので、既存の examBindingFailedOnly と同じ形で screenshotsFailedOnly を足し、改竄枚数を失敗理由として出す。両方落ちたときは 両方出す。exit code の計算 (result.valid) は変えていない。 #219: --analysis-bundle の integrityValid に gate 込みの総合 valid を渡して いた。buildAnalysisBundle の契約 (ADR-0024) は「派生元 proof が整合性検証を 通ったか」であり、--require-root-anchor で落ちただけの proof が integrityValid: false かつ assurance.integrity: 'proven' という自己矛盾した レコードになっていた。assurance.integrity !== 'failed' に変える。'proven' の 完全一致にしないのは、ADR-0031 (#253) で 'partial' が入り fast モードが 'partial' になるため — 「検査を省略した」を「整合性が失敗した」に潰さない。 写像は cli.ts から純関数 toBundleIntegrityValid として verify.ts へ切り出した (cli.ts は読み込み時に main() が走りテストから import できないため)。 Closes #217 Closes #219 Assisted-by: Claude <noreply@anthropic.com>
🚀 Preview Deployment
Deployed from commit 1a9410c |
33 tasks
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.
目的
2026-08 レビュー (#243) の残件のうち、verify-cli の低コスト指摘 2 件を解消する。どちらも exit code には影響しない「読み手に嘘をつく」系。
#217 — スクショ改竄のみの失敗で矛盾したヘッダが出る
修正前 (実行して再現)
総合 valid は
screenshotsValidで false になる一方、errorMessageは shared のものを素通しするため、チェーンが健全だと成功メッセージが失敗理由として出ていた。修正後
既存の
examBindingFailedOnly分岐と同型でscreenshotsFailedOnlyを追加。exam 束縛とスクショが同時に落ちる場合 (exam proof の ZIP でスクショも改竄) は片方に潰さず両方出す。result.validの計算は変更していない — 表示のみの修正で、機械ゲート (exit 1) の挙動は不変。#219 — analysis bundle の
integrityValidが ADR-0024 の契約違反buildAnalysisBundleの契約は「派生元 proof が整合性検証を通ったか」だが、gate 込みのresult.validを渡していた。--require-root-anchorで落ちただけの proof がintegrityValid: falseかつ同じレコードのassurance.integrity: 'proven'という自己矛盾したバンドルになる。assurance.integrity !== 'failed'に変更した。=== 'proven'にしなかった理由: PR #253 (ADR-0031) でIntegrityLevelに'partial'が入り fast モードが'partial'になる。'partial'は「実施していない検査がある」であって「整合性が失敗した」ではないので、ここで false に潰すと #214 で直した overclaim の裏返し (underclaim) になる。なお Issue 本文の「採点者が集めたコホート分布が歪む」という影響記述は事実と異なることを確認した。
packages/shared/src/analysis/cohort.tsはintegrityValidを一切参照していない。実害は契約違反とレコードの誤情報に限られる。テスト可能にする小リファクタ
cli.tsは読み込み時にmain()が走るためテストから import できない。写像を純関数toBundleIntegrityValid(assurance)としてverify.tsへ切り出した (CLIVerificationResult/assuranceを組み立てている当事者で、副作用がない)。確認方法
テストを先に書き、実装前に赤くなることを実測してから仕上げた (6 failed / 21 passed → 27 passed)。
Error: All hashes verified successfullyであることを diff で確認toBundleIntegrityValidの 3 値 (proven/partial/failed→ true/true/false)is not a functionError: Hash mismatch at event 3Exam binding failed:すべて green (verify-cli は 27 tests)。
packages/verify-cli/CLAUDE.mdの該当節にも今回の判断を追記した。Closes #217
Closes #219