Skip to content

Commit bd9da62

Browse files
ndemiancCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent b38f4bb commit bd9da62

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

extensions/levelcode-ai/test/agentMaxSteps.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ test('extension.js does NOT re-snapshot the cap from the goal-start cfg (the ori
6363

6464
test('agent.js gates the loop on ctx.maxSteps directly, and never hoists it into a local', () => {
6565
const ag = read('agent.js');
66-
assert.match(ag, /while\s*\(\s*step\+\+\s*<\s*ctx\.maxSteps\s*\)/, 'the step loop must read ctx.maxSteps live');
66+
assert.match(ag, /while\s*\([^)]*\bctx\.maxSteps\b[^)]*\)/, 'the step loop must read ctx.maxSteps live');
6767
// A copy (`const max = ctx.maxSteps`) or a destructure (`const { maxSteps } = ctx`) taken before the
6868
// loop would evaluate the getter exactly once — reintroducing the snapshot from the other side.
69-
assert.ok(!/=\s*ctx\.maxSteps\b/.test(ag), 'ctx.maxSteps must not be assigned into a variable');
69+
assert.ok(!/\b(?:const|let|var)\s+\w+\s*=\s*ctx\.maxSteps\b/.test(ag), 'ctx.maxSteps must not be assigned into a variable');
7070
assert.ok(
7171
!/\b(?:const|let|var)\s*\{[^}]*\bmaxSteps\b[^}]*\}\s*=\s*ctx\b/.test(ag),
7272
'maxSteps must not be destructured off ctx'

0 commit comments

Comments
 (0)