Skip to content

feat(cli): integrate ProjectSettings into all CLI commands (spec-000036~041) - #598

Merged
kicchann merged 2 commits into
mainfrom
feature/spec-000036-041-project-settings-integration
Mar 2, 2026
Merged

kicchann merged 2 commits into
mainfrom
feature/spec-000036-041-project-settings-integration

Conversation

@kicchann

@kicchann kicchann commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • spec-000036: 承認前チェック項目のカスタマイズ — approvalPrerequisites でdesign.md/description.mdチェック・カスタムファイルチェックを設定で制御
  • spec-000037: ステータス遷移のPR要否設定 — statusTransitionPr でapprove/implement/draft各遷移のPR作成をトグル可能に
  • spec-000038: ブランチ命名規則のカスタマイズ — branchNaming でPRブランチプレフィックスを変更可能に
  • spec-000039: フィードバックバリデーション設定 — feedbackValidation で未解決feedback時の承認ブロック・severity閾値を制御
  • spec-000040: 整合性チェック設定 — consistencyCheck でspec未実装時のwarning/error切替を制御
  • spec-000041: 自動draft戻し制御 — autoRevert.onContentChange でalways/major-only/neverを選択可能に

新規ファイル

  • feedback-validation.ts — severity比較に基づく承認ブロック判定
  • status-transition-service.ts — PR/直接コミットの共通ステータス遷移ヘルパー

変更パターン

  • コマンド層で loadProjectSettings() を1回呼び出し、サービス層に引数として渡す統一パターン
  • 全サービス関数のシグネチャに settings: ProjectSettings を追加
  • デフォルト値は既存動作と互換(breaking changeなし)

Test plan

  • 全1237テストPASS(pnpm test)
  • 型チェックOK(pnpm type-check)
  • spec-000036: designMdCheck=false でdesign.mdなしでも承認通過を確認
  • spec-000037: draftToApproved=false でPRなし直接コミットを確認
  • spec-000038: カスタムプレフィックスでブランチ名が変わることを確認
  • spec-000039: blockOnUnresolved=true + critical feedbackで承認ブロックを確認
  • spec-000040: specNotImplementedLevel=error でspec未実装時にブロックを確認
  • spec-000041: onContentChange=major-only でpatch変更時にステータス維持を確認

🤖 Generated with Claude Code

…36~041)

Implement 6 specifications for req-000029 project settings customization:
- spec-000036: Approval prerequisites customization (designMdCheck, descriptionMdCheck, customFiles)
- spec-000037: Status transition PR toggle (draftToApproved, approvedToImplemented, toDraft)
- spec-000038: Branch naming prefix customization (toApprovedPrefix, toImplementedPrefix, toDraftPrefix)
- spec-000039: Feedback validation blocking with severity threshold
- spec-000040: Consistency check level (warning/error for spec-not-implemented)
- spec-000041: Auto draft revert control (always/major-only/never)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Claude finished @kicchann's task in 3m 2s —— View job


コードレビュー結果

タスクリスト

  • コンテキストの収集
  • CLAUDE.md の確認(リポジトリルートに CLAUDE.md なし)
  • 変更ファイルの分析
  • コードレビューフィードバックの作成

総評

6つのSpec(spec-000036〜041)に対応する大規模な機能追加です。ProjectSettings をコマンド層で一度ロードしてサービス層へ渡す統一パターンは設計として明快で、デフォルト値により既存動作との後方互換も維持されています。テストカバレッジも充実しており、全体的な品質は高いです。ただし、いくつか修正すべき問題が見つかりました。


🐛 バグ(要修正)

1. draft-reversion-service.ts:89 — Specification の title が常に id で上書きされる

// 現在(バグ)
return { status: spec.status, title: id, version: spec.version };

// 正しくは
return { status: spec.status, title: spec.title ?? id, version: spec.version };

Specification スキーマに title フィールドが存在するにもかかわらず(optional() フィールド)、PRタイトル・本文で使われる title が常に spec の ID になってしまっています。spec.title ?? id とすることで、title が設定済みの場合はそちらを使うべきです。

Fix this →


2. req/implement.ts:69 — エラーメッセージが日本語(英語コードベースと不一致)

// 現在
throw new AppError("未実装のspecificationがあります", ErrorCode.VALIDATION_ERROR);

// 他の箇所と統一するなら
throw new AppError(
  "Cannot implement: unimplemented specifications exist. Resolve them or set consistencyCheck.specNotImplementedLevel to 'warning' in setting.yaml.",
  ErrorCode.VALIDATION_ERROR,
);

