fix(verify): fast モードで PoSW 未検証を明示し整合性を proven にしない - #253
Merged
Conversation
`fast` モードは PoSW の反復再計算をスキップする (spec §8.2) のに、web も CLI も 決定的保証の語彙 (「検証成功 / 整合性: 証明済み」「Verification PASSED / Integrity: PROVEN」) で結果を出していた。採点者が fast のまま複数の提出物を流すと 全件が「証明済み」に見える overclaim になる。 - shared: `IntegrityLevel` に `partial` を追加し、`AssuranceInput.poswSkipped` (必須。optional にすると渡し忘れが overclaim に倒れる) から fast を proven に 上げないよう `deriveAssurance` を変更。temporal / provenance の意味は不変 - verify (web): 整合性チップを warning 表示 (専用の説明ツールチップ)、 `TrustCalculator` に `posw` の warning issue、タブ status も警告に揃える - verify-cli: 合否ヘッダ直下と `--- Assurance ---` に PoSW 未再計算を明記 - 判定 (`verifyProofFile` の valid / exit code) と proof フォーマットは不変。 fast は「速い改ざん検出」という正当な用途を持つため fail させない - web↔CLI の一致は `webCliParity.test.ts` に fast / full の観点を追加して固定 Closes #214 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🚀 Preview Deployment
Deployed from commit 708325a |
ADR-0020 は整合性を「決定的・二値 (proven/failed)」と定義していたが、これは 「検証器は常に全レイヤを実行する」という暗黙の前提に立っていた。実際には fast モードが PoSW の反復再計算を省略するため、二値のままでは overclaim (省略した のに proven) か誤った改ざん告発 (failed) のどちらかになる。 省略した検査があるときは proven に上げない、という規則を ADR-0031 として残し、 ADR-0020 の Status に参照を付けた (原典を読んだ人が古い値域を信じないため)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
目的
fastモードは PoSW の反復再計算をスキップする (docs/system-spec.md §8.2) が、verify (web) も verify-cli も 決定的保証を意味する語彙で結果を出していた。TrustCalculator.calculateがposwModeを見ないため issue 0 件 → 「検証成功」。deriveAssuranceの入力にも PoSW 情報が無いため 整合性: 証明済みSKIPPED (fast mode)は出るが、ヘッダは✓ Verification PASSED/Integrity: PROVENverify の ActivityBar のモードトグルは
fast → audit → fullを巡回するため、採点者が fast のまま複数の提出物を流すと**全件が「検証成功・整合性: 証明済み」**になる。実際に保証されているのは「申告 PoSW 値が proof 全体とハッシュ的に一貫していること」までで、「実際に 10,000 回反復したか」は未検証。Closes #214
変更点
shared (
assurance.ts)IntegrityLevelにpartialを追加 ('proven' | 'partial' | 'failed')。「実施していない検査がある」の意で、改ざんの疑い (failed) とは別AssuranceInputにposwSkipped: booleanを追加。optional にしていない — 渡し忘れが「未検証なのに proven」= overclaim に倒れるため (検証側は常に自分のモードを知っており「不明」という状態は存在しない)failed>partial>provenの順。改ざん検出は fast でも成立するのでfailedが優先。temporal / provenance の意味は一切変えていないverify (web)
buildAssuranceInputがposwSkipped(=poswMode === 'skipped') を渡すTrustCalculatorにposwの warning issue (既に用意されていたgetComponentLabelのposwラベルを活用)VerificationController.handleCompleteのタブ status も warning 軸に合流 (ここを揃えないと「タブは緑なのにバッジは警告」になり fast のまま流した提出物が全件緑で素通りする)warning色 + 専用の説明ツールチップで表示verify-cli
! fast mode: PoSW was NOT recomputed — sequential work is unverifiedを追加--- Assurance ---の Integrity をPARTIAL(黄) + 2 行の説明不変に保ったもの
verifyProofFileのvalid判定・exit code・proof フォーマットは変更なし。fast は「速い改ざん検出」という正当な用途を持つので fail させないdocs / i18n
docs/system-spec.md§8.2 に表示規約を追記 + 変更履歴に 1 行types.tsを同時更新 (trust.issuePoswSkipped/assurance.integrityPartial/assurance.integrityPartialHint)確認方法
先に失敗する再現テストを書き、赤を確認してから修正しています。
packages/shared/src/__tests__/assurance.test.ts: fast 相当入力でpartial/ 改ざん時はfailed優先 / full はproven/ temporal・provenance 不変packages/verify/src/services/__tests__/TrustCalculator.test.ts: fast でposwwarning + levelpartial、full では issue なしpackages/verify/src/ui/__tests__/ResultPanel.test.ts: 整合性チップが success ではなく warningpackages/verify-cli/src/__tests__/output.test.ts(新規): ヘッダ注記 /Integrity: PARTIAL/ full はPROVENのまま / 実失敗時はFAILEDpackages/verify/src/services/__tests__/webCliParity.test.ts: fast / full の観点を追加。既存ケースは fast 経路なので期待値を更新し、新ケースは実 PoSW を計算する Worker スタブで「fast は partial・full は proven」を web↔CLI 両経路で突き合わせるミューテーション確認 (一時的に実装を壊して赤を確認):
deriveAssuranceのpartial分岐を戻す → パリティ 3 件が赤poswSkipped: false固定にする → パリティ 9 件が赤 (片側だけ直すと落ちる)ローカルで全て green:
補足 (レビュー観点)
ADR-0020 は整合性を「二値 (proven/failed)」と記述しているため、
partialの追加で ADR と実装がずれます。ADR は append-only 運用のため本 PR では書き換えず、追補 ADR を切るかどうかは別途判断をお願いします (spec §8.2 と変更履歴には反映済み)。🤖 Generated with Claude Code