Skip to content

Commit 7fdda3d

Browse files
committed
test(cdk): make the _KNOWN_WRITEABLE_WORKFLOW_IDS parser tolerant of ruff's frozenset formatting (aws-samples#247 PR aws-samples#373)
The workflows contract test (CDK descriptors ↔ agent config) parses _KNOWN_WRITEABLE_WORKFLOW_IDS out of agent/src/config.py with a regex that required frozenset((…)) with adjacent parens. When the earlier lint pass ran ruff format on config.py it expanded the frozenset to multi-line (frozenset(\n (\n "…",\n )\n)), so the regex returned null and the test failed (1 of 2574). Fix: tolerate whitespace between the parens (frozenset\(\s*\(…\)\s*\)) so it matches either single- or multi-line formatting. 21 workflows tests green; regex verified against the live config.py shape.
1 parent d072709 commit 7fdda3d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

cdk/test/handlers/shared/workflows.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ describe('CDK descriptors stay in sync with agent/workflows/**', () => {
211211
const configPy = fs.readFileSync(
212212
path.resolve(__dirname, '../../../../agent/src/config.py'), 'utf8',
213213
);
214-
const match = configPy.match(/_KNOWN_WRITEABLE_WORKFLOW_IDS\s*=\s*frozenset\(\(([^)]*)\)\)/s);
214+
// Tolerate ruff's formatting of the frozenset: it may render single-line
215+
// ``frozenset(("a", "b"))`` or multi-line with whitespace between the parens.
216+
const match = configPy.match(/_KNOWN_WRITEABLE_WORKFLOW_IDS\s*=\s*frozenset\(\s*\(([^)]*)\)\s*\)/s);
215217
expect(match).not.toBeNull();
216218
const agentWriteable = new Set(
217219
[...match![1].matchAll(/"([^"]+)"/g)].map(m => m[1]),

0 commit comments

Comments
 (0)