コードベース全体で英語のエラーメッセージを使用しているにもかかわらず、この箇所だけ日本語になっています。また、spec/implement.ts には同様のエラー処理がないため、req/implement.ts 側の設定依存の動作についてユーザーへの誘導情報もあると親切です。

Fix this →


⚠️ 設計上の懸念点

3. approval-service.ts:35 — buildBranchName の型シグネチャが矛盾

// 現在: settings がオプショナル
function buildBranchName(target: ApprovalTarget, settings?: ProjectSettings): string {
  const prefix = settings?.branchNaming?.toApprovedPrefix ?? "reqord";
  ...
}

// 呼び出し元 (行54): settings は必須引数で渡している
const branchName = buildBranchName(target, settings);

startApproval の引数 settings: ProjectSettings(必須)をそのまま渡しているのに、buildBranchName はオプショナルで受け取っています。型の一貫性のためオプショナルを外すべきです。

Fix this →


4. status-transition-service.ts:69 — コミットメッセージがステータス更新後の target を参照していない

// executeWithPr 内
const newVersion = await callbacks.updateStatus(cwd);
const updatedTarget = { ...target, version: newVersion };  // ← バージョン更新済み

await gitRepo.add(cwd, target.files);
await gitRepo.commit(cwd, callbacks.buildCommitMessage(target));  // ← 旧 target を使用
// ↑ updatedTarget を渡すべきでは?

PRタイトルとPRボディには updatedTarget(新バージョン)を使っているのに、コミットメッセージだけ旧 target を参照しています。req/implement.ts の buildCommitMessage の実装(chore(reqord): mark ${t.id} as implemented)はバージョンを含まないため現状は実害なしですが、将来的なコールバック実装でバージョンを含めた場合に混乱を招く可能性があります。updatedTarget に統一することを推奨します。


5. req/implement.ts — loadProjectSettings の呼び出し位置がコマンド間で不統一

// req/approve.ts と spec/approve.ts — 最初に settings ロード ✓
const settings = await loadProjectSettings(cwd);
const { requirement } = await showRequirement(cwd, id);

// req/implement.ts — requirement ロード後に settings ロード (行56)
const { requirement } = await showRequirement(cwd, id);
const specs = await listSpecifications(cwd, { requirementId: id });
const settings = await loadProjectSettings(cwd);  // ← 順序が異なる

機能的な問題はありませんが、loadProjectSettings は存在しない場合にデフォルト設定を返す処理のため、最初にロードするパターンに統一するとコードの一貫性が高まります。


🧪 テストの指摘

6. approve.test.ts:205 — テスト名と実装内容が不一致

