Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

test(runners): cover newline callback alias invalidation [C7]

Corey Olsona40803671171
diff --git a/test/cpu-callable-options.test.js b/test/cpu-callable-options.test.js
index 4871e820..c6ac7947 100644
--- a/test/cpu-callable-options.test.js
+++ b/test/cpu-callable-options.test.js
@@ -18,3 +18,18 @@ test('an unshadowed function callback has no CPU options [C7]', () => {
assert.equal(cpuLoadOptionsIn(["import test from 'node:test'; function callback() {} test('busy', { cpuLoad: true }, callback);"])[0], true,
'proven callbacks cannot erase a genuine options argument');
});
+
+for (const [kind, declarations, selected] of [
+ ['single newline alias', 'const first = callback\n', 'first'],
+ ['newline alias chain', 'const first = callback\nconst second = first\n', 'second'],
+]) test(`a ${kind} retains opaque options after its source is reassigned [C7]`, () => {
+ const source = `import test from 'node:test'; function callback() {} callback = makeOptions(); ${declarations}test('pending', ${selected});`;
+ assert.equal(cpuLoadOptionsIn([source])[0], true,
+ 'automatic semicolon insertion cannot preserve invalidated callable evidence');
+});
+
+test('an unmodified callable alias works with automatic semicolon insertion [C7]', () => {
+ const source = "import test from 'node:test'; function callback() {} const first = callback\nconst second = first\ntest('ordinary', second);";
+ assert.equal(cpuLoadOptionsIn([source])[0], false,
+ 'the fix retains a real callable alias without any CPU options');
+});