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(relay): set-up-once case polls the relay at its own 200 ms [H5,H17]

Corey Olson4553b7c7a06a
diff --git a/test/relay-client-fixture.js b/test/relay-client-fixture.js
index be1cbea2..7d9a4b77 100644
--- a/test/relay-client-fixture.js
+++ b/test/relay-client-fixture.js
@@ -134,8 +134,13 @@ function childResult(root, env, argv, observedSnapshotUploads, initialSnapshotUp
export { childResult as relayFixtureChild };
-/** Start an isolated board and authorized loopback relay; a null coordinatorModel keeps its initial identity unknown. */
-export async function relayClientFixture(t, { cliChildren, coordinatorModel, accountStorageBytes } = {}) {
+/**
+ * Start an isolated board and authorized loopback relay; a null coordinatorModel keeps its initial identity unknown.
+ * pollMs is how often the in-process relay polls each live stream. The 10 ms default keeps live moves quick, but each
+ * poll opens the board journals, so a case that holds several streams open for minutes can pass the relay's own 200 ms
+ * default: on a loaded machine 10 ms polls filled this test process and its DevTools replies queued behind them (#955).
+ */
+export async function relayClientFixture(t, { cliChildren, coordinatorModel, accountStorageBytes, pollMs = 10 } = {}) {
const scratch = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-relay-cleanup-')));
const root = join(scratch, 'repo');
const home = join(scratch, 'home');
@@ -468,7 +473,7 @@ globalThis.fetch = function tracedFetch(input, init) {
const origin = 'http://127.0.0.1:' + relayPort;
auth = createRelayAuth({ database: authDatabase, github: createGitHubClient({ ...provider.config, callbackURL: origin + '/auth/github/callback' }) });
signIn = createAuthHandler({ auth, publicOrigin: origin });
- api = createRelayHandler({ directory: join(scratch, 'relay'), auth, publicOrigin: origin, pollMs: 10, maintenanceMs: 0, accountStorageBytes, now: () => Date.now() + timeOffsetMs });
+ api = createRelayHandler({ directory: join(scratch, 'relay'), auth, publicOrigin: origin, pollMs, maintenanceMs: 0, accountStorageBytes, now: () => Date.now() + timeOffsetMs });
/** Sign a separate phone in over actual OAuth HTTP; its person session stays only in fixture RAM. */
async function phoneSession() {
if (phone) return phone;
@@ -744,7 +749,7 @@ globalThis.fetch = function tracedFetch(input, init) {
setStorageQuota(bytes) {
assert.ok(Number.isSafeInteger(bytes) && bytes > 0);
api.close();
- api = createRelayHandler({ directory: join(scratch, 'relay'), auth, publicOrigin: origin, pollMs: 10,
+ api = createRelayHandler({ directory: join(scratch, 'relay'), auth, publicOrigin: origin, pollMs,
maintenanceMs: 0, accountStorageBytes: bytes, now: () => Date.now() + timeOffsetMs });
},
/** Return a chosen HTTP refusal for snapshot writes, without inspecting the sealed body. */
diff --git a/test/relay-setup-once.test.js b/test/relay-setup-once.test.js
index 47df868b..9c6725a1 100644
--- a/test/relay-setup-once.test.js
+++ b/test/relay-setup-once.test.js
@@ -187,7 +187,10 @@ test('set up once links three registered boards, later registration and a persis
if (setup?.child.exitCode === null) setup.child.kill('SIGTERM');
await setup?.done.catch(() => {});
});
- const box = await relayClientFixture(t);
+ // The relay polls at its production 200 ms. At the fixture's 10 ms its polls held this test process busy, so on a
+ // loaded machine the browser's replies waited behind them past their deadline while the page itself stayed quick
+ // (#955). Every page wait and assertion below is unchanged.
+ const box = await relayClientFixture(t, { pollMs: 200 });
const second = await project(box, 'second-project');
const third = await project(box, 'third-project');
const machineFile = join(box.env.PULLBOARD_HOME, 'relay-machine/state.json');