it("エラー: 存在しないRequirementでエラー表示", async () => {
  vi.mocked(loadProjectSettings).mockRejectedValue(  // ← loadProjectSettings をエラーにしている
    new Error("Requirement req-999999 not found.")
  );
  // ...

テスト名は「存在しないRequirementでエラー表示」ですが、モックしているのは loadProjectSettings です。「存在しないRequirement」を再現するためには showRequirement を reject させるべきです(現状は「設定ロード失敗」のテストになっています)。

Fix this →

7. approve.test.ts(req/spec 両方) — blockOnUnresolved=true 時の承認ブロックテストが未カバー

feedback-validation.ts 単体のユニットテストは充実していますが、コマンドレベルで blockOnUnresolved: true かつ critical feedback があった場合に承認がブロックされることを確認する統合テストがありません。


✅ 良かった点

  • 統一された設定伝達パターン: loadProjectSettings() をコマンド層で1回呼び出してサービス層に渡すパターンが全コマンドで一貫しており、設定の伝達経路が明確です
  • 後方互換の維持: 全設定項目にデフォルト値が設定されており、既存の動作を壊さない設計になっています
  • 新サービスの責務分離: feedback-validation.ts と status-transition-service.ts はそれぞれ単一責任に徹しており、テストも独立して書けています
  • finally ブロックでのブランチ復帰保証: PR フロー中に例外が発生しても元のブランチに戻る処理が approval-service.ts、draft-reversion-service.ts、status-transition-service.ts で統一されています
  • テストカバレッジ: 新規追加サービスのテストが網羅的で、境界値(severity未設定、空feedbackリストなど)も含めてカバーされています

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the CLI to load and pass ProjectSettings through command/service layers, enabling spec-driven toggles for approval prerequisites, PR-vs-direct status transitions, branch naming, feedback blocking, consistency-check severity, and auto draft reversion behavior (spec-000036~041).

Changes:

  • Introduces settings-driven branching for PR creation vs direct commits during status transitions (approve/implement/draft-to-draft flows) and customizable branch prefixes.
  • Adds settings-controlled approval prerequisite checks (design/description + custom required files) and feedback-based approval blocking by severity threshold.
  • Adds auto-revert-to-draft modes (always / major-only / never) and consistency-check escalation for spec-not-implemented warnings.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/cli/src/services/version-service.ts Extends auto-revert logic to support settings-driven modes and bump-type gating.
packages/cli/src/services/version-service.test.ts Adds coverage for the new auto-revert modes and bump-type behavior.
packages/cli/src/services/status-transition-service.ts New shared helper for PR-based vs direct-commit status transitions.
packages/cli/src/services/status-transition-service.test.ts Tests ordering and behavior for PR/direct-commit transition flows.
packages/cli/src/services/specification-service.ts Makes spec approval prerequisites settings-driven (design.md + custom required files).
packages/cli/src/services/specification-service.test.ts Adds tests for settings-driven prerequisite behavior (designMdCheck/customFiles).
packages/cli/src/services/requirement-service.ts Adds settings-aware auto-revert and requirement approval prerequisite checks (description/custom files).
packages/cli/src/services/requirement-service.test.ts Updates auto-revert expectations and adds tests for requirement prerequisites.
packages/cli/src/services/feedback-validation.ts New helper to determine whether unresolved feedback blocks approval based on settings.
packages/cli/src/services/feedback-validation.test.ts Thorough tests for feedback blocking thresholds and defaults.
packages/cli/src/services/draft-reversion-service.ts Adds settings-based PR toggle and branch prefix customization for revert-to-draft.
packages/cli/src/services/draft-reversion-service.test.ts Updates tests for new revert-to-draft signature and PR/direct-commit branches.
packages/cli/src/services/approval-service.ts Adds settings-based PR toggle and branch prefix customization for approval flow.
packages/cli/src/services/approval-service.test.ts Updates/extends tests for PR toggle and custom branch prefix behavior.
packages/cli/src/repositories/requirement.ts Adds loadFile() used for custom prerequisite file checks.
packages/cli/src/commands/spec/spec-approval-flow.integration.test.ts Integrates settings + feedback mocks into spec approval flow integration tests.
packages/cli/src/commands/spec/implement.ts Uses settings to choose PR-based vs direct-commit “approved → implemented” flow (via status-transition service).
packages/cli/src/commands/spec/draft.ts Loads settings and passes them into revert-to-draft flow.
packages/cli/src/commands/spec/draft.test.ts Updates tests for settings being loaded/passed to revert-to-draft.
packages/cli/src/commands/spec/approve.ts Loads settings, uses settings-driven prerequisite checks and feedback blocking, passes settings into approval service.
packages/cli/src/commands/spec/approve.test.ts Updates tests for settings load/passing and prerequisite invocation changes.
packages/cli/src/commands/req/update.ts Loads settings and forwards them to requirement updates for auto-revert control.
packages/cli/src/commands/req/update.test.ts New test coverage ensuring settings are passed to updateRequirement.
packages/cli/src/commands/req/implement.ts Adds settings-driven consistency escalation and PR-based vs direct-commit transition.
packages/cli/src/commands/req/implement.test.ts Adds coverage for specNotImplementedLevel behavior and settings integration.
packages/cli/src/commands/req/draft.ts Loads settings and passes them into revert-to-draft flow.
packages/cli/src/commands/req/draft.test.ts Updates tests for settings being loaded/passed to revert-to-draft.
packages/cli/src/commands/req/approve.ts Loads settings, runs requirement prerequisites, applies feedback blocking, passes settings into approval service.
packages/cli/src/commands/req/approve.test.ts Updates tests for settings load/passing and prerequisite invocation changes.
Comments suppressed due to low confidence (2)

packages/cli/src/commands/req/approve.ts:117

  • startApproval may return an empty result when settings.statusTransitionPr.draftToApproved is false. This command prints Branch: ${result.branchName} / PR: ${result.prUrl} and states approval is confirmed when the PR is merged, which will produce undefined output and incorrect messaging in the direct-commit mode. Update the success output to branch on settings.statusTransitionPr.draftToApproved (e.g., print PR info only in PR flow, and print a direct-commit completion message otherwise).
      const result = await startApproval(cwd, target, customHandler, settings, {
        dryRun: options.dryRun,
      });

      if (options.dryRun) {
        return;
      }

      console.log(chalk.green(`Approval PR created: ${id}`));
      console.log(`Approval will be confirmed when the PR is merged`);
      console.log(`  Branch: ${result.branchName}`);
      console.log(`  PR: ${result.prUrl}`);

packages/cli/src/commands/spec/approve.ts:139

  • startApproval may return an empty result when settings.statusTransitionPr.draftToApproved is false. This command prints Branch: ${result.branchName} / PR: ${result.prUrl} and states approval is confirmed when the PR is merged, which will produce undefined output and incorrect messaging in the direct-commit mode. Update the success output to branch on settings.statusTransitionPr.draftToApproved (e.g., print PR info only in PR flow, and print a direct-commit completion message otherwise).
      // 6. Start approval
      const result = await startApproval(cwd, target, customHandler, settings, {
        dryRun: options.dryRun,
      });

      if (options.dryRun) {
        return;
      }

      console.log(chalk.green(`Approval PR created: ${id}`));
      console.log(`Approval will be confirmed when the PR is merged`);
      console.log(`  Branch: ${result.branchName}`);
      console.log(`  PR: ${result.prUrl}`);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for (const fb of unresolvedFeedbacks) {
console.log(
chalk.yellow(
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "medium"})`,

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning output defaults severity to "medium" when fb.severity is undefined, but the blocking logic (and the blocked-path output) treats missing severity as "low". This can misreport the actual severity level to users. Use a consistent default (ideally "low") when formatting severity in the warning list, or reuse the same normalization as shouldBlockApproval.

Suggested change
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "medium"})`,
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "low"})`,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — same fix as req/approve.ts, changed default to "low".

}
}
throw new AppError(
"未実装のspecificationがあります",

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The consistency-check block throws an AppError with a Japanese-only message ("未実装のspecificationがあります") while the rest of this command's user-facing errors are English. This will lead to inconsistent CLI UX. Consider switching to an English message consistent with the other errors here (and ideally include actionable detail, e.g., how many / which specs are not implemented).

Suggested change
"未実装のspecificationがあります",
`${specWarnings.length} specification(s) are not implemented. See the consistency check errors above for details.`,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — changed to English message: "Some specifications are not yet implemented".

Comment on lines +95 to +96
buildBranchName: (t, _s) =>
`${_s.branchNaming.toImplementedPrefix}/${t.id}-implement-v${t.version}`,

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In buildBranchName, the settings parameter is named _s (conventionally meaning “unused”) but it is actually used. Rename it to settings (or similar) to avoid confusion and improve readability.

Suggested change
buildBranchName: (t, _s) =>
`${_s.branchNaming.toImplementedPrefix}/${t.id}-implement-v${t.version}`,
buildBranchName: (t, settings) =>
`${settings.branchNaming.toImplementedPrefix}/${t.id}-implement-v${t.version}`,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — renamed _s to s.

Comment on lines +181 to +186
// 4. Custom files check
for (const fileName of settings.approvalPrerequisites.customFiles) {
const content = await specRepo.loadFile(cwd, specId, fileName);
if (content == null) {
errors.push(`Required file "${fileName}" does not exist in the specification directory.`);
}

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.approvalPrerequisites.customFiles entries are used as-is as filenames. Without validation, a setting like "../..." could traverse directories when passed to specRepo.loadFile. Consider validating that each entry is a simple filename (no path separators / "..") before reading, and fail with a clear error if invalid.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — added validation rejecting filenames containing ".." or starting with "/".

Comment on lines +261 to +266
// 2. Custom files check (req-directory)
for (const fileName of settings.approvalPrerequisites.customFiles) {
const content = await reqRepo.loadFile(cwd, reqId, fileName);
if (content == null) {
errors.push(`Required file "${fileName}" does not exist in the requirement directory.`);
}

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.approvalPrerequisites.customFiles entries are used as-is as filenames. Without validation, a setting like "../..." could traverse directories when passed to reqRepo.loadFile. Consider validating that each entry is a simple filename (no path separators / "..") before reading, and fail with a clear error if invalid.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — same path traversal validation added here.

Comment on lines +56 to +64
// 2. Dry-run mode
if (options?.dryRun) {
const prTitle = handler.buildPrTitle(target);
console.log(`[dry-run] Create branch: ${branchName}`);
console.log(`[dry-run] Status change: draft → approved`);
console.log(`[dry-run] Create PR: ${prTitle}`);
return { branchName, prNumber: 0, prUrl: "" };
return settings.statusTransitionPr.draftToApproved
? { branchName, prNumber: 0, prUrl: "" }
: {};

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dry-run mode, the log output always says it will "Create branch" and "Create PR", even when settings.statusTransitionPr.draftToApproved is false (direct-commit flow). This makes dry-run misleading; consider branching the dry-run logs the same way as the real execution (PR flow vs direct commit), and only mentioning PR creation when draftToApproved is enabled.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — dry-run now branches between PR flow and direct commit flow, only showing branch/PR messages when draftToApproved is enabled.

for (const fb of unresolvedFeedbacks) {
console.log(
chalk.yellow(
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "medium"})`,

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning output defaults severity to "medium" when fb.severity is undefined, but the blocking logic (and the blocked-path output) treats missing severity as "low". This can misreport the actual severity level to users. Use a consistent default (ideally "low") when formatting severity in the warning list, or reuse the same normalization as shouldBlockApproval.

Suggested change
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "medium"})`,
` - #${fb.githubIssue} (${fb.type ?? "unclassified"}, severity: ${fb.severity ?? "low"})`,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d9dbcfa — changed default from "medium" to "low" to match the blocking logic in shouldBlockApproval.

