AI-DLC v2 実践例: TODO アプリ brownfield リファクタリング(intent-001, RF-01〜22) - #17
Open
seike460 wants to merge 9 commits into
Open
AI-DLC v2 実践例: TODO アプリ brownfield リファクタリング(intent-001, RF-01〜22)#17seike460 wants to merge 9 commits into
seike460 wants to merge 9 commits into
Conversation
AI-DLC v2 ワークフローによる INCEPTION フェーズ完了時点の成果物一式。 - reverse-engineering: 現状分析(アーキテクチャ・コード構造・API・技術スタック) - requirements-analysis: リファクタリング要件 RF-01〜RF-22(P0=3/P1=10/P2=9) - domain-design: 3 論理コンポーネント(CMP-001〜003) - units-generation: UNIT-001 todo-app 単一ユニット構成 - workflow.json / state.json / audit.json(CONSTRUCTION 4 ステージは pending)
AI-DLC v2 CONSTRUCTION ステージ 1/4。reviewer 判定 READY。 - entities.yaml: ENT-001 Todo 全 6 属性の詳細スキーマ - rules.yaml: 業務ルール BR-001〜014 - api-specification.md: API-001〜006 + PUT 部分更新意味論(RF-22②) - functional-spec.md: ER 図 / 状態機械 SM-001 / ワークフロー WF-001〜007 - copy-forward 3 件(components.yaml / unit.md / unit-story-map.md、ID 不変) - 人間決定 Q1〜Q5: API 側ソート / CORS 両方撤去 / テスト境界値リテラル維持 / schema 非公開 / CMP-003 ビルドなし
AI-DLC v2 CONSTRUCTION ステージ 2/4。reviewer 判定 READY。 - nfr-specification.md: 品質ターゲット QT-1〜9 / Tech Stack / 8 パターン / Constraints C-1〜9 - NFR-001 計測点 = Lambda Duration p95 ≤ 500ms(コールドスタート除外をメトリクス定義で実現) - 人間決定 Q1〜Q7: ヘッダ注入方式 / Secrets Manager 自動生成 / audit=high / Duration p95 主アラーム / SNS 通知 / Powertools Logger / Playwright - copy-forward 3 件(components.yaml / unit.md / api-specification.md、ID 不変)
AI-DLC v2 CONSTRUCTION ステージ 3/4。reviewer 判定 READY(実コード行参照を全件照合)。 - infrastructure-specification.md: 変更明細 CH-1〜CH-10 / インフラテスト IT-1〜IT-10 - 命名確定: x-origin-verify ヘッダ / ORIGIN_VERIFY_SECRET 環境変数 - 新規リソース 4 区分のみ(Secret / SNS / アラーム 4 種 / 明示 LogGroup)、コスト増分 +$0.40/月 - 人間決定 Q1〜Q2: ApiUrl 出力維持 + 403 明記 / 旧ロググループ残置許容 - copy-forward 2 件(components.yaml / unit.md、削除 0 行)
AI-DLC v2 code-generation P0 フェーズ。BP-1: 元 45 テスト全件 green 維持。 - fix: todo-stack.ts の lambda.OutputFormat.ESM 誤 import を修正(infra テスト 7 件のロード不能を解消) - RF-03: packages/shared(CMP-003)新設 — 型+定数 / zod schema の公開面分離、境界値テスト 16 件、 backend/frontend の重複型定義を削除し 200/1000 を constants.ts に一元化 - RF-01: GitHub Actions CI 6 ジョブ(lint/typecheck/test/build/synth/audit-high) - RF-02: ルート e2e/ + Playwright スモーク(BT-1〜5 + BT-7、docker compose 実環境 2/2 green) - 基準線修復: biome ignore(dist/org-ai-kb/aidlc-docs)、vite/client 型、Hono Context 型付け - 検証: テスト 61 件 green(shared16/backend21/frontend17/infra7)、lint/build/synth/audit pass
AI-DLC v2 code-generation P1 フェーズ。BP-1: 許容変更 1・4・5 のみ、テスト 84 件 green。 - RF-04: 不正 JSON → 400、評価順序固定(ボディ解釈→検証→書込) - RF-07: attribute_exists 条件付き書込(findById 事前読取撤去、DynamoDB 呼出各 1 回) - RF-06: 一覧 createdAt 降順 + id 降順 tie-break(BR-010) - RF-10/11: Powertools Logger(method/path/status/requestId + エラー時 stack) - RF-12: hono/cors 撤去 + 回帰テスト - RF-05/08/09: 可視エラーバナー / createdAt 人間可読表示 / 未使用 fetchTodo 削除 - RF-13: frontend build を vite build のみに分離 - 検証: テスト 84 件(shared16/backend37/frontend24/infra7)、E2E 2/2 green
AI-DLC v2 code-generation P2 フェーズ。BP-1: 新規振る舞い変化は許容変更 3(直接 403)のみ。 - CH-1〜10: x-origin-verify オリジン検証(Secrets Manager 自動生成・平文 0 件)、 originVerify ミドルウェア(常時有効・フェイルクローズ)、アラーム 4 種 + SNS、 明示 LogGroup、corsPreflight 撤去、ApiUrl 説明文 403 明記 - IT-1〜10: インフラテスト 17 件(synth deprecation 0、Custom::LogRetention 0) - RF-18: Vitest 3 / Vite 7 / Biome 2 / CDK 2.258.1(audit ignore 0 件に) - RF-19/20/21: renovate.json / root deploy script / Dockerfile.dev 非 root 化 - RF-22: v1 文書 3 点修正 + 正の所在バナー 5 ファイル - 文書成果物: implementation-map.md + copy-forward components.yaml / unit.md - 検証: テスト 99 件 green(shared16/backend42/frontend24/infra17)、E2E 2/2
AI-DLC v2 CONSTRUCTION ステージ 4/4。code-reviewer 判定 READY(独立再検証)。 - 実装 3 フェーズ: P0 検証ゲート / P1 品質改修 / P2 IaC・依存・文書(RF-01〜22 全件着地) - BP-1: baseline diff 全数照合で許容変更 1〜5 のみ、テスト 99 件 green - contribution(重大 0 件)+ refine + final review の記録 - 申し送り: push 後 CI 確認 / ブランチ保護有効化 / 実デプロイ + SNS 購読
infrastructure の unit テストは TodoStack を実体化するため、synth ジョブと同様に Source.asset(frontend/dist) の実在が前提になる。CI 初実行で CannotFindAsset により test ジョブのみ fail(ローカルは build 済み dist が存在したため green)。 dist 削除でローカル再現 → build 先行で 99 件 green を確認済み。
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.
Note
本 PR は AI-DLC v2 ワークフローの実践例(教材) です。プラクティス用リポジトリのためマージしません。
概要
awslabs/aidlc-workflows の v2 ソース(kiro/src/) をオーケストレーターとして直接実行し、TODO アプリケーション(pnpm monorepo: Hono backend / React 19 frontend / AWS CDK)の brownfield リファクタリングを INCEPTION → CONSTRUCTION の全 8 ステージ・supervised モードで完走した成果です。
org-ai-kb/aidlc-docs/intent-001-refactor-todo-app/(全成果物・状態・監査ログを含む)audit/audit.json(17 エントリ — 人間が各 gate で何を提示され何を決めたか)AI-DLC v2 プロセス(このリポジトリで実際に回した流れ)
各ステージは v2 の 状態遷移表(16 行) に従い、
plan-and-clarify → clarification-asked →(human gate)→ artifact-generated →(contribution)→ final-review → presented →(human gate)→ completeを厳密に遷移。supervised モードのため plan + 設問の提示と成果物承認の 2 箇所で必ず人間が判断しています(人間の決定例: API 側ソート + id 降順 tie-break / CORS 0 箇所化 / Secrets Manager 自動生成 / Lambda Duration p95 主アラーム / Powertools Logger / Playwright)。実装(code-generation、P0 → P1 → P2 の安全順序)
P0 — 検証ゲート確立(c8c95c8)
packages/shared(CMP-003)新設 — 型+定数 / zod schema の公開面分離、境界値 200/1000 を 1 箇所に集約e2e/+ Playwright スモーク(BT-1〜5 + BT-7、docker compose 実環境)lambda.OutputFormat.ESMの誤 import(実バグ — infra テスト 7 件がロード不能だった根本原因)等を修正し、既存 45 テスト green の真の基準線を確立P1 — backend / frontend 品質改修(185e7b4)
attribute_exists(id)(DynamoDB 呼出を各 1 回に)/ 不正 JSON 400 + 評価順序固定 / 一覧順序保証(createdAt 降順 + id 降順)/ Powertools Logger 構造化ログ(SECURITY-03 ドリフト解消)/ hono cors 撤去 / ミューテーション失敗の可視エラーバナーP2 — IaC 刷新・依存更新・文書整備(ec7a92e)
x-origin-verifyヘッダ + Secrets Manager 自動生成(テンプレート平文 0 件)、フェイルクローズの検証ミドルウェアdeployscript / Dockerfile.dev 非 root 化 / v1 文書ドリフト修正 + 正の所在バナー検証(多層)
dc77d65との diff 全数照合 — 差分は承認済み許容変更 1〜5 のみ、BT-1〜7 不変テストは着手前 38/45 pass(infra 7 件ロード不能・lint/build red)→ 完了時 99/99 pass(shared 16 / backend 42 / frontend 24 / infrastructure 17)+ E2E 2/2。
トレーサビリティ
stages/construction/todo-app/code-generation/implementation-map.mdに RF / CH / IT / BR / API / QT → 実ファイル・テストの対応表があります。設計成果物はすべて copy-forward 方式で stable ID を保存(blueprint identity)。残作業(申し送り)
🤖 Generated with Claude Code — AI-DLC v2 orchestration