Repository navigation
feat(#986): SOLID 強制を harness に実装 (file-too-large / handler-no-direct-sdk-import + biome complexity) - #1004
Conversation
…ule を追加 (SOLID 強制) Why: Issue #986 (SOLID 監査 epic) の Phase A として、 architecture harness に SRP / DIP の機械検査を入れる。 既存違反は baseline で許容しつつ、 新規追加を block する ratchet 構造にして、 1 PR で 「ついで」 に 500 行 / 800 行を超えるファイルや、 handler/index.ts からの直 SDK import を増やせなくする。 Changes: - file-too-large: .ts/.tsx で 500 行超 = warning、 800 行超 = error 対象 path: infrastructure/lib/、 apps/*/src/、 scripts/、 packages/*/src/ .test.ts は除外 (= SRP 別軸) match に "ge-500-lines" / "ge-800-lines" bucket を入れ、 1 行増減で baseline match が 外れない設計 (= 既存違反の細々した行数変動が PR を blockしないように) - handler-no-direct-sdk-import: infrastructure/lib/<...>/handlers/<x>/index.ts で @aws-sdk/client-* / @aws-sdk/lib-* import を warning (= index.ts は HTTP routing 専属、 SDK 呼び出しは service / repository 層に分離する DIP) service.ts / shared.ts / 他 non-index は対象外 - cli.ts: baselines/ ディレクトリの *.json をすべて load して merge する形式に拡張 既存 adr-self-contained.json と並んで、 rule ごとの baseline ファイルを置けるように - baselines/file-too-large.json (11 entries) と baselines/handler-no-direct-sdk-import.json (8 entries) を初期登録 既存違反は Issue #986 Phase B / C / D で順次解消する - regenerate-baselines.ts: baseline 再生成 CLI (= adopt rule 時の一発生成) - biome.json: noExcessiveCognitiveComplexity = warn (max 15) 既存 93 関数が違反しているため warn (= CI block しない)、 段階的に refactor して 将来 error に格上げ。 spirit は CLAUDE.md の 「config を緩めて誤魔化さない」 ではなく 「新規 enforcement の追加」 なので config 編集を許容。 Test: - file-too-large.test.ts (8 ケース) + handler-no-direct-sdk-import.test.ts (7 ケース) - make harness-test: 20 tests passed - make harness: no findings Regression 分析: - 既存 PR 作成パスへの影響なし (= warn / 既存違反は baseline で吸収) - 新規に 500 行超のファイルを足す PR は warning で見える化、 800 行は error で停止 - 新規 handler index.ts で SDK 直 import する PR は warning で見える化 物理影響: - CFn: NO-OP - CI: harness rule 追加分の inspect 時間 +N ms (= 552 file × small grep、 無視可) Closes part of #986 (= SOLID 監査 epic Phase A) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request adds two new architecture linting rules to enforce code organization: ChangesArchitecture Rules and Baseline System
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1004 +/- ##
=======================================
Coverage ? 92.95%
=======================================
Files ? 8
Lines ? 227
Branches ? 66
=======================================
Hits ? 211
Misses ? 16
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Issue #986 (SOLID 監査 epic) の Phase A: 機械検査の整備。 既存違反を baseline で許容しつつ、 新規追加を block する ratchet 構造を入れる。
何を解決するか
「ついで」 で 500 行超のファイルや、 SDK を直叩きする handler index.ts を追加させない。 既存違反は #986 の Phase B / C / D で順次解消。 SOLID 5 原則のうち SRP / DIP を機械化し、 OCP / LSP / ISP は後段で 別 rule (例: handler-deps-on-abstraction、 lsp-test-contract) を追加して詰める。
Test plan
Regression 分析
物理影響
Closes part of #986 (Phase A)
Summary by CodeRabbit
Release Notes
New Features
Tests
Chores