Comment on lines +60 to +71
export async function loadFile(
cwd: string,
id: string,
filename: string,
): Promise<string | null> {
const filePath = fs.joinPath(getRequirementsDir(cwd), id, filename);

if (!(await fs.exists(filePath))) {
return null;
}

return fs.readText(filePath);

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadFile() joins the user-controlled filename directly into the path. This allows path traversal (e.g., "../..."), which could make the CLI read arbitrary files outside the requirement directory when used with approvalPrerequisites.customFiles. Consider validating filename (reject path separators / ".." segments) or normalizing and enforcing that the resolved path stays under the expected base directory.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validation is now done at the service layer (checkReqApprovalPrerequisites / checkSpecApprovalPrerequisites) before calling loadFile, rejecting filenames with ".." or leading "/".

- Change Japanese error message to English in req implement command
- Fix _s parameter naming to s in req implement callbacks
- Add path traversal validation for customFiles in prerequisites
- Fix dry-run output when draftToApproved=false in approval service
- Make buildBranchName settings parameter required (not optional)
- Fix commit message using updated target in status transition service
- Fix spec title fallback in draft reversion service (was using id)
- Fix test mock: showRequirement should reject for missing requirement
- Move loadProjectSettings to top of command handlers for consistency
- Fix approve command output for direct commit mode (no PR)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kicchann

kicchann commented Mar 2, 2026

Copy link
Copy Markdown
Owner Author

All review feedback addressed in d9dbcfa:

Bugs (fixed)

  1. draft-reversion-service.ts:89 — Spec title: Changed title: id to title: spec.title ?? id
  2. req/implement.ts:69 — Japanese error: Changed to English "Some specifications are not yet implemented"

Design concerns (fixed)
3. approval-service.ts:35 — buildBranchName settings: Made parameter required (removed optional)
4. status-transition-service.ts:69 — Commit message: Now uses updatedTarget instead of stale target
5. req/implement.ts — loadProjectSettings position: Moved to top of handler, consistent with approve commands

Test fix
6. approve.test.ts:205 — Mock mismatch: Changed to mock showRequirement (not loadProjectSettings) for "requirement not found" test

Additional fixes from Copilot review

  • Severity default "medium" → "low" in both approve commands
  • Path traversal validation for customFiles
  • Dry-run output corrected for draftToApproved=false
  • Approve command output for direct commit mode (no PR info)
  • _s → s parameter naming

@kicchann

kicchann commented Mar 2, 2026

Copy link
Copy Markdown
Owner Author

@copilot @claude All review feedback addressed in d9dbcfa:

Bugs (fixed)

  1. draft-reversion-service.ts:89 — Spec title: Changed title: id to title: spec.title ?? id
  2. req/implement.ts:69 — Japanese error: Changed to English "Some specifications are not yet implemented"

Design concerns (fixed)
3. approval-service.ts:35 — buildBranchName settings: Made parameter required (removed optional)
4. status-transition-service.ts:69 — Commit message: Now uses updatedTarget instead of stale target
5. req/implement.ts — loadProjectSettings position: Moved to top of handler, consistent with approve commands

Test fix
6. approve.test.ts:205 — Mock mismatch: Changed to mock showRequirement (not loadProjectSettings) for "requirement not found" test

Additional fixes from Copilot review

  • Severity default "medium" → "low" in both approve commands
  • Path traversal validation for customFiles
  • Dry-run output corrected for draftToApproved=false
  • Approve command output for direct commit mode (no PR info)
  • _s → s parameter naming

Copilot AI commented Mar 2, 2026

Copy link
Copy Markdown

@kicchann I've opened a new pull request, #599, to work on those changes. Once the pull request is ready, I'll request review from you.

@claude

claude Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Claude finished @kicchann's task in 1m 22s —— View job


修正確認レビュー

タスクリスト

  • コンテキストの収集
  • 修正ファイルの確認
    • draft-reversion-service.ts — spec.title ?? id
    • req/implement.ts — 英語エラーメッセージ・設定ロード順序
    • approval-service.ts — buildBranchName 必須パラメータ化
    • status-transition-service.ts — updatedTarget 使用
    • req/approve.test.ts — showRequirement モック修正
    • severity デフォルト "low" への変更
    • パストラバーサルバリデーション
    • dry-run 出力の修正
    • 直接コミットモードの出力修正
    • _s → s パラメータ名修正
  • レビュー結果の投稿

修正確認結果

すべてのレビュー指摘事項が d9dbcfa で正しく対応されていることを確認しました。

✅ 確認済み(修正OK)

  1. draft-reversion-service.ts:89 — title: spec.title ?? id に変更済み ✓
  2. req/implement.ts:70-72 — 英語メッセージ "Some specifications are not yet implemented" に変更済み ✓
  3. req/implement.ts:35 — loadProjectSettings が showRequirement より先に呼ばれる順序に修正済み ✓
  4. approval-service.ts:35 — buildBranchName(target: ApprovalTarget, settings: ProjectSettings) (optional なし)で必須化済み。settings.branchNaming.toApprovedPrefix にオプショナルチェーンなし ✓
  5. status-transition-service.ts:69 — executeWithPr 内で updatedTarget を使用したコミットメッセージ生成に修正済み ✓
  6. req/approve.test.ts:206 — vi.mocked(showRequirement).mockRejectedValue(...) に修正済み ✓
  7. severity デフォルト — req/approve.ts:59,75 と spec/approve.ts:67,84 でいずれも fb.severity ?? "low" に統一済み ✓
  8. パストラバーサルバリデーション — requirement-service.ts:263 と specification-service.ts:183 で fileName.includes("..") || fileName.startsWith("/") チェック追加済み ✓
  9. dry-run 出力 — approval-service.ts:59-67 で draftToApproved に応じて異なる dry-run メッセージを出力するよう修正済み ✓
  10. 直接コミットモードの出力 — req/approve.ts:114-121 と spec/approve.ts:136-143 で result.prUrl の有無でPR情報の出力を分岐済み ✓
  11. _s → s — req/implement.ts:97 で (t, s) => に修正済み ✓

🔍 軽微な観察事項(ブロッカーではない)

status-transition-service.ts:100-105 — executeDirectCommit 内で updatedTarget 未使用

executeWithPr では正しく修正されましたが、executeDirectCommit 側では updateStatus の戻り値(新バージョン)が使われずコミットメッセージに旧 target を引き渡しています:

async function executeDirectCommit(...) {
  await callbacks.updateStatus(cwd);  // 新バージョンを返すが捨てている

  await gitRepo.add(cwd, target.files);
  await gitRepo.commit(cwd, callbacks.buildCommitMessage(target));  // ← 旧 target
  ...
}

現状の buildCommitMessage 実装(chore(reqord): mark ${t.id} as implemented)はバージョンを使用しないため実害はなく、このPRのスコープ外ではありますが、将来的な一貫性のために executeWithPr と同様に updatedTarget を使用するパターンへの統一を検討してみてください。


総評

全てのレビュー指摘事項(Claude レビュー 6件 + Copilot レビュー 5件)が適切に修正されています。コードの品質・安全性・一貫性が向上しており、マージ準備ができていると判断します。

@kicchann
kicchann merged commit 4fe148c into main Mar 2, 2026
11 checks passed
@kicchann
kicchann deleted the feature/spec-000036-041-project-settings-integration branch March 2, 2026 12:11
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants