facet: 契約文字列のハードコード散在を防止するルールを追加

ポリシー・実装インストラクション・アーキテクチャレビューの3箇所に
ファイル名・設定キー名などの契約文字列を定数で一箇所管理するルールを追加。
This commit is contained in:
nrslib 2026-02-22 00:32:11 +09:00
parent 75ce583d0b
commit fa42ef7561
6 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,7 @@ Use reports in the Report Directory as the primary source of truth. If additiona
- Update relevant tests when modifying existing code
- Test file placement: follow the project's conventions
- Running tests is mandatory. After completing implementation, always run tests and verify results
- When introducing new contract strings (file names, config key names, etc.), define them as constants in one place
**Scope output contract (create at the start of implementation):**
```markdown

View File

@ -8,6 +8,7 @@ Do not review AI-specific issues (already covered by the ai_review movement).
- Test coverage
- Dead code
- Call chain verification
- Scattered hardcoding of contract strings (file names, config key names)
**Previous finding tracking (required):**
- First, extract open findings from "Previous Response"

View File

@ -284,6 +284,7 @@ function formatPercentage(value: number): string { ... }
- **Direct mutation of objects/arrays** - Create new instances with spread operators
- **console.log** - Do not leave in production code
- **Hardcoded secrets**
- **Scattered hardcoded contract strings** - File names and config key names must be defined as constants in one place. Scattered literals are prohibited
- **Scattered try-catch** - Centralize error handling at the upper layer
- **Unsolicited backward compatibility / legacy support** - Not needed unless explicitly instructed
- **Internal implementation exported from public API** - Only export domain-level functions and types. Do not export infrastructure functions or internal classes

View File

@ -7,6 +7,7 @@ Report Directory内のレポートを一次情報として参照してくださ
- 既存コードを変更した場合は該当するテストを更新
- テストファイルの配置: プロジェクトの規約に従う
- テスト実行は必須。実装完了後、必ずテストを実行して結果を確認
- ファイル名・設定キー名などの契約文字列を新規導入する場合は、定数として1箇所で定義すること
**Scope出力契約実装開始時に作成:**
```markdown

View File

@ -8,6 +8,7 @@ AI特有の問題はレビューしないでくださいai_reviewムーブメ
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
- 契約文字列(ファイル名・設定キー名)のハードコード散在
**前回指摘の追跡(必須):**
- まず「Previous Response」から前回の open findings を抽出する

View File

@ -284,6 +284,7 @@ function formatPercentage(value: number): string { ... }
- **オブジェクト/配列の直接変更** - スプレッド演算子で新規作成
- **console.log** - 本番コードに残さない
- **機密情報のハードコーディング**
- **契約文字列のハードコード散在** - ファイル名・設定キー名は定数で1箇所管理。リテラルの散在は禁止
- **各所でのtry-catch** - エラーは上位層で一元処理
- **後方互換・Legacy対応の自発的追加** - 明示的な指示がない限り不要
- **内部実装のパブリック API エクスポート** - 公開するのはドメイン操作の関数・型のみ。インフラ層の関数や内部クラスをエクスポートしない