← Back to Pull requests

[FEAT] aw-docs: T14: 日英state-recovery文書と受け入れ基準の照合 #1168

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 02, 2026 05:32 UTC
Author

概要 (Pull Request Description)

関連Issue番号


Refs #1106, Closes #1136

受け入れ条件とスコープガード (Acceptance Criteria & Scope Guard)


  • #1106の受け入れ基準をT01〜T13の証拠に対応付け、文書に未実装の状態/例外を記載しない。

  • 最終のライフサイクル優先表・owner表・JSONはflat不変・旧形式の扱いを日英同期する。

  • handoff候補と検証済みreceiptの違い、consistency projection、immutable payloadの扱いを明記する。

  • 各PR単独でLinux ./scripts/local-ci.shを成功させる。

  • 永続JSON・ロック・外部副作用・claim/completion/GCの挙動を変更しない。

  • スコープガード (YAGNI): 今回のIssue目的を超えた過剰な自動復旧機構や、投機的な追加機能を含んでいない
  • 変更内容 (Walkthrough)

    1. 日英 state-recovery.md への Section 6 追加・同期


  • docs/ja/architecture/state-recovery.md および docs/en/architecture/state-recovery.md に Section 6(active-worktree-lifecycle アンカー)を新設し、以下を網羅・同期しました:

  • - サブレコード分割と不変構造: core(共通)、launch(起動・モデル)、claim(所有権)、completion(完了記録)の4つがメモリ上の唯一の正本(slots=True、フラット属性廃止)。
    - 深層不変性とイミュータブルペイロード: completion_payload および completion_policy_config の MappingProxyType 深層不変化と破壊的操作拒絶。
    - 永続JSONのflat不変性と後方互換性: 35フィールドのフラット構造、フィールド順序、null時省略の維持。schema_version 不導入。active_codec による双方向変換。
    - ライフサイクル優先順位(ActiveWorktreeLifecycle): HANDOFF_READY > COMPLETING > RUNNING > LAUNCHING > RECOVERY_REQUIRED > CLAIMED > RESERVED の評価順と各条件。
    - Handoff候補と検証済みReceiptの違い: 候補段階と、CompletionReceipt を発行する authoritative な検証(Issueコメント・PR・dirty hold)の分離。
    - 整合性プロジェクション: consistency カーネルへの疎結合な ExecutionRecord 射影。
    - 所有者境界とASTガード: 各所有者モジュールの限定と静的検査。
    - 親Epic #1106 受け入れ基準とT01〜T13検証証拠の照合表: 全受け入れ基準の実装タスクおよびテストスイート対比。
  • 英語ドキュメントに、日本語版と対応するローカルclaim復旧(orchestune recover)の解説を追加。
  • 2. 日英 architecture.md の記述更新


  • docs/ja/architecture.md および docs/en/architecture.md のセクション 4.1(共有実行台帳と所有権契約)において、T12カットオーバー後のメモリ正本構造(core + 3 frozen subrecords)、所有者モジュール(complete.journal を含む)、および state-recovery.md#active-worktree-lifecycle への相互リンクを更新・同期。
  • 3. 機械的ドキュメントテストの拡充


  • tests/test_dependency_architecture_docs.py に active-worktree-lifecycle アンカー、共有語彙・日英proseの契約検査、シンボル存在検証、およびライフサイクル契約ミューテーションテスト(test_each_lifecycle_guarantee_is_required)を追加。
  • Reconciled Impact Scope Table


    | Reference / Target | Status | Rationale |
    | :--- | :--- | :--- |
    | docs/ja/architecture/state-recovery.md | done | セクション 6 を追加し、サブレコード構造、ライフサイクル優先表、flat JSON 不変性、handoff vs receipt、consistency projection、immutable payload、および #1106 受け入れ基準照合表を記載。 |
    | docs/en/architecture/state-recovery.md | done | docs/ja/architecture/state-recovery.md と同等の内容を Section 6 として日英同期。 |
    | docs/ja/architecture.md | done | セクション 4.1 の記述をカットオーバー後のメモリ正本構造に改訂し、所有者境界と state-recovery.md への相互リンクを追加。 |
    | docs/en/architecture.md | done | docs/ja/architecture.md と同等の内容を日英同期。 |
    | tests/test_dependency_architecture_docs.py | done | active-worktree-lifecycle アンカー、セクション契約、シンボル存在テスト、およびライフサイクルミューテーションテストを追加。 |
    | orchestune/ledger/active_lifecycle.py | still out of scope | 既存実装は固定・完了しており変更不要。 |
    | orchestune/ledger/active_records.py | still out of scope | 既存実装は固定・完了しており変更不要。 |
    | orchestune/ledger/active_codec.py | still out of scope | 既存実装は固定・完了しており変更不要。 |
    | orchestune/ledger/run_state.py | still out of scope | 既存実装は固定・完了しており変更不要。 |
    | orchestune/dispatch/launch_state.py | still out of scope | launch 所有者 API は固定・完了しており変更不要。 |
    | orchestune/claim/ownership.py | still out of scope | claim 所有者 API は固定・完了しており変更不要。 |
    | orchestune/complete/journal.py | still out of scope | completion 所有者 API は固定・完了しており変更不要。 |
    | tests/test_active_worktree_ownership_architecture.py | still out of scope | AST ガードテストは固定・完了しており変更不要。 |

    ---

    品質管理 & テスト結果

    ローカルCI実行結果


  • Ruff による自動フォーマット/Lintチェックに合格したか?

  • Mypy による型チェックに合格したか?

  • Pytest のすべてのテストに合格したか? (5198 passed, 22 skipped)

  • テストカバレッジが90%以上(合格基準)に達しているか?(カバレッジ結果: 93.24%)
  • 再現手順と修正確認(バグ修正の場合)


  • 再現テスト: 該当なし(ドキュメント・テスト契約追加)

  • 修正前 (Red): tests/test_dependency_architecture_docs.py にライフサイクル新契約がなく未検査だった。

  • 修正後 (Green): 26 passed(日英両ドキュメントの契約、アンカー、リンク、シンボル、ミューテーション耐性を検証)。
  • ベースライン差分(Baseline-aware Test Evaluation)


  • 新規のリグレッションテスト失敗は存在しない。

  • 既存の未解決失敗テスト一覧 (あれば記載): なし
  • ---

    #822 Observation Record


    | Field | Value / evidence |
    | :--- | :--- |
    | PR, cohort, status, inclusion/exclusion | Task Issue #1136, PR pending, cohort 2026-10, status: in-progress |
    | Environment, tool/version, actual use, fallback, index/base SHA | Linux, git grep (Serena fallback: root was main checkout without unmerged parent branch files), base SHA c625948 |
    | Preparation / update / investigation times; method; shared setup link | Preparation: 2026-10-02T05:20Z - 05:27Z; git grep and view_file; shared setup via local worktree |
    | Tokens: value, source, scope or unavailable reason | unavailable (CLI agent does not expose per-command token counters) |
    | Original scope snapshot; appended reconciliation | Preserved in https://github.com/Saltmu/orchestune/issues/1136#issuecomment-5946131508 and Walkthrough table above |
    | First requested / actual reviewed SHA; reviewer/provider/model | 876add3; reviewer: codex |
    | Initial files / additions / deletions / base; change type | 5 files; +286 / -19; base c625948; docs/test change |
    | Findings: canonical link, A–D/excluded, origin, A attribution/evidence | None yet |
    | Rounds: SHA, evidence, next-round reason | Pending round 1 |
    | Counts A/B/C/D (explicit zero only when reviewed); unresolved items | Pending review |
    | Test results / post-integration defects or not yet observed | 5198 passed, 93.24% coverage, local CI clean |

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: chatgpt-codex-connector[bot] Review duration: 5m
    All Vouch review confidence checks passed
    Residual risk 0.40 = Change Risk (0.52) × (1 − Review Confidence (0.22)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 34% · Reviewer familiarity: 35%
    22%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1168"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 22.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 22.2% · Lower = rushed or shallow review
    22.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 40.5% · Moderate risk
    40.5%