Skip to content

Add fail-closed ADR wiring verification#521

Merged
proboscis merged 4 commits into
mainfrom
issue/doeff-adr-wiring-selfcheck/run-20260714-171634
Jul 14, 2026
Merged

Add fail-closed ADR wiring verification#521
proboscis merged 4 commits into
mainfrom
issue/doeff-adr-wiring-selfcheck/run-20260714-171634

Conversation

@proboscis

@proboscis proboscis commented Jul 14, 2026

Copy link
Copy Markdown
Owner

概要

  • pytest collection 完了時に、リポジトリ全体の実行可能 ADR 候補と実際の session.items を照合する wiring 自己検査を追加しました。
  • 既定は warnstrict は未収集ファイルを列挙して非ゼロ終了します。
  • doeff-adr verify-wiring console script は下流リポジトリの CI 一行ゲートとして維持します。
  • doeff 自身では tests/test_adr_wiring_gate.py が strict collect-only を subprocess 起動し、ADR-DOE-ENFORCE-001 R1 の pytest 正典ゲートへ常時組み込みます。
  • 案C(plugin warning + CLI strict gate)の設計判断を ADR-DOE-ADR-001 として記録し、proboscis-ema / agent-control-plane の導入手順を README に追加しました。
  • Land Stage 0–2 investment plan enforcement #522 / origin/main@a5dc3eb1 を取り込み、DOMAIN-001 designed-red を xfail(strict) 相当に変更し、enforcement ledger の増加を明示記帳しました。
  • defsemgrep は Semgrep 不在時に skip せず fail-closed である現行契約を回帰テストで固定しました。

根本原因

従来の pytest_collect_file hook は pytest が既に走査対象にしたファイルしか受け取れず、testpaths や CI 引数の外にある defadr_*.hy の存在を観測できませんでした。そのため、ファイルが存在しても検査が無音で不活性化していました。

Verification 対応表

issue の Done 条件 shipped test
collection 範囲外の defadr を pytester で再現し、fail として検出する packages/doeff-adr/tests/test_wiring.py::test_strict_wiring_fails_when_defadr_is_outside_collection_scope
doeff 本体で機構を有効化し、CI で実行する tests/test_adr_wiring_gate.py::test_all_executable_adrs_are_collected_by_default_pytest_gate(ADR-DOE-ENFORCE-001 R1 の pytest 正典ゲート)
設計判断を短い ADR として記録する docs/adr/defadr_doeff_adr_001_wiring_selfcheck.hy::test_ADR_DOE_ADR_001_adr_contractdocs/adr/defadr_doeff_adr_001_wiring_selfcheck.hy::test_no_silent_off_wiring_default_defsemgrep
Semgrep executable 不在を fail-closed に保つ packages/doeff-adr/tests/test_defadr_macros.py::test_defsemgrep_fails_when_semgrep_executable_is_missing
enforcement 資産の増加を明示記帳する tests/test_enforcement_ledger.py::test_enforcement_inventory_matches_ledger

Verification deviations

issue の Done 条件「CI で実行される」は GitHub CI 無効(予算)のため pytest 正典ゲートで充足(ADR-DOE-ENFORCE-001 R1)。CLI は下流リポジトリの CI 用に維持。

実行結果

  • make sync: --features invariant-checks 付き VM 再ビルド成功
  • uv run pytest -q: 1147 passed, 86 skipped, 1 xfailed, failed 0
  • DOMAIN-001 designed-red: 未実装中の xfailed 1件として確認
  • uv run doeff-adr verify-wiring: success
  • canonical wiring gate + enforcement ledger: 2 passed
  • 変更5 Python ファイル: Ruff clean、format check clean
  • workflow: origin/main と差分なし
  • uv build --package doeff-adr: wheel / sdist success、wheel 内 console script と pytest11 entry point を確認

既知の baseline

make lint 全体は変更外の既存 Ruff findings で停止します。今回の変更 Python ファイルを対象にした Ruff と format check は green です。

Reference: doeff-adr-wiring-selfcheck

@proboscis
proboscis marked this pull request as ready for review July 14, 2026 08:51
@proboscis
proboscis merged commit 5da14d9 into main Jul 14, 2026
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