feat(authoring): ADVISORY-D6 nested-function complexity displacement …#152
Merged
Yuu6798 merged 3 commits intoJun 12, 2026
Merged
Conversation
…detector (D6 closure) dogfooding_findings_tracker D6 (2026-05-28 real-PR pass FINDING-F1) を candidate path (a) で解決する。complexity extractor は nested def 境界で descent を停止する (api_surface parity) ため、関数本体を nested helper に 押し込む refactor は実複雑度不変のまま cyclomatic/cognitive の大幅減を報告 し、complexity_delta lock が vacuous PASS する (D4 の sibling)。 - authoring/nested_defs.py 新設: count_nested_defs (関数内 nested def の 決定論カウント、syntax error は None で fail-silent) + NestedDefGrowth - hazards.py detect_d6: verdict 参加 complexity_delta 制約 × in-scope Python diff の nested-def 増加で発火。canonical order は D4 の直後 - target-doctor: _resolve_files_touched を _resolve_diff_context に再構成し D4/D6 が同一 numstat pass を共有。両 rev の blob を git_runtime.blob_text (新設) で読み、追加/削除ファイルは欠側 0、parse 不能 entry は skip - advisory surface 契約は不変: severity=info 固定、verdict / exit code 非参与、 --baseline-rev/--candidate-rev 未指定 + git 不在時は silent skip - docs: target_yaml_guide Hazard 4 新設、cli_usage / json_schema / exit_codes / doctor_advisory.schema.json に D6 追記、tracker D6 行を 解決 (7/8) に更新 + D8 行へ PR #151 番号追記 (2026-06-11 申し送り) - tests: nested_defs 単体 12 件 + detect_d6 9 件 + CLI git 統合 5 件 (displacement 発火 / 制約なし沈黙 / 増加なし沈黙 / syntax error skip / 新規ファイル 0 起点)。全 1789 件 pass / ruff clean https://claude.ai/code/session_01BtUNrsnRygJY52xAy5bFRw
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 836d8ccf46
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review P2: --package-root 境界を跨ぐ rename で scope 外の側から nested-def 数を読むと、新たに in-scope 化したファイル (例 lib/helpers.py → src/helpers.py) が N → N に見えて D6 を見逃す。extractor は scope 外を 観測しないため、scope 外の側は欠側と同じく 0 として growth を計算する。 into-scope / out-of-scope rename の両方向を CLI 統合テストに encode。 https://claude.ai/code/session_01BtUNrsnRygJY52xAy5bFRw
Yuu6798
pushed a commit
that referenced
this pull request
Jun 12, 2026
Codex review P2 対応: compatibility policy (docs/json_schema.md) は使用中 envelope の enum 値追加に schema version bump を要求する。advisory-1 の advisories[].code enum へ in-place 追加していた ADVISORY-D6 (PR #152、 未リリース main 上) / ADVISORY-D7 を advisory-2 として発行し直す。 producer 定数 / schema const / cli help / docs (json_schema 本文 + version 履歴表に v1→v2 diff 行) / test assert を同時更新 (tests/discipline/test_json_schema_version_sync.py が producer↔docs 同期を enforce)。 https://claude.ai/code/session_01BtUNrsnRygJY52xAy5bFRw
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.
Completion Summary: D6-closure (ADVISORY-D6)
Phase
D-class closure (残 D6/D7、
STATUS.md 次の発行順序/ ROADMAP v0.1.0 exit criteria 前進)。docs/dogfooding_findings_tracker.mdD6 = 2026-05-28 real-PR complexity dogfood FINDING-F1。What Changed
authoring/nested_defs.py新設:count_nested_defs(関数内 nested def の決定論カウント、syntax error はNoneで fail-silent)+NestedDefGrowthrecordhazards.py::detect_d6新設: verdict 参加のcomplexity_delta制約 × in-scope Python diff の nested-def 増加で発火。canonical order は D4 の直後(D1 → D3 → D4 → D6 → I1 → P1 → P2 → S1)target-doctor:_resolve_files_touchedを_resolve_diff_contextに再構成し、D4/D6 が同一 numstat pass を共有。両 rev の blob は新設git_runtime.blob_textで読み出し(追加/削除ファイルは欠側 0、parse 不能 entry は skip)target_yaml_guide.mdHazard 4 新設、cli_usage.md/json_schema.md/exit_codes.md/doctor_advisory.schema.jsonに D6 追記、tracker D6 行を解決(D-class 7/8)+ D8 行へ PR fix(ssp): recognise PEP 621 / lockfile dependency sources in pip-audit scan (D8) #151 番号追記(2026-06-11 申し送り消化)Acceptance Criteria Status
Advisory.__post_init__+ 既存 exit-code テスト群で担保files_touched契約の鏡像)Tests
tests/authoring/test_nested_defs.py12 件 /test_hazards.pydetect_d6 9 件 /tests/cli/test_target_doctor.pygit 統合 5 件(displacement 発火 / 制約なし沈黙 / 増加なし沈黙 / syntax error skip / 新規ファイル 0 起点)ruff check .cleanDogfooding
processの本体を_collectnested helper へ移動)を作成し、semantic-ci check --target target.yaml --package-root src --baseline-rev <sha>とsemantic-ci target-doctor --target target.yaml --package-root src --baseline-rev <sha> --candidate-rev HEAD --format humanを実走checkは PASS(= D6 の騙しが verdict を通過する fail 面の実証)、同一 rev ペアでtarget-doctorがADVISORY-D6を発火し evidence(nested_defs_added: 1,files: [src/mod.py 0→1])を提示(pass 面)。fail+pass 両方実演パターンに準拠Files Changed
16 files changed, +694 −49(新規:
authoring/nested_defs.py,tests/authoring/test_nested_defs.py)Deviations from Brief
事前 brief なし(session 内で user が D6 closure を選択、tracker の candidate path (a) を逐語実装)。path (b)(extractor が nested entry を emit する spec 変更)は schema-impacting のため不採用のまま tracker に長期 option として残置。
Open Questions / Deferred
Next Handoff
merge 後: STATUS.md 次の発行順序から D6 を sweep し 直近 merged へ(wrap-up 時)。残 D-class は D7 のみ。
https://claude.ai/code/session_01BtUNrsnRygJY52xAy5bFRw