cdk-preflight 0.0.132 → 0.0.134

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.132",
9604
- "fingerprint": "wqI7UEMjCSX+oicqyH23MeqZpkqg5eTHgnSsAuXBAcg="
9603
+ "version": "0.0.134",
9604
+ "fingerprint": "pAxrVkGHKZrj+c4vLAwzad5Dnt7MVMBAgHWM5gOkslw="
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` and `docs/rules.md`).
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/ — never edit; run `npx projen bundle-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 — `docs/rules.md`, `src/rules.generated.ts`, and the parts of `README.md` between the
155
- `<!-- supported-resources:start -->` markers (plus the rule-count badge) are all written by `npx projen bundle-rules`.
156
- `test/structure.test.ts` fails when any of them is stale, so adding a rule that touches a new resource type cannot
157
- silently leave the README's supported-resource list behind.
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 + docs | `npx projen bundle-rules` |
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/docs/rules.md CHANGED
@@ -800,9 +800,7 @@
800
800
  | `pf-codebuild-badge-not-supported-for-s3-source` | AWS::CodeBuild::Project | Build badges are not enabled on an S3 or source-less project | ERROR | none |
801
801
  | `pf-codebuild-badge-not-with-codepipeline-source` | AWS::CodeBuild::Project | Build badges are not enabled on a CODEPIPELINE project | ERROR | none |
802
802
  | `pf-codebuild-build-batch-timeout-range` | AWS::CodeBuild::Project | The batch build timeout stays between 5 and 2160 minutes | ERROR | none |
803
- | `pf-codebuild-cache-docker-layer-linux-only` | AWS::CodeBuild::Project | PrivilegedMode is not set on a Windows environment | ERROR | none |
804
803
  | `pf-codebuild-cache-local-requires-modes` | AWS::CodeBuild::Project | A LOCAL cache names its modes | ERROR | none |
805
- | `pf-codebuild-cache-location-ignored-for-local` | AWS::CodeBuild::Project | LOCAL_SOURCE_CACHE goes with a project that has a source | ERROR | none |
806
804
  | `pf-codebuild-cache-s3-requires-location` | AWS::CodeBuild::Project | An S3 cache names the bucket and prefix | ERROR | none |
807
805
  | `pf-codebuild-compute-type-environment-type` | AWS::CodeBuild::Project | The Lambda compute types go with a Lambda environment type | ERROR | none |
808
806
  | `pf-codebuild-concurrent-build-limit-range` | AWS::CodeBuild::Project | The per-project concurrent build limit is at least 1 | ERROR | none |
@@ -810,11 +808,13 @@
810
808
  | `pf-codebuild-encryption-key-region` | AWS::CodeBuild::Project | The build output encryption key lives in the project's Region | ERROR | none |
811
809
  | `pf-codebuild-environment-variable-name-reserved` | AWS::CodeBuild::Project | Environment variable names stay off the reserved CODEBUILD_ prefix | ERROR | none |
812
810
  | `pf-codebuild-environment-variable-name-unique` | AWS::CodeBuild::Project | Environment variable names are unique within a project | ERROR | none |
813
- | `pf-codebuild-file-system-identifier-charset` | AWS::CodeBuild::Project | A project that mounts a file system runs in privileged mode | ERROR | none |
814
811
  | `pf-codebuild-file-system-location-format` | AWS::CodeBuild::Project | An EFS mount location names the file system and the directory | ERROR | none |
812
+ | `pf-codebuild-file-system-locations-need-privileged-mode` | AWS::CodeBuild::Project | A project that mounts a file system runs in privileged mode | ERROR | none |
815
813
  | `pf-codebuild-git-submodules-config-git-sources-only` | AWS::CodeBuild::Project | Git submodules are only configured on a git-backed source | ERROR | none |
816
814
  | `pf-codebuild-lambda-compute-no-privileged-mode` | AWS::CodeBuild::Project | PrivilegedMode is not set on the Lambda compute mode | ERROR | none |
815
+ | `pf-codebuild-local-source-cache-needs-source` | AWS::CodeBuild::Project | LOCAL_SOURCE_CACHE goes with a project that has a source | ERROR | none |
817
816
  | `pf-codebuild-logs-s3-requires-location` | AWS::CodeBuild::Project | Enabled S3 build logs name the bucket and prefix | ERROR | none |
817
+ | `pf-codebuild-privileged-mode-not-on-windows` | AWS::CodeBuild::Project | PrivilegedMode is not set on a Windows environment | ERROR | none |
818
818
  | `pf-codebuild-project-description-length` | AWS::CodeBuild::Project | The project description stays within 255 characters | ERROR | none |
819
819
  | `pf-codebuild-project-name-length` | AWS::CodeBuild::Project | The project name stays within 150 characters | ERROR | none |
820
820
  | `pf-codebuild-report-build-status-provider` | AWS::CodeBuild::Project | ReportBuildStatus is only set on a source provider that reports status | ERROR | none |
@@ -823,7 +823,7 @@
823
823
  | `pf-codebuild-secondary-artifact-identifier-unique` | AWS::CodeBuild::Project | Secondary artifact identifiers are unique within a project | ERROR | none |
824
824
  | `pf-codebuild-secondary-artifacts-identifier-required` | AWS::CodeBuild::Project | Every secondary artifact carries an ArtifactIdentifier | ERROR | none |
825
825
  | `pf-codebuild-secondary-artifacts-max-12` | AWS::CodeBuild::Project | A project declares at most 12 secondary artifacts | ERROR | none |
826
- | `pf-codebuild-secondary-artifacts-no-codepipeline` | AWS::CodeBuild::Project | Secondary artifacts publish to S3 | ERROR | none |
826
+ | `pf-codebuild-secondary-artifacts-s3-only` | AWS::CodeBuild::Project | Secondary artifacts publish to S3 | ERROR | none |
827
827
  | `pf-codebuild-secondary-source-identifier-unique` | AWS::CodeBuild::Project | Secondary source identifiers are unique within a project | ERROR | none |
828
828
  | `pf-codebuild-secondary-sources-identifier-required` | AWS::CodeBuild::Project | Every secondary source carries a SourceIdentifier | ERROR | none |
829
829
  | `pf-codebuild-secondary-sources-max-12` | AWS::CodeBuild::Project | A project declares at most 12 secondary sources | ERROR | none |
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.132" };
20
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-preflight.Preflight", version: "0.0.134" };
21
21
  /**
22
22
  * Register the cdk-preflight rules on an App or Stage.
23
23
  */