cdk-preflight 0.0.131 → 0.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -31,7 +31,7 @@ cdk-preflight のルール追加パイプライン。AGENTS.md の設計原則
|
|
|
31
31
|
- fail テンプレートがデプロイに**成功**したら、それはドキュメント側の誤り(BROKEN-EXPECTATION)。ルールを削除し、証拠を issue に残して終了する。CloudFront では明文化された制約 9 件中 3 件がこれだった(2026-09-02)
|
|
32
32
|
- **予想と違う理由**で失敗した場合(他アカウントの ARN、ドメイン所有権の検証など)は証拠にならない。サービスエラーが対象の制約そのものを名指しするまでテンプレートを作り直すか、除去できない交絡は `evidence` に明記する
|
|
33
33
|
- `doc-only` は「再現に安価に作れないリソース(検証済み ACM 証明書、所有ドメイン等)が要る」場合に限る最終手段であって、まだ試していない制約への近道ではない。詳細は AGENTS.md の "A doc sentence is a hypothesis, not evidence" に従う
|
|
34
|
-
6. **仕上げ**: `npx projen build` 全緑 → ブランチ作成 → conventional commit(`feat(rules): add <rule-id>`)→ PR 本文に: 制約の出典 / 重複チェック結果 / 実機再現ログ。
|
|
34
|
+
6. **仕上げ**: `npx projen build` 全緑 → ブランチ作成 → **コミットするのは `rules/**` だけ**(`src/rules.generated.ts` は gitignore 済み、`docs/rules.md` と README のバッジ・リソース表は `bundle-docs` が main で書く。ここを触らないので PR 同士が衝突しない)→ conventional commit(`feat(rules): add <rule-id>`)→ PR 本文に: 制約の出典 / 重複チェック結果 / 実機再現ログ。
|
|
35
35
|
|
|
36
36
|
## セッションの切り方(コンテキスト予算)
|
|
37
37
|
|
|
@@ -73,7 +73,8 @@ rule-discovery issue 1 本(例 #64 Glue + Athena)を、**棚卸しから PR
|
|
|
73
73
|
4. **課金物の禁止**: 禁止リソース型を名指しし、「**create API を呼ぶ前に落とす**」「pass フィクスチャを作らない
|
|
74
74
|
(`--fail-only`)」「既存の無料下敷きは消さない」。`絶対に課金パネルのリソースを作らない`はユーザーの明示指示
|
|
75
75
|
5. **git の縛り**: `main` に直接コミットしない / ブランチを切る / **push も `gh pr create` もしない** /
|
|
76
|
-
コミットメッセージに attribution 行を入れない
|
|
76
|
+
コミットメッセージに attribution 行を入れない / **コミットするのは `rules/**` だけ**
|
|
77
|
+
(生成物は `src/rules.generated.ts` が gitignore、`docs/rules.md` と README は `bundle-docs` が main で書く)
|
|
77
78
|
6. **報告の型**(下記)と「日本語で」
|
|
78
79
|
7. **迷ったら減らす方向に倒せ**。中途半端なルールを 1 本入れるより、確実な本数だけ入れて残りを報告させる
|
|
79
80
|
|
|
@@ -96,6 +97,7 @@ ls rules/<svc> | wc -l # 本
|
|
|
96
97
|
npx ts-node --transpile-only --project test/tsconfig.json scripts/rule-check.ts check <svc> # 0 NG か
|
|
97
98
|
grep -rl '<禁止リソース型>' rules/<svc> | wc -l # 課金物が 0 件か
|
|
98
99
|
git log --oneline -1 && git branch --show-current # コミットがあり main でないか
|
|
100
|
+
git diff --name-only origin/main.. | grep -v '^rules/' | head # rules/ 以外を触っていないか(生成物は非コミット)
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
B の後は課金物の実在確認も回す(例 `aws athena list-capacity-reservations`)。**食い違ったら同じエージェントに
|
package/.jsii
CHANGED
|
@@ -9600,6 +9600,6 @@
|
|
|
9600
9600
|
"symbolId": "src/index:PreflightOptions"
|
|
9601
9601
|
}
|
|
9602
9602
|
},
|
|
9603
|
-
"version": "0.0.
|
|
9604
|
-
"fingerprint": "
|
|
9603
|
+
"version": "0.0.133",
|
|
9604
|
+
"fingerprint": "7kYXGn7cBxQgUaMzq6pmUm3+TXne6hBlcXUNtBASSds="
|
|
9605
9605
|
}
|
package/AGENTS.md
CHANGED
|
@@ -78,7 +78,7 @@ The two failure modes are watched separately: **staleness** (the constraint disa
|
|
|
78
78
|
Then:
|
|
79
79
|
|
|
80
80
|
1. `rm -rf rules/<service>/<rule-id>/` — delete outright, no tombstone. `upstream: retired` exists for a rule mid-flight, not for a corpse.
|
|
81
|
-
2. `npx projen bundle-rules` (regenerates `src/rules.generated.ts
|
|
81
|
+
2. `npx projen bundle-rules` (regenerates `src/rules.generated.ts`; the file is gitignored, so nothing to commit).
|
|
82
82
|
3. One line in the PR body naming the engine rule id that replaced it.
|
|
83
83
|
|
|
84
84
|
Users pinned to an older `aws-cdk-lib` keep the old behavior by staying on the older cdk-preflight, so a deletion never leaves them uncovered.
|
|
@@ -97,7 +97,7 @@ rules/_lib/<name>.rego # shared helpers (never emit violations); loaded bef
|
|
|
97
97
|
# regardless of `exclude` — so a rule may depend on a lib but never on another rule
|
|
98
98
|
src/index.ts # Preflight.apply / PreflightOptions (jsii surface — keep minimal)
|
|
99
99
|
src/private/enforce.ts # enforce-mode plugin (calls the engine directly)
|
|
100
|
-
src/rules.generated.ts # GENERATED from rules/
|
|
100
|
+
src/rules.generated.ts # GENERATED from rules/ and GITIGNORED — `npx projen bundle-rules` (runs in preCompile)
|
|
101
101
|
scripts/bundle-rules.ts # generator + structural validation
|
|
102
102
|
scripts/rule-check.ts # one-process local gates: `guard` (bare engine) and `check` (fixtures, pre-bundle)
|
|
103
103
|
test/ # 4 layers: rules / loader / structure / cli
|
|
@@ -151,10 +151,16 @@ If you are a subagent running one of these phases, do not spawn further agents.
|
|
|
151
151
|
- **Cheap screen for definition-level constraints**: some services expose their create-time validator as a free API (`aws stepfunctions validate-state-machine-definition --type STANDARD|EXPRESS` is the same validator CreateStateMachine runs). Use it to triage doc hypotheses before spending a CloudFormation deploy on each — 100 Step Functions hypotheses took minutes (2026-09-05). The real-deploy gate stays.
|
|
152
152
|
3. `npx ts-node --transpile-only --project test/tsconfig.json scripts/rule-check.ts check <service|rule-id>` while iterating: it reads `rules/` straight from disk into a single engine (no bundle, no meta validation, no jest) and reports, per rule, whether the fail template fires its own rule, the pass template is silent for every rule, and neither trips a built-in ERROR/FATAL. Then `npx projen bundle-rules` and `npx jest test/rules test/structure.test.ts` (the `test/rules` pattern picks up both `rules.test.ts` and the `rules.shard*.test.ts` files that carry the per-rule table) — the duplication guard and fixture checks run there for real. Prefer `jest -t` while iterating; the full suite is ~11,400 tests / ~2.5 min on 8 cores (measured 2026-09-14), so keep it for the pre-PR run.
|
|
153
153
|
4. **Real-deploy gate**: `bash bench/verify-rule.sh <rule-id>` deploys the fail template (expects CREATE to fail; records the service error message) and, where cheap, the pass template (expects success, then deletes). Paste the observed error into `meta.yaml#repro.evidence` with the date. Only `doc-only` rules may skip this, with justification.
|
|
154
|
-
5. Update nothing else by hand
|
|
155
|
-
|
|
156
|
-
`
|
|
157
|
-
|
|
154
|
+
5. Update nothing else by hand, and **do not commit the generated artifacts** — a rule PR touches `rules/**` and
|
|
155
|
+
nothing else. `src/rules.generated.ts` is gitignored and written by `npx projen bundle-rules`, which `preCompile`
|
|
156
|
+
spawns on every build. `docs/rules.md` and the parts of `README.md` between the `<!-- supported-resources:start -->`
|
|
157
|
+
markers (plus the rule-count badge) stay committed but are written **only** by `npx projen bundle-docs`, which the
|
|
158
|
+
release workflow's self-mutation step runs on `main`. Keeping them out of the PR diff is what makes two rule PRs
|
|
159
|
+
mergeable in either order: before this split, every pair of rule PRs conflicted on those three files and each merge
|
|
160
|
+
forced the rest to rebase and regenerate.
|
|
161
|
+
|
|
162
|
+
Consequence for a fresh clone: run `npx projen bundle-rules` once before `npx jest` or anything else that imports
|
|
163
|
+
`src/rules.generated.ts` — it does not exist until a build writes it.
|
|
158
164
|
|
|
159
165
|
## Commands
|
|
160
166
|
|
|
@@ -162,7 +168,8 @@ If you are a subagent running one of these phases, do not spawn further agents.
|
|
|
162
168
|
|---|---|
|
|
163
169
|
| Local rule gates, one process (pre-bundle) | `npx ts-node --transpile-only --project test/tsconfig.json scripts/rule-check.ts check [service\|rule-id]` |
|
|
164
170
|
| Duplication guard for candidate templates | `... scripts/rule-check.ts guard <dir>` |
|
|
165
|
-
| Regenerate bundle
|
|
171
|
+
| Regenerate the bundle (gitignored) | `npx projen bundle-rules` |
|
|
172
|
+
| Regenerate docs/rules.md + README (main only) | `npx projen bundle-docs` |
|
|
166
173
|
| Unit tests | `npx jest` |
|
|
167
174
|
| Full build (jsii, lint, tests, package) | `npx projen build` |
|
|
168
175
|
| Real-deploy verification for one rule | `bash bench/verify-rule.sh <rule-id>` |
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const rules_generated_1 = require("./rules.generated");
|
|
|
17
17
|
* Preflight.apply(app);
|
|
18
18
|
*/
|
|
19
19
|
class Preflight {
|
|
20
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-preflight.Preflight", version: "0.0.
|
|
20
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-preflight.Preflight", version: "0.0.133" };
|
|
21
21
|
/**
|
|
22
22
|
* Register the cdk-preflight rules on an App or Stage.
|
|
23
23
|
*/
|