Browse daemon skips port 10080, which Chromium refuses, and a process-census test stops flaking (#4554)

The browse daemon no longer picks port 10080, which Chromium refuses to
open, so its welcome page can't fail with `net::ERR_UNSAFE_PORT`.

This fixes two flaky free tests at their cause: the xvfb welcome test
and the paid-shard retention check.

Nothing for the reader to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-20 15:01:18 +00:00
1 parent bd0428974a
commit 5f3aa5b108
6 files changed
+60 -5

No files matched your search

+25
View File
@@ -126,6 +126,31 @@ describe.skipIf(process.platform !== 'linux')('bootstrap attempt retention bound
expect(() => process.kill(child.pid!, 0)).not.toThrow();
});
// Value: protects=scope creation survives a same-uid process that denies its fd table and exits mid-census (the
// flaky free test on 2026-11-20); fails_when=that denial throws again or the exited process is recorded as
// uninspectable; why_new=only live denials were covered; seam=fs.readdirSync and fs.readFileSync on that pid's /proc
test('scope creation skips an owned process that exits after denying its fd table', () => {
const child = spawn('sleep', ['30'], { detached: true, stdio: 'ignore' });
children.push(child);
const realDir = fs.readdirSync;
const realFile = fs.readFileSync;
let stats = 0;
const dir = spyOn(fs, 'readdirSync').mockImplementation(((file: any, ...args: any[]) => {
if (file === `/proc/${child.pid}/fd`) throw Object.assign(new Error('fd table denied'), { code: 'EACCES' });
return (realDir as any)(file, ...args);
}) as any);
const read = spyOn(fs, 'readFileSync').mockImplementation(((file: any, ...args: any[]) => {
if (file === `/proc/${child.pid}/stat` && ++stats > 1) throw Object.assign(new Error('exited'), { code: 'ENOENT' });
return (realFile as any)(file, ...args);
}) as any);
try {
const { scope } = fixture();
const census = JSON.parse(Object.values(scope.env)[0]!);
expect(stats).toBe(2);
expect(census.uninspectable.some((native: any) => native.pid === child.pid)).toBe(false);
} finally { dir.mockRestore(); read.mockRestore(); }
});
test.each(['new process', 'new denial', 'different lifetime'])('%s cannot inherit an unrelated process census exclusion', async scenario => {
const child = scenario === 'new process' ? undefined : await censusProcess(scenario === 'different lifetime'
? 'dumpable(0);'
+2 -2
View File
@@ -159,8 +159,8 @@ export function createBootstrapRetentionScope(temporaryRoot: string, durableRoot
fs.readdirSync(`/proc/${pid}/fd`);
} catch (error: any) {
if (error.code === 'ENOENT' || error.code === 'ESRCH') continue;
if (native && (error.code === 'EACCES' || error.code === 'EPERM') && alive(native)) uninspectable.push(native);
else throw error;
if (!native || (error.code !== 'EACCES' && error.code !== 'EPERM')) throw error;
if (alive(native)) uninspectable.push(native);
}
}
if (path.resolve(durableRoot) === temporary.path || inside(temporary.path, path.resolve(durableRoot))) throw new Error('artifact root must survive temporary cleanup');