Repository navigation
fix(create-issue): create_issue_txn.py の hard predecessor 起票時の dependency 方向逆登録バグを修正する - #1949
Conversation
…ency 方向逆登録バグを修正する --blocking を --blocked-by(--dependency は legacy alias)とは別 destination として追加し、 role-fixed な addBlockedBy primitive で両方向の GraphQL mutation・厳密な集合一致 readback・ 非正整数/重複/自己参照/cross-repo の事前拒否・dedupe/reconcile/partial-failure/recovery-hint の 双方向対応を実装する。SKILL.md に --blocked-by/--blocking の正式名称化と legacy alias 明記を追加し、 disposable issue 2件を使う live canary スクリプトを追加する。 Closes #1946 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-1949/ The preview will be removed when this PR is closed. |
…ue_body.py の必須セクションに準拠させる live_canary_blocking_direction.sh (#1946 AC8) を実行したところ、predecessor Issue A の body が create_issue_txn.py の issue-body-validate 段(Blocker 2.5、--issue-kind 省略時の fallback 必須セクション: Acceptance Criteria/Verification Commands/Allowed Paths)を満たさず status=failure で 落ちていた(依存関係方向の再現より前で失敗しており、#1943/#1842 の reversal バグとは無関係)。disposable body に最小限の該当セクションを追加し、 実際に disposable Issue A(#1955)/B(#1954) を作成して双方向検証・relationship 削除・A/B close までの live canary を PASS で完走させた(証跡: artifacts/1946/issue-metadata/live_canary_blocking_direction/20260802T023254Z.log)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
AC8 live canary 実行結果(fix_delta 対応)pr-reviewer の REQUEST_CHANGES(AC8 証跡未提出)に対応し、 実行環境 preflight
発見した問題と修正1回目の実行は
2回目の実行結果: PASS
artifact
既存 AC への影響
|
判定REQUEST_CHANGES。現状ではマージ不可です。
また、live canary の happy path は実行済みで、方向確認・relationship削除が成功したと報告され、使い捨て Issue #1954/#1955 が閉じられていることも確認できました。 ただし、Issue #1946 が明示的に要求する dedupe・reconcile・partial-failure・cleanup の契約に未達があります。 指摘事項P0-1: dedupe 経路は relationship を「収束」させず、readback するだけ
これは #1946 のレビューで明示された「dedupeされた既存 Issue に blocking 関係を収束させられない」という阻害条件が、そのまま残っている状態です。 テストも偽陽性です。dedupe 部分では 修正方針
P0-2: reconcile は非正整数を mutation 前に拒否できない
その後すぐ labels を再適用するため、例えば 修正方針
normalized_dependency_issue_numbers = _normalize_dependency_numbers(
dependency_issue_numbers,
label="--blocked-by",
)
normalized_blocking_issue_numbers = _normalize_dependency_numbers(
blocking_issue_numbers,
label="--blocking",
)
_validate_dependency_directions(
normalized_dependency_issue_numbers,
normalized_blocking_issue_numbers,
self_issue_number=issue_number,
)テストは P1-1: canary は cleanup 失敗時にも exit 0 を返す
Bash の さらに、relationship mutation 後の readback 失敗などで transaction が 修正例 _cleanup() {
local status=$?
trap - EXIT
# 両 Issue 番号が分かる場合は、transaction status に依存せず
# 現在の relationship を readback して存在時だけ削除する。
if [ "${CLEANUP_FAILED}" = "1" ]; then
status=1
fi
exit "${status}"
}cleanup 後にも両方向を readbackし、relationship が消えたことまで確認してください。 P1-2: partial_failure が既に検証済みの方向を
|
…ck bugs Owner REQUEST_CHANGES (PR #1949) fix_delta for Issue #1946: - P0-1: dedupe path (_reconcile_issue_links) only read back --blocked-by/ --blocking, never mutated a missing link. Extracted a shared _apply_relationship_direction() diff-apply/readback helper (used by create/dedupe/reconcile alike) that computes the diff against the current relationship state and mutates only what's missing. - P0-2: reconcile_transaction validated direction/self-reference but never normalized (0/negative/bool/cross-repo URL) before mutating labels/parent. Normalize now runs first, before any GitHub operation. - P1-1: live_canary_blocking_direction.sh's cleanup only removed the relationship when RELATIONSHIP_REGISTERED="yes" and never changed the exit code on cleanup failure. Cleanup now always reads back the current relationship independently and forces exit 1 on any cleanup failure. - P1-2: run_transaction's exception handler hardcoded parent_verified/ dependency_verified/blocking_verified to None regardless of actual progress. These are now tracked outside the try block and passed through faithfully. - P1-3: _target_blockedby_contains only fetched one page (first:100) with no cursor traversal, and null `issue` payloads raised AttributeError instead of a structured failure. Added _paginated_relationship_numbers() (full cursor pagination + null-issue handling) and rewired the target-side cross-check onto it. Added regression tests for all of the above (dedupe missing-link mutation, reconcile invalid-input rejection, dependency_verified/blocking_verified independence, >100-item pagination, null-issue structured failure, and live_canary cleanup exit-code/leftover-relationship discovery via bash -c harnesses in test_create_issue_txn_blocking.py, staying within this Issue's Allowed Paths instead of adding a new test file). Fixed a real bug found only by the live canary (AC8): a brace-escaping mismatch (f-string {{ }} mixed with plain-string literal braces) in the new pagination query produced invalid GraphQL that gh rejected, silently downgrading every --blocking readback to partial_failure. Co-Authored-By: Claude Sonnet 5 <[email protected]>
概要
create_issue_txn.pyの create parser に--blocking(新規Issueが既存Issueをブロックする方向、前提Issue/hard predecessor起票用)を、--blocked-by(--dependencyを後方互換 alias として吸収)とは別 destination で追加した。reconcile parser にも--blockingを追加した。役割を名前で固定する GraphQL
addBlockedByprimitive(blocked_issue_node_id=/blocking_issue_node_id=の keyword-only 引数)を実装し、両方向で同一 mutation query を呼び出す。方向反転の原因になったdirection=型の汎用フラグは採用していない。非正整数(
0・負数・bool)、重複 issue number、同一 issue を blocked-by と blocking の両方に指定、dedupe/reconcile 対象 issue 自身の指定、cross-repository URL を、mutation 実行前に reject する。readback を方向別に厳密化した(
pageInfo.hasNextPage/totalCount込みの集合完全一致)。--blocking方向はさらに、各 blocking target 側のblockedByに新規Issueが実在することを target-side cross-check する。create・dedupe(
_reconcile_issue_links)・reconcile(reconcile_transaction)・partial-failure audit comment・recovery hint の全経路を双方向対応させた。TransactionResultにblocking_verifiedフィールドを追加し(既存dependency_verifiedは blocked-by 方向として維持)、failed_readbacksにdirection/expected_issue_numbersを追加した。_issue_createへ公式 CLI の--blocked-by/--blockingフラグを転送しないことを回帰テストし、design rationale(deferred/parallel semantics による receipt-loss リスク)をコード内コメントに明記した。AC7: hard-predecessor producer/caller inventory を確認した。
materialize_child_issues.pyは既にdepends_onを正しい blocked-by 方向(--blocked-by/--dependency)に写像しており、blocking 方向の配線が必要な自動 caller は現時点で存在しない。producer は直接 CLI 起票(人間/エージェント運用)のみであり、SKILL.md ガイダンス整備で対応済みのため follow-up hard-successor Issue の起票は不要と判断した。AC8: disposable Issue 2件(target B・predecessor A を
--blocking Bで作成)を使う live canary スクリプトlive_canary_blocking_direction.shを追加し、実際に live 実行して PASS(exit 0)を確認済み(詳細は下記「Owner レビュー対応」参照)。SKILL.mdの該当箇所(helper 引数説明・depends_on写像・Depends on #N節・Blocker/Blocked-by 設定手順)に--blocked-by/--blockingを正式名称、--dependencyを legacy alias として追記し、--blockingの設定方法・検証コマンドの節を新設した。新規テストファイル
test_create_issue_txn_blocking.py(Issue の Verification Commands に一致するノードID)を追加し、既存test_create_issue_txn.pyの回帰も維持している。Closes #1946(本 Issue をクローズする)
Owner レビュー対応(REQUEST_CHANGES への fix_delta)
Owner から本 PR へ直接投稿された REQUEST_CHANGES レビュー(issuecomment-5154804485)に基づき、以下を追加修正した(コミット
05e0397e)。_reconcile_issue_links)は従来--blocked-by/--blockingの readback しか呼んでおらず、リンクが欠けていても mutation を実行していなかった。create・dedupe・reconcile が共有する_apply_relationship_direction()helper を新設し、現在値との差分を計算して不足分のみ mutation するよう修正した。reconcile_transaction()は方向間重複・自己参照のみ検証し、_normalize_dependency_numbers()(0・負数・bool・URL の拒否)を通していなかった。label/parent mutation より前に normalize を実行するよう修正した。live_canary_blocking_direction.shの_cleanup()は失敗時にCLEANUP_FAILED=1を記録するだけで終了コードを変えていなかった。cleanup 失敗時は明示的にexit 1するよう修正し、RELATIONSHIP_REGISTEREDの値に依存せず現在の relationship 状態を毎回 readback してから削除するよう変更した。run_transaction()の例外ハンドラはparent_verified/dependency_verified/blocking_verifiedを常にNoneで返しており、--blocked-by成功後に--blockingが失敗しても両方がnullになっていた。try ブロック外で状態を初期化し進行に応じて更新するよう修正し、例外ハンドラへ実際の値を渡すようにした。_target_blockedby_contains()はfirst:100のみ取得しページングせず、issue: nullをAttributeErrorで落としていた。全ページ traversal を行う_paginated_relationship_numbers()を新設し、target-side cross-check をこの primitive 上に再構築した。この過程で、新規追加した pagination query 自体に f-string の{{ }}エスケープと通常文字列のリテラル{}を混在させたブレース不整合バグがあり、gh CLI が GraphQL 構文エラーを返して--blockingの readback が常にpartial_failureに落ちる実バグを live canary 実行で発見・修正した(ユニットテストはrun_commandを mock するため発見できなかった)。対応する追加テスト 7 本を
test_create_issue_txn_blocking.pyへ実装した(dedupe missing-link mutation・reconcile invalid-input rejection・dependency_verified/blocking_verified独立性・101件超の pagination・issue: nullの構造化失敗・live canary cleanup の exit code / leftover relationship discovery)。live canary の cleanup テストは Allowed Paths 外へ新規ファイルを追加せず、test_create_issue_txn_blocking.pyからbash -c経由でlive_canary_blocking_direction.shをLIVE_CANARY_TEST_MODE=1でソースする方式にした。修正後、live canary(AC8)を disposable Issue(#1969/#1970)で再実行し、PASS(exit 0)・relationship 削除・両 Issue の close を実機で確認済み。
Test plan(検証手順)
uv run --locked pytest .claude/skills/create-issue/tests/test_create_issue_txn_blocking.py -v(16 passed)uv run --locked pytest .claude/skills/create-issue/tests/test_create_issue_txn.py -v(129 passed、回帰なし)rg -n "hard-successor"/rg -n "legacy alias"(AC7/AC9 該当文字列存在確認)test -f live_canary_blocking_direction.sh(AC8 baseline-expect: fail の存在確認)bash live_canary_blocking_direction.shを実際に live 実行し、PASS(exit 0)・disposable Issue([disposable-canary] blocking direction target B 20260802T032458Z #1969/[disposable-canary] blocking direction predecessor A 20260802T032458Z #1970)の relationship 削除・close まで確認済み