Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ビルド・テストサマリー — intent 260805-semi-redefine-autonomy-f(#2253)

上流入力(consumes 全数): `code-generation-plan.md`(全 7 Unit)、`code-summary.md`(全 7 Unit)

Test Strategy: **Comprehensive**(`amadeus-state.md` の `**Test Strategy**` フィールド)。測定 ref: conductor クローン HEAD `74b70f40b`。

## 1. ビルド状況と前提

- `bun install --frozen-lockfile` → `bun run build` の順で exit 0。正本(`packages/framework/core/`、`packages/framework/harness/<name>/`)から未追跡の `dist/` とセルフインストール面を再生成し、追跡ファイルは不変。
- 前提: Bun が非対話シェルの PATH 上にあること、worktree 単位で `bun install` 済みであること。formal-model-check plugin を回す場合のみ JDK 26.0.1 の固定が追加前提。
- 詳細は `build-instructions.md`。

## 2. テスト種別インベントリ

| 種別 | 生成 | 根拠 |
|---|---|---|
| unit | ✅ `unit-test-instructions.md` | 8 ファイル(認可基体・梯子・フラグ parse/apply・policy 搬送・advisory 解決・receipt) |
| integration | ✅ `integration-test-instructions.md` | 5 ファイル(梯子 runtime 貫通・フラグ分岐・policy CLI・質問 carve-out・advisory 解決) |
| security | ✅ `security-test-instructions.md` | 7 Unit すべてが `nfr-design/security-design.md` を持ち、本 intent の主題が認可そのもの。11 の境界へ trace |
| performance | ⚠️ N/A(根拠付き) | `nfr-design/` に performance 成果物ゼロ、`performance`/`性能`/`p95`/`latency` の grep 0 hit、受け入れ基準に性能閾値なし。将来この判定を覆す 3 条件を `performance-test-instructions.md` に明記 |
| E2E / 契約 / アクセシビリティ | 生成せず | 本 intent はユーザー可視 UI を追加せず、CLI 契約面は integration の `t455-semi-policy-cli` と既存 e2e 群で覆われる |

戦略名だけを根拠に検査を機械追加しない方針に従い、performance は反証可能な不存在根拠付きで N/A とした。

## 3. Unit ごとの被覆

| Unit | unit 層 | integration 層 | security trace |
|---|---|---|---|
| semi-authorization-core | t451, t452 | t453 | 認可強度の保存 / 梯子入口の単一述語化 / grant 意味論の不侵食 |
| launch-autonomy-flag | t449, t450 | t450(branch) | 昇格・緩和経路の封鎖 / 入力検証 loud fail-closed / 値の consume |
| autonomy-statusline | t448 | — | (表示面。認可判定を持たない) |
| semi-policy-carrier | t454 | t455 | decision policy 搬送の射程 |
| stop-question-carveout | — | t456 | carve-out が human-declared semi に限定されること |
| advisory-auto-resolution | t457, t459 | t458 | 受理境界の等価強度 / fail-closed 2 分岐 / 強制実行の封鎖 |
| semi-docs-revision | — | — | docs 専任(実行時挙動なし)。docs 検査は既存の doc ガード群が担う |

## 4. 実行結果(要点)

`bash tests/run-tests.sh --ci` → **exit 0 / `RESULT: PASS`**、pass **11,494** / fail **0**、819 ファイル・11,487 テスト。本 intent が追加した 13 ファイルはすべて PASS。静的ゲート(typecheck / lint / source-only / complexity)は全て exit 0。

初回 run は 4 件赤(no-silent-drop の台帳束縛)。cherry-pick で持ち込んだ main 向け台帳が本クローンの base を束縛しないことが原因で、台帳を本クローン自身の束縛へ戻して解消。実装の欠陥ではない。全経過は `build-test-results.md` §4。

advisory(formal-model-check)は ladder の run-now 裁定に従い相関付きで実行し **NOT_DETECTED**(反例なし)。`build-test-results.md` §5。

## 5. 準備状況の評価

| 面 | 判定 | 根拠 |
|---|---|---|
| build-ready | ✅ | build / typecheck / lint / source-only / complexity すべて exit 0 |
| test-ready | ✅ | full CI `RESULT: PASS`、intent 追加 13 ファイル全 PASS |
| deployment-ready | ✅(既に着地済み) | 実装は 7 PR([#2293](https://github.com/amadeus-dlc/amadeus/pull/2293) / [#2294](https://github.com/amadeus-dlc/amadeus/pull/2294) / [#2295](https://github.com/amadeus-dlc/amadeus/pull/2295) / [#2316](https://github.com/amadeus-dlc/amadeus/pull/2316) / [#2317](https://github.com/amadeus-dlc/amadeus/pull/2317) / [#2318](https://github.com/amadeus-dlc/amadeus/pull/2318) / [#2321](https://github.com/amadeus-dlc/amadeus/pull/2321))として main へマージ済み。リリースは release.yml の workflow_dispatch が唯一の経路で、本 intent はバージョン面に触れていない |

## 6. 既知の制約・申し送り

- **#2330(OPEN, bug/P1/S2)**: advisory choice store の schema 1→2 移行経路が製品に存在せず、schema 1 の live store を持つ intent の stage report が恒久ブロックされる。本 intent では machine-local store を退避して回復した(人間裁定は audit seq 239 / 1071 に実在)。恒久修正は未着手。
- **#2354(本セッションで起票 → [#2355](https://github.com/amadeus-dlc/amadeus/pull/2355) で修正・マージ済み)**: CG approve の plan drift ガードが batch 番号のみで実績突合していたため、再ディスパッチで番号がずれた並列 run を「直列」と誤判定していた。Unit 名キーへ移し、fan-out 側・settle 側の両方をグループ単位で照合する形に是正。
- **#1953(OPEN)**: 同ガードの偽 pass 方向(replan 後の stale 実績受理)。本 intent の射程外で不変。
- conductor クローンは origin/main に対し behind。main 上の最終形の検証は PR #2355 の CI(全 check SUCCESS)を正とする。
- coverage は CI 判定を正とし、本ローカル run では計測していない。
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ビルド手順 — intent 260805-semi-redefine-autonomy-f(#2253)

上流入力(consumes 全数): `code-generation-plan.md`(全 7 Unit)、`code-summary.md`(全 7 Unit)

本書は 7 Unit の `code-generation-plan.md` が宣言した編集正本(`packages/framework/core/tools/` と `packages/framework/harness/<name>/`)と、`code-summary.md` が記録した実装着地面を前提に、このリポジトリのビルド経路を記述する。

測定 ref: conductor クローン HEAD `74b70f40b`(branch `conductor/2253-autonomy-flag`)。数値・exit code はすべて下記コマンドの実出力からの転記。

## 1. 依存関係のインストール

```
bun install --frozen-lockfile
```

- ランタイムは Bun 単一依存(利用者側 Bun-only 前提)。JDK・Docker はフレームワーク本体のビルドには不要。
- **worktree 単位で必要**: `@ast-grep/napi` は `repoRoot/node_modules` 直下を実パスで参照するため(`tests/no-silent-drop/ast-scan.ts` の `loadVerifiedAstGrep`)、新しい worktree では `bun install` を省略すると no-silent-drop 系が `InfraFailure: TOOL_MISSING` で赤くなる。祖先ディレクトリの `node_modules` に解決される配置では通ることがあり、環境差として現れる。

## 2. 環境セットアップ

- 追加の env var・設定ファイル・ローカルサービスは不要。
- `bun` が**非対話シェルの PATH** に載っていること(Claude Code は `~/.zshenv` / `~/.bashrc` を読む。`~/.zshrc` は読まない)。
- formal-model-check plugin を実行する場合のみ、pin された JDK が必要(本 intent の advisory 実行で使用):
- `plugins/formal-model-check/tools/tlc-spawn-planner.ts` の `inspectDarwin` が `openjdk version "26.0.1"` を正規表現で要求する。
- mise 環境では `bun` 自体が shim で JAVA_HOME を上書きするため、`JAVA_HOME=... bun ...` では効かない。`mise x java@temurin-26.0.1+8 -- bun ...` の形で固定する。
- docker provider は digest pin 済み image(`eclipse-temurin:26-jdk@sha256:939e357…`)のローカル実在を要求する。

## 3. ビルドコマンド

```
bun run build
```

正本(`packages/framework/core/`、`packages/framework/harness/<name>/`)から、未追跡のローカル生成物として全ハーネスの `dist/<harness>/` とセルフインストールツリーを再生成する。対象ハーネス集合は packager の検出結果を正とする(固定数を前提にしない)。

## 4. ビルド検証

| 検証 | コマンド | 実測 exit code |
|---|---|---|
| 型検査 | `bun run typecheck` | 0 |
| Lint | `bun run lint` | 0 |
| source-only 境界 | `bun run source-only:check` | 0(`source-only boundary: clean`) |
| 複雑度 ratchet | `bun tests/complexity-gate.ts --check` | 0(`0 new violations, 0 regressions, baseline 34 entries (worst CCN 38), threshold 15`) |
| ビルド | `bun run build` | 0 |

`bun run build` は追跡ファイルを変更しない(source-only 構成のため `dist/` は未追跡)。

## 5. トラブルシューティング

| 症状 | 原因 | 対処 |
|---|---|---|
| `Cannot find module '../../dist/claude/.claude/tools/...'` が typecheck で多発 | `dist/` 未生成(source-only 構成の既定状態) | `bun run build` を先に実行する |
| no-silent-drop 系 3 ファイルが `InfraFailure: TOOL_MISSING` | worktree ローカルの `node_modules/@ast-grep/napi` 不在 | 当該 worktree で `bun install --frozen-lockfile` |
| no-silent-drop が `BASELINE_INVALID: current baseline previousDigest does not bind the trusted base bytes` | 台帳 `previousDigest` が現在の trusted base のバイト列を束縛していない | 対象ブランチの base に合わせて `baseline.json` / `exemptions.json` の `previousDigest` を再束縛する(PR 発行時は conductor が単独コミットで行う) |
| formal-model-check が `ENVIRONMENT_UNAVAILABLE` | JDK バージョン pin 不一致、または docker image 未 pull | 上記 §2 の JDK 固定手順、または pin 済み image を pull |
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ビルド・テスト実行結果 — intent 260805-semi-redefine-autonomy-f(#2253)

上流入力(consumes 全数): `code-generation-plan.md`(全 7 Unit)、`code-summary.md`(全 7 Unit)

測定 ref: conductor クローン `/Users/j5ik2o/.codex/worktrees/a0c4/amadeus-u2-quality-repair`、branch `conductor/2253-autonomy-flag`、HEAD `74b70f40b`。数値はすべて下記コマンドの実出力からの転記(記憶・見込みからの記載なし)。

## 1. ビルドと静的ゲート

| 検証 | コマンド | exit code | 出力の要点 |
|---|---|---|---|
| 依存導入 | `bun install --frozen-lockfile` | 0 | — |
| ビルド | `bun run build` | 0 | 全ハーネスの `dist/` とセルフインストール面を再生成(追跡ファイル不変) |
| 型検査 | `bun run typecheck` | 0 | `tsc --noEmit` × 2 プロファイル |
| Lint | `bun run lint` | 0 | Biome(既存 warning のみ、エラーなし) |
| source-only 境界 | `bun run source-only:check` | 0 | `source-only boundary: clean` |
| 複雑度 ratchet | `bun tests/complexity-gate.ts --check` | 0 | `0 new violations, 0 regressions, baseline 34 entries (worst CCN 38), threshold 15` |

## 2. テストスイート(正規判定)

```
bash tests/run-tests.sh --ci
```

**exit code 0 / `RESULT: PASS`**

| 指標 | 実測 |
|---|---|
| pass | 11,494 |
| fail | 0 |
| 実行テスト数 | 11,487 |
| 実行ファイル数 | 819 |
| `--- FAIL:` 行 | 0 |

test-size マトリクス(同 run の出力):

| scope | small | medium | large |
|---|---|---|---|
| smoke | 0 | 16 | 0 |
| unit | 213 | 162 | 1 |
| integration | 6 | 442 | 0 |
| **TOTAL** | **219** | **620** | **1** |

wall-clock drift: 4 file(s)(declared=medium / measured=large の既存申告差。本 intent が追加したテストは含まれない)

## 3. 本 intent が追加したテストの個別結果(同 run 内)

| ファイル | 結果 |
|---|---|
| `tests/unit/t448-autonomy-statusline-segment.test.ts` | PASS |
| `tests/unit/t449-autonomy-flag-parse.test.ts` | PASS |
| `tests/unit/t450-autonomy-flag-apply.test.ts` | PASS |
| `tests/unit/t451-semi-authority.test.ts` | PASS |
| `tests/unit/t452-authorize-interaction-semi.test.ts` | PASS |
| `tests/unit/t454-semi-policy-carrier.test.ts` | PASS |
| `tests/unit/t457-advisory-auto-resolve.test.ts` | PASS |
| `tests/unit/t459-advisory-receipt.test.ts` | PASS |
| `tests/integration/t450-autonomy-flag-branch.test.ts` | PASS |
| `tests/integration/t453-semi-ladder-runtime.integration.test.ts` | PASS |
| `tests/integration/t455-semi-policy-cli.integration.test.ts` | PASS |
| `tests/integration/t456-question-carveout-predicate.test.ts` | PASS |
| `tests/integration/t458-advisory-auto-resolution.integration.test.ts` | PASS |

## 4. 初回 run の赤とその帰属(切り分け記録)

同スイートの**初回**実行は `RESULT: FAIL`(exit 2、pass 11,490 / fail 4)。失敗は 4 件すべて no-silent-drop で、実文は

```
"code": "BASELINE_INVALID",
"detail": "current baseline previousDigest does not bind the trusted base bytes"
```

- 失敗ファイル: `tests/integration/no-silent-drop-gate.test.ts`、`tests/integration/no-silent-drop-repository-adoption.test.ts`
- 原因: PR #2355 の squash コミット(`c03a1e1fd`)を本クローンへ cherry-pick した際、同コミットに含まれる**main の base バイトへ再束縛済みの台帳**(`baseline.json` / `exemptions.json`)を取り込んだこと。本クローンの HEAD 系譜では当該束縛が成立しない。
- 是正: 台帳 2 ファイルを本クローン自身の束縛(cherry-pick 前 = `74b70f40b^`)へ戻した。対象 2 ファイルの単独実行で **74 pass / 0 fail**(254 expect)。
- 是正後のスイート全体が上記 §2 の `RESULT: PASS`。

本件は実装の欠陥ではなく、クローン間で台帳束縛が異なることによる record 面の状態差である。PR #2355 側では同一スイートが CI で `Tests SUCCESS`、fix worktree のローカル full CI でも `RESULT: PASS` を実測している。

## 5. formal-model-check(advisory 経路)

ladder が本 intent の pending advisory を **run-now** で自動裁定したため、engine の `await-advisory-choice`(`run_required: true`)が指定したコマンドを相関 3 フラグ付きで実行した。

```
run-model-check: NOT_DETECTED (exitCode 0, errorCode null, counterexampleIdentity null)
runId: ef9a54da-80de-4ecf-97ec-f39eba17036f
```

- 対象: `specs/tla/FormalElection.tla` + `FormalElection.cfg`
- 相関: `--advisory-target specs/tla` / `--advisory-spec-identity sha256:60d8302c…` / `--advisory-instance 72a03174-2dc8-4c2f-8e5e-9a6997aabc36`
- 実行環境の逸脱申告: provider auto は JDK バージョン pin(`openjdk version "26.0.1"`)不一致で `ENVIRONMENT_UNAVAILABLE`。mise 環境では `bun` shim が `JAVA_HOME` を上書きするため、`mise x java@temurin-26.0.1+8 -- bun …` で JDK を固定して実行した。TLC の探索意味論に関与しない実行環境の固定であり、モデル・cfg・相関フラグは指令の逐語どおり。
- 実行後に `next` を再実行して advisory が解消(`await-advisory-choice` が消え `run-stage build-and-test` が返る)ことを実測。

## 6. 申し送り(未検証面)

- **本クローンの base 前進**: conductor クローンは origin/main に対して behind であり、本スイートは cherry-pick 済みの `#2355` 修正を含む状態で回している。main 上の最終形は PR #2355 の CI(全 check SUCCESS)で確認済み。
- **coverage 判定**: Project / Patch Coverage Gate の判定は CI を正とする(本 intent の実装は 7 PR すべてで CI green を通過して着地済み)。本ローカル run では coverage を計測していない(同一 worktree の coverage は単独所有者を要するため)。
- **wall-clock drift 4 件**: 既存申告差であり本 intent の追加テストは含まれない。
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Integration テスト手順 — intent 260805-semi-redefine-autonomy-f(#2253)

上流入力(consumes 全数): `code-generation-plan.md`(全 7 Unit)、`code-summary.md`(全 7 Unit)

Comprehensive strategy の integration 面: Unit 横断の相互作用(認可基体 → 梯子 → 指令搬送 → advisory 解決)と、外部依存(実 FS の record / audit シャード / 台帳)の取り扱いを対象とする。

## 対象テスト(integration 層)

| Unit | ファイル | 対象 |
|---|---|---|
| semi-authorization-core | `tests/integration/t453-semi-ladder-runtime.integration.test.ts` | semi 梯子の runtime 貫通(認可基体が実 state / record 上で解決されること) |
| launch-autonomy-flag | `tests/integration/t450-autonomy-flag-branch.test.ts` | 起動宣言フラグの分岐が engine 経路で効くこと |
| semi-policy-carrier | `tests/integration/t455-semi-policy-cli.integration.test.ts` | CLI 面での decision policy 搬送(`policies:[]` 呼び出し面を含む) |
| stop-question-carveout | `tests/integration/t456-question-carveout-predicate.test.ts` | 人間宣言 semi Intent に対する Stop hook 質問 carve-out 述語 |
| advisory-auto-resolution | `tests/integration/t458-advisory-auto-resolution.integration.test.ts` | pending advisory を autonomy ladder で解決する経路(receipt 形状の同期を含む) |

## 実行方法

```
bun test ./tests/integration/t453-semi-ladder-runtime.integration.test.ts
bun test ./tests/integration/t450-autonomy-flag-branch.test.ts
bun test ./tests/integration/t455-semi-policy-cli.integration.test.ts
bun test ./tests/integration/t456-question-carveout-predicate.test.ts
bun test ./tests/integration/t458-advisory-auto-resolution.integration.test.ts
```

- **並列 fan-out 直後にフルスイートを回さない**。入れ子 spawn 型テストは外側の並列と重なるとタイムアウト予算を食い切り、負荷起因の偽赤を生む。負荷の収束を待つか並列度を落とす。
- エラー経路テストの green は「目的の分岐を実際に踏んだこと」を lcov の DA で確認してから完成扱いにする(別経路が同じ exit code に到達する偽経路 green を避ける)。

## 環境依存で赤くなりうる面(判定前に確認する)

| 面 | 症状 | 確認 |
|---|---|---|
| `@ast-grep/napi` 不在 | no-silent-drop 系が `TOOL_MISSING` | 当該 worktree で `bun install --frozen-lockfile` |
| NSD 台帳束縛 | `BASELINE_INVALID: previousDigest does not bind the trusted base bytes` | 対象ブランチの base に対して台帳を再束縛 |
| 並列負荷 | 単独実行では green、スイート内でのみ赤 | 単独再実行で対照を取り、負荷起因なら記録して再実行 |

環境起因の分類は、**未改変 base を同一条件(同一親配下の worktree・依存導入済み)で実行して失敗集合の差を取る**ことでのみ行う。ベースコミットを自分自身に対して検査する形の再現は縮退条件であり帰属の証拠にならない。
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- INVARIANT: examples are single-line HTML comments so a fresh template parses to total=0 (MEMORY_EMPTY). Do NOT un-comment or split across lines. t100 guards this. -->
> This file is maintained by the orchestrator during stage execution. Add observations at the gate ritual, not by editing here directly.

## Interpretations
<!-- example: 2026-05-29T10:14:32Z — chose REST over GraphQL; the consuming team only needs CRUD, revisit if subscriptions land -->

## Deviations
<!-- example: 2026-05-29T10:14:32Z — skipped the optional caching layer the stage prose suggested; the dataset is small enough that it adds risk -->

## Tradeoffs
<!-- example: 2026-05-29T10:14:32Z — picked TDD over BDD this run; the team is unit-first and the domain is well-understood -->

## Open questions
<!-- example: 2026-05-29T10:14:32Z — confirm the retention window with compliance before the next stage hardens the schema -->
Loading
Loading