Commit 9d03026
committed
fix(s3): correct the would-have-caught claim, harden the strip-probes, and guard a null EventBridge block
Review fix-back for #1437. The headline correction: this target's central claim
was FALSE, and the tests that were supposed to prove it were passing for the
wrong reason.
WHAT THE CRITIC WOULD ACTUALLY HAVE CAUGHT. Measured by running it against the
REAL pre-#1426 provider (`git show 768cd44^`) rather than predicted: it flags
`Transition`, `NoncurrentVersionTransition` and `NoncurrentVersionExpirationInDays`
-- the legacy-singular defect. Issue #1430 predicted `TagFilters`,
`NoncurrentVersionTransitions[].TransitionInDays` and rule-level
`ExpiredObjectDeleteMarker`, and was wrong on all three:
- `TagFilters` (16 literal sites pre-#1426) and `TransitionInDays` (2) are also
named by `readCurrentState`'s reverse map, so the file-global literal
heuristic reports `provider-handled` however broken the write path is. That
is item 2 of #1393.
- `ExpiredObjectDeleteMarker` is not shape-audited at all: the shape pass
matches CFn definitions to same-named SDK interfaces, and
`@aws-sdk/client-s3` spells it `LifecycleRule`, so CFn's `Rule` sits in
`unmatchedDefinitions` and the whole lifecycle-rule blob is unaudited.
The strip-probes inherited the wrong list, and `replaceAll` hid it by deleting
EVERY occurrence -- a regression shape that cannot occur. They now probe only
keys a realistic single-site regression can actually silence, and each probe
ASSERTS the key left `collectStringLiterals`'s evidence set before asserting
the bucket. That self-validation immediately caught a second miss: the read-side
fix makes `EventBridgeEnabled` an object-literal property name as well as a
quoted literal, so stripping only `'EventBridgeEnabled'` left it in evidence. A
new test pins the honest limit -- removing ONLY TagFilters' write-side
conversion must still classify `provider-handled` -- so nobody re-adds the
false claim.
Provider fixes:
- `EventBridgeConfiguration: null` threw. The branch now reads a member off the
block, so an explicit null (hand-written JSON, or an intrinsic resolving to
null) hit `Cannot read properties of null` where the pre-change
`eb !== undefined` test merely emitted. Guarded with the file's existing
`isPlainObject`; non-objects stay on the enable-on-presence side.
- `coerceCfnBoolean` is now case-insensitive. This is the one call site where
"not false" means "turn it on", so `'False'` falling through to `undefined`
would silently ENABLE delivery -- the exact inversion this PR fixes.
- The `readCurrentState` comment claimed the always-emit is invisible to a state
record with no `EventBridgeConfiguration` key. Not true: `cdkd drift` uses
`unionWalkObjects: true`, so upgrading reports ONE cosmetic diff per bucket
until the next `state refresh-observed` / `drift --accept` / real UPDATE. The
comment now says so, matching the convention in ec2 / ssm / s3-tables.
Tests: +6 units (case variants, null block, EventBridge-false alongside a Topic
config, and the true -> false UPDATE flip, which no existing test covered since
they all start from a bare previous state). The round-trip test was vacuous --
with the read fix reverted the reader returns `{}`, which the write path also
emits as `{}` -- so it is split, and the DISCRIMINATING direction is now
covered: the disabled shape fed back through the write path must NOT re-enable
delivery, which is what a `drift --revert` would do.
The `#1378` definitionShapes fence sorts before picking its stand-in fixture
(`readdirSync` order differs between macOS and CI) and requires a string
`resourceType`, so it cannot pick the bookkeeping file and throw a TypeError
instead of the assertion it means to make.
Integ: the EventBridge + drift assertions are factored into functions and run
after BOTH phases, so the `diffSubConfig` -> `applyNotificationConfiguration`
UPDATE call site is covered against real AWS too. Re-run: PASS, destroy 3
deleted / 0 errors / 0 orphans.
Also corrects "the largest target" (CloudFront Distribution is 121 keys, S3 is
115) in `.claude/rules/code-layout.md`.1 parent 5ec26e5 commit 9d03026
8 files changed
Lines changed: 316 additions & 78 deletions
File tree
- .claude/rules
- docs
- _generated
- scripts
- src/provisioning/providers
- tests
- integration/s3-lifecycle
- unit
- provisioning
- scripts
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
245 | 262 | | |
246 | 263 | | |
247 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| |||
873 | 881 | | |
874 | 882 | | |
875 | 883 | | |
876 | | - | |
877 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
878 | 893 | | |
879 | 894 | | |
880 | 895 | | |
| |||
2352 | 2367 | | |
2353 | 2368 | | |
2354 | 2369 | | |
2355 | | - | |
2356 | | - | |
2357 | | - | |
2358 | | - | |
2359 | | - | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
2360 | 2386 | | |
2361 | 2387 | | |
2362 | 2388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
216 | 220 | | |
217 | 221 | | |
218 | 222 | | |
219 | | - | |
220 | | - | |
| 223 | + | |
| 224 | + | |
221 | 225 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
253 | 266 | | |
254 | 267 | | |
255 | 268 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
266 | 283 | | |
267 | 284 | | |
268 | 285 | | |
| |||
293 | 310 | | |
294 | 311 | | |
295 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
296 | 316 | | |
297 | 317 | | |
298 | 318 | | |
| |||
302 | 322 | | |
303 | 323 | | |
304 | 324 | | |
305 | | - | |
| 325 | + | |
306 | 326 | | |
307 | 327 | | |
308 | 328 | | |
| |||
0 commit comments