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.

fix(gate): short slots behave the same with browserByLaunch [C7,O5]

Corey Olson5f5681f5847b
diff --git a/src/browser-admission.js b/src/browser-admission.js
index 76b46b0e..f344a0b6 100644
--- a/src/browser-admission.js
+++ b/src/browser-admission.js
@@ -345,7 +345,7 @@ export async function checkNeedsBrowser(root, command, { commit, env = process.e
* @returns {Promise<string[] | null>}
*/
export async function explicitCheckFiles(root, command, { commit, env = process.env } = {}) {
- if (env.NODE_OPTIONS) return null;
+ if (unclassifiedNodeOptions(env.NODE_OPTIONS)) return null;
let words = literalShellWords(command);
if (!words) {
const inner = capturedRunner(command);
diff --git a/test/gate-resource.test.js b/test/gate-resource.test.js
index cca8d2cf..54a96ed9 100644
--- a/test/gate-resource.test.js
+++ b/test/gate-resource.test.js
@@ -661,6 +661,20 @@ test('a short slot is offered only to a literal runner call over regular test fi
assert.deepEqual(await explicitCheckFiles(root, named, { commit: head.stdout.trim() }), ['test/gate-resource.test.js'], 'a review reads the files from the submitted tree');
});
+test('short slots behave the same with gate.browserByLaunch on [C7]', async () => {
+ // With gate.browserByLaunch on, the runner adds its launch guard to NODE_OPTIONS for its children (#808). The
+ // short-slot offer for the same named file must match under either setting: each run gets the environment the
+ // runner gives its children for that setting, and both name the file. A foreign NODE_OPTIONS still refuses.
+ const { explicitCheckFiles } = await import(BROWSER_ADMISSION_MODULE);
+ const root = process.cwd();
+ const named = `${quote(process.execPath)} bin/run-tests.js test/gate-resource.test.js`;
+ const guard = pathToFileURL(resolve(root, 'src/browser-slot-guard.js')).href;
+ const base = Object.fromEntries(Object.entries(process.env).filter(([name]) => name !== 'NODE_OPTIONS'));
+ assert.deepEqual(await explicitCheckFiles(root, named, { env: base }), ['test/gate-resource.test.js'], 'with gate.browserByLaunch off');
+ assert.deepEqual(await explicitCheckFiles(root, named, { env: { ...base, NODE_OPTIONS: `--import=${guard}` } }), ['test/gate-resource.test.js'], 'with gate.browserByLaunch on');
+ assert.equal(await explicitCheckFiles(root, named, { env: { ...base, NODE_OPTIONS: '--import=file:///elsewhere/unclassified.js' } }), null, 'a foreign NODE_OPTIONS is not short');
+});
+
test('a short check never waits behind whole suites [C7]', async () => {
const box = fixture();
const settingsRoot = gateRepo(box, 'settings-view');