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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(browser): preserve exact printf capture shape [C7]
Corey Olson43745bfd581e
diff --git a/src/browser-admission.js b/src/browser-admission.jsindex 8369c1b3..03d15ee9 100644--- a/src/browser-admission.js+++ b/src/browser-admission.js@@ -105,10 +105,8 @@ function capturedRunner(command) {const inner = command.slice(opening[0].length, bodyEnd);const suffix = command.slice(bodyEnd + ending.length);const quotes = ['"', "'"];- // These are the two literal printf newline encodings used by current frozen checks. Keep- // the surrounding command exact: only quote choice and one/two backslashes may vary.- const prints = quotes.flatMap(quote => [1, 2].map(count =>- `printf ${quote}%s${'\\'.repeat(count)}n${quote} "$${variable}"`));+ // Only the literal one-backslash newline form is part of the frozen capture shape.+ const prints = quotes.map(quote => `printf ${quote}%s\\n${quote} "$${variable}"`);for (const firstPrint of prints) for (const secondPrint of prints) {const prefix = `; ${firstPrint}; ${secondPrint} | grep -Eq `;if (!suffix.startsWith(prefix)) continue;diff --git a/test/resources.test.js b/test/resources.test.jsindex 7354ae75..c1a8ec11 100644--- a/test/resources.test.js+++ b/test/resources.test.js@@ -353,30 +353,43 @@ async function release(child) {test('single-quoted named-test checks skip the browser slot [C7]', async () => {const box = fixture();- const { repo, base } = checkProject(box);+ const { repo } = checkProject(box);const itemCheck = 'node bin/run-tests.js --test-name-pattern "item check marker" test/cpu-check.test.js';- const submitCheck = 'node bin/run-tests.js --test-name-pattern "submit check marker" test/cpu-check.test.js';assert.equal(await checkNeedsBrowser(repo, itemCheck), false, 'an explicit CPU-only test file is classifiable');const outputPattern = '^[[:space:]]*ok [0-9]+ - item check marker';const newlinePrint = ([quote, backslashes]) => `printf ${quote}%s${'\\'.repeat(backslashes)}n${quote} "$out"`;const capturedCheck = (formats, patternQuotes) => `out=$(${itemCheck} 2>&1); ${newlinePrint(formats[0])}; ${newlinePrint(formats[1])} | grep -Eq ${patternQuotes[0]}${outputPattern}${patternQuotes[0]} && ${newlinePrint(formats[2])} | grep -Eq ${patternQuotes[1]}^# fail 0$${patternQuotes[1]}`;- const capturedVariants = [- [[['\'', 1], ['\'', 1], ['\'', 1]], ['\'', '\'']],- [[['\'', 2], ['"', 1], ['"', 2]], ['\'', '"']],- [[['"', 1], ['\'', 2], ['\'', 1]], ['"', '\'']],- [[['"', 2], ['"', 1], ['\'', 2]], ['"', '"']],+ const oneBackslash = [1, 1, 1];+ const accepted = [+ { formats: oneBackslash.map(count => ['\'', count]), patternQuotes: ['\'', '\''] },+ { formats: [['\'', 1], ['"', 1], ['\'', 1]], patternQuotes: ['"', '\''] },+ { formats: [['"', 1], ['\'', 1], ['"', 1]], patternQuotes: ['\'', '"'] },+ { formats: oneBackslash.map(count => ['"', count]), patternQuotes: ['"', '"'] },];- for (const [formats, patternQuotes] of capturedVariants) {- assert.equal(await checkNeedsBrowser(repo, capturedCheck(formats, patternQuotes)), false,- `the exact frozen output-capture wrapper accepts its literal quote/newline variant: ${JSON.stringify({ formats, patternQuotes })}`);+ for (const variant of accepted) {+ assert.equal(await checkNeedsBrowser(repo, capturedCheck(variant.formats, variant.patternQuotes)), false,+ `the exact capture wrapper accepts quote changes with one literal backslash: ${JSON.stringify(variant)}`);+ }+ for (let index = 0; index < 3; index += 1) {+ const formats = oneBackslash.map(count => ['\'', count]);+ formats[index] = ['\'', 2];+ assert.equal(await checkNeedsBrowser(repo, capturedCheck(formats, ['\'', '\''])), true,+ `a two-backslash printf at position ${index + 1} stays browser-gated`);}- assert.equal(await checkNeedsBrowser(repo, `${capturedCheck(capturedVariants[1][0], capturedVariants[1][1])}; :`), true,+ assert.equal(await checkNeedsBrowser(repo, `${capturedCheck(accepted[0].formats, accepted[0].patternQuotes)}; :`), true,'an arbitrary suffix remains outside the exact capture wrapper');- const substituted = capturedCheck(capturedVariants[1][0], capturedVariants[1][1])- .replace('printf \'%s\\\\n\' "$out"', 'printf \'%s\\\\n\' "$(printf %s "$out")"');+ const substituted = capturedCheck(accepted[0].formats, accepted[0].patternQuotes)+ .replace('printf \'%s\\n\' "$out"', 'printf \'%s\\n\' "$(printf %s "$out")"');assert.equal(await checkNeedsBrowser(repo, substituted), true, 'a command substitution remains outside the exact printf wrapper');assert.equal(await checkNeedsBrowser(repo, 'node bin/run-tests.js test/cockpit/brief.test.js'), true,'known browser suites remain browser-gated');+});++test('a non-browser check does not wait for the browser slot [C7]', async () => {+ const box = fixture();+ const { repo, base } = checkProject(box);+ const itemCheck = 'node bin/run-tests.js --test-name-pattern "item check marker" test/cpu-check.test.js';+ const submitCheck = 'node bin/run-tests.js --test-name-pattern "submit check marker" test/cpu-check.test.js';const added = runFixtureChild(process.execPath, [BIN, 'add', 'coordinator', 'CPU check item', '--check', itemCheck, '--wait', '--json'], {cwd: repo, env: box.env, encoding: 'utf8',});