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): keep timing digests compact [C7,V10,N23]

Corey Olson2fe90b86d9cb
diff --git a/src/cli.js b/src/cli.js
index e42c9059..5f72dd62 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -2195,9 +2195,11 @@ function workCommands(io, args) {
}
const run = await withGateSlot(ctx.info.root, (lease) => runProfiledShell(ctx.info.root, check, { waitMs: lease.waitMs, artifactPrefix: `pullboard-check-${item.item_id}`, persistLog: true }), { itemCheck: true, onWait: gateWaitReporter(io) });
io.result?.({ id: item.item_id, green: run.isGreen, seconds: run.seconds, check, by, report: run.isGreen ? '' : digestOf(run.output) });
- io.say(`check ${run.isGreen ? 'green' : 'red'} in ${run.seconds}s: ${check}`);
const timings = timingDigest(run.profile);
- if (timings) {
+ const compact = timings && !run.profile.files.length
+ ? `; ${timings.replaceAll('\n', '; ')}; timing profile: ${run.profilePath}` : '';
+ io.say(`check ${run.isGreen ? 'green' : 'red'} in ${run.seconds}s: ${check}${compact}`);
+ if (timings && run.profile.files.length) {
io.say(timings);
io.say(`timing profile: ${run.profilePath}`);
}
diff --git a/src/gate.js b/src/gate.js
index cd2d7abc..70cefbeb 100644
--- a/src/gate.js
+++ b/src/gate.js
@@ -347,7 +347,8 @@ export function gateReport(gate) {
const profilePath = timings && gate.profilePath ? `\ntiming profile: ${gate.profilePath}` : '';
if (gate.isGreen) {
const summary = gate.isCached ? 'gate green (this tree already passed)' : `gate green in ${gate.seconds}s`;
- return timings ? `${summary}\n${timings}${profilePath}` : summary;
+ if (!gate.profile?.files?.length) return timings ? `${summary}; ${timings.replaceAll('\n', '; ')}${gate.profilePath ? `; timing profile: ${gate.profilePath}` : ''}` : summary;
+ return `${summary}\n${timings}${profilePath}`;
}
return `gate red in ${gate.seconds}s:\n${digestOf(gate.output).replace(/^/gm, ' ')}\n${timings ? `${timings}\n` : ''}the whole output is in ${gate.log}${profilePath}`;
}
diff --git a/test/e2e-cli.test.js b/test/e2e-cli.test.js
index 1abf8e3c..1f36ac20 100644
--- a/test/e2e-cli.test.js
+++ b/test/e2e-cli.test.js
@@ -199,7 +199,8 @@ test('the gate reaches the agent as a digest: one line when green, the failure w
const log = join(box.repo, box.git(box.repo, 'rev-parse', '--git-path', 'pullboard-gate.log'));
const green = box.run(box.repo, 'gate');
assert.equal(green.code, 0, green.err);
- assert.match(green.out, /^gate green in \d+s\n$/);
+ assert.match(green.out, /^gate green in \d+s; timing \(node\): wall [0-9.]+s, slot wait [0-9.]+s; per-test timing unavailable: output was not TAP or JUnit; timing profile: [^\n]+\n$/);
+ assert.equal(green.out.trimEnd().split('\n').length, 1, 'a green gate without file measurements remains one line');
assert.ok(readFileSync(log, 'utf8').length > 1_200_000, 'more than the default 1 MB pipe buffer, read whole');
writeFileSync(join(box.repo, 'RED'), 'red');
box.git(box.repo, 'add', 'RED');
@@ -207,7 +208,7 @@ test('the gate reaches the agent as a digest: one line when green, the failure w
const red = box.run(box.repo, 'gate');
assert.equal(red.code, 1);
assert.match(red.out, /^gate red in \d+s:\n {2}not ok 401 - the page renders a heading\n/);
- assert.match(red.out, / {2}# note 99\nthe whole output is in /);
+ assert.match(red.out, / {2}# note 99\n[\s\S]*the whole output is in /);
assert.ok(red.out.length < 4000, `${red.out.length} characters`);
const lines = readFileSync(log, 'utf8').split('\n');
assert.equal(lines.length, 502);
@@ -266,6 +267,7 @@ test('check runs the item\'s own check command, yours by default, and prints a d
assert.equal(green.code, 0, green.out);
assert.match(green.out, /^check green in \d+s: test -f web\/a.html/m);
assert.equal(green.out.split('\n').filter(Boolean).length, 2);
+ assert.match(green.out, /timing \(test\): wall [0-9.]+s, slot wait [0-9.]+s; per-test timing unavailable: output was not TAP or JUnit; timing profile: /);
assert.match(green.out, /^check #1 set by coordinator:/);
assert.equal(box.run(box.repo, 'check', '1').code, 1, 'named, from another checkout: there the file is missing');
assert.match(box.run(box.web, 'check', '2').err, /NO_CHECK.*#2 has no check command/);