From 9a25d6272e722d17f4fa03e240353f3e3a1857df Mon Sep 17 00:00:00 2001 From: Jon Steinich Date: Wed, 9 Sep 2026 08:09:48 -0500 Subject: [PATCH 1/2] test(tests): re-enable the Python edge integration test Skipped in 3acb935 (Dec 2022) waiting on aws/jsii#3866, with the intent to "re-add them when updating JSII". That fix shipped long ago and the JSII update has now landed (#395: jsii 6.0, jsii-pacmak 1.140.0), but the skip was never lifted. Python is the only language whose edge test does not run - typescript, go, java and csharp all do. That gap has cost us: it is why #311's cross-language compile coverage never saw the broken Python provider import that only surfaced once CI could reach Terraform >= 1.8 (#398), via the python-documentation example rather than a test aimed at it. The test is a real guard for that class of bug rather than a hopeful one. `main.py` calls `edge.provider.EdgeProvider(...)`, so `beforeAll`'s synth imports the generated `edge.provider` module - exactly the module whose `__init__.py` carried the unresolvable import. A regression there fails the whole suite loudly. The fixture is not stale: `main.py` defines the same reference/provider/ iterator stacks as the TypeScript edge fixture, and the helpers it imports (`QueryableStack`, `TestDriver`, `onlyJson`) are the ones the other language edge tests use. Verified on main that the underlying defect is gone: the regenerated edge-provider bindings now emit `_LazyImport("edge.provider_functions")` in `edge/provider/__init__.py`, and all 21 relative imports in the generated Python resolve. Co-Authored-By: Claude Opus 5 --- test/python/edge/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/python/edge/test.ts b/test/python/edge/test.ts index 4754254ec..443ac0db0 100644 --- a/test/python/edge/test.ts +++ b/test/python/edge/test.ts @@ -4,7 +4,7 @@ import { QueryableStack, TestDriver, onlyJson } from "../../test-helper"; import * as path from "path"; import * as fs from "fs-extra"; -describe.skip("full integration test", () => { +describe("full integration test", () => { let driver: TestDriver; beforeAll(async () => { From 7ae267922468f00beb333286c2e238859582d5c8 Mon Sep 17 00:00:00 2001 From: Jon Steinich Date: Wed, 9 Sep 2026 12:53:44 -0500 Subject: [PATCH 2/2] test(tests): correct two stale expectations in the Python edge test CI on the re-enabled suite came back 18 passed / 2 failed. Both failures were stale expectations in the test, not product bugs - these assertions were written before Dec 2022 and have never executed since. 1. The numList expectation carried a stray closing paren: `...reqnum)}` where the synthesized value is `...reqnum}`. 2. The map expectations assumed every `Fn.lookup(map, key, default)` renders as a Terraform `lookup()`. It does not. `Fn.lookup` (packages/cdktn/src/terraform-functions.ts:41) emits `lookup()` only when the default value is *truthy*: if (defaultValue) return Fn._lookup(inputMap, key, [defaultValue]); return asAny(propertyAccess(inputMap, [key])); The fixture passes `false` for reqMap and `0` for computedMap - both falsy - so those render as property access (`map_resource.map.reqMap.key1`), while optMap's `"missing"` default keeps its `lookup()`. That rule, not anything about required vs optional vs computed attributes, is what decides the form. The corrected expectations are identical to test/typescript/edge/test.ts, which has been running throughout. Only the first failing assertion in each block was reported, so the rest of the map block was corrected at the same time rather than surfacing them one CI run at a time. These pin current behaviour, which is not obviously desirable behaviour: the truthiness guard silently discards a legitimate `false` or `0` default, so the emitted expression loses its fallback and errors on a missing key instead of returning the default. Raised separately; if that is fixed, these expectations move with it. Co-Authored-By: Claude Opus 5 --- test/python/edge/test.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/test/python/edge/test.ts b/test/python/edge/test.ts index 443ac0db0..75e2f595d 100644 --- a/test/python/edge/test.ts +++ b/test/python/edge/test.ts @@ -124,7 +124,7 @@ describe("full integration test", () => { "${list_block_resource.list.req[0].reqstr}", ]); expect(item.numList).toEqual([ - "${element(list_block_resource.list.req, 0).reqnum)}", + "${element(list_block_resource.list.req, 0).reqnum}", ]); }); @@ -168,24 +168,16 @@ describe("full integration test", () => { const item = stack.byId("from_map"); // Expands map references - expect(item.bool).toEqual( - '${lookup(map_resource.map.reqMap, "key1", false)}', - ); + expect(item.bool).toEqual("${map_resource.map.reqMap.key1}"); expect(item.str).toEqual( '${lookup(map_resource.map.optMap, "key1", "missing")}', ); - expect(item.num).toEqual( - '${lookup(map_resource.map.computedMap, "key1", 0)}', - ); - expect(item.boolList).toEqual([ - '${lookup(map_resource.map.reqMap, "key1", false)}', - ]); + expect(item.num).toEqual("${map_resource.map.computedMap.key1}"); + expect(item.boolList).toEqual(["${map_resource.map.reqMap.key1}"]); expect(item.strList).toEqual([ '${lookup(map_resource.map.optMap, "key1", "missing")}', ]); - expect(item.numList).toEqual([ - '${lookup(map_resource.map.computedMap, "key1", 0)}', - ]); + expect(item.numList).toEqual(["${map_resource.map.computedMap.key1}"]); }); onlyJson("item references a full map", () => {