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(view): review inherited defaults on new projects [N26]

Corey Olsond2aa46f345dd
diff --git a/src/cockpit.js b/src/cockpit.js
index c98dc03b..05240675 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -1782,12 +1782,13 @@ function render() {
for (const kind of ['spec', 'doctrine']) {
const rows = kind === 'spec' ? p.spec : p.practice;
const filter = view.rows[kind];
- const labels = { decide: 'Needs your decision', all: 'All rows', approved: 'Approved' };
- /** A source row stays in Needs your decision until its person decision is recorded. */
- const undecided = (r) => ['pending', 'draft'].includes(r.status) && !r.decision;
- const n = { decide: rows.filter(undecided).length, all: rows.length, approved: rows.filter((r) => r.status === 'approved').length };
+ const defaults = kind === 'doctrine' ? rows.filter((r) => r.origin === 'standard') : [];
+ const labels = { decide: 'Needs your decision', ...(defaults.length ? { defaults: 'Defaults to review' } : {}), all: 'All rows', approved: 'Approved' };
+ /** Inherited defaults are reviewed in the repo's doctrine; only local proposals ask for a decision. */
+ const undecided = (r) => ['pending', 'draft'].includes(r.status) && !r.decision && !(kind === 'doctrine' && r.origin === 'standard');
+ const n = { decide: rows.filter(undecided).length, defaults: defaults.length, all: rows.length, approved: rows.filter((r) => r.status === 'approved').length };
$(kind + '-chips').innerHTML = Object.keys(labels).map((f) => '<button data-rows="' + kind + ':' + f + '" class="' + (filter === f ? 'on' : '') + '" type="button">' + labels[f] + '<b>' + n[f] + '</b></button>').join('');
- const shownRows = rows.filter((r) => filter === 'all' || (filter === 'decide' ? undecided(r) : r.status === 'approved'));
+ const shownRows = rows.filter((r) => filter === 'all' || (filter === 'decide' ? undecided(r) : filter === 'defaults' ? r.origin === 'standard' : r.status === 'approved'));
// With no row picked, or the pick filtered out, the detail opens on the first row shown, as Items does.
if (!(view.tab === kind && view.addressDetail !== null) && !shownRows.some((r) => r.id === view.row[kind])) view.row[kind] = shownRows[0]?.id ?? null;
const feedback = view.specFeedback?.kind === kind && view.specFeedback.root === view.root && view.specFeedback.from === 'list' ? view.specFeedback : null;
@@ -1817,7 +1818,7 @@ function render() {
const text = row ? declined ? '<s>' + linked(row.standardText || row.text, titles) + '</s>' : linked(row.text, titles) : '';
const source = kind === 'doctrine' && row ? '<span class="chip" title="' + esc(ruleSourceTitle(row)) + '">' + esc(ruleSource(row)) + '</span>' : '';
const reason = declined && row.reason ? '<dt>reason</dt><dd>' + linked(row.reason, titles) + '</dd>' : '';
- const home = kind === 'doctrine' && row && row.origin === 'standard' ? 'Standard rules come with Pullboard; override or decline one in DOCTRINE.md.' : 'Rows change in ' + (kind === 'spec' ? 'SPEC.md' : 'DOCTRINE.md') + ', and only you approve them.';
+ const home = kind === 'doctrine' && row && row.origin === 'standard' ? 'Standard rules come with Pullboard as defaults to review; override or decline one in DOCTRINE.md.' : 'Rows change in ' + (kind === 'spec' ? 'SPEC.md' : 'DOCTRINE.md') + ', and only you approve them.';
const rowStatus = row?.stage || row?.status;
const rowDecisionActions = !snapshot && (!readOnly || requests) && row && undecided(row) && (kind === 'spec' || row.origin !== 'standard')
? '<div class="spec-decision-actions detail-decision-actions"><button class="approve-row" data-row-decision="approve" data-row-kind="' + kind + '" data-row-id="' + esc(row.id) + '" title="Approve (A, from the list)" type="button">Approve <kbd>A</kbd></button><button class="decline-row" data-row-decision="decline" data-row-kind="' + kind + '" data-row-id="' + esc(row.id) + '" title="Decline (D, from the list)" type="button">Decline <kbd>D</kbd></button></div>'
diff --git a/test/cockpit/newcomer.test.js b/test/cockpit/newcomer.test.js
new file mode 100644
index 00000000..8e43eebb
--- /dev/null
+++ b/test/cockpit/newcomer.test.js
@@ -0,0 +1,123 @@
+/** Newcomer journeys use a fresh init and the actual retained tour board [N26]. */
+import assert from 'node:assert/strict';
+import { appendFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { test } from 'node:test';
+import { machine, startView, chromeExecutable, openSnapshotChrome, closeSnapshotChrome, press } from './fixture.js';
+
+/** Initialize the real template, retaining its spec and doctrine instead of replacing them with demo rows. */
+function freshProject(box) {
+ const repo = join(box.dir, 'fresh-project');
+ mkdirSync(repo);
+ box.git(repo, 'init', '-q', '-b', 'main');
+ const env = { ...box.env };
+ delete env.PULLBOARD_MODEL;
+ box.runWithEnv(repo, env, 'init');
+ const file = join(repo, 'pullboard.json');
+ const config = JSON.parse(readFileSync(file, 'utf8'));
+ config.gate = 'true';
+ config.lanes = { review: { owns: [] }, research: { owns: [] }, web: { owns: ['web/'], specs: ['G'] }, api: { owns: ['api/'], specs: ['G'] } };
+ writeFileSync(file, JSON.stringify(config, null, 2));
+ box.git(repo, 'add', '-A');
+ box.git(repo, 'commit', '-q', '-m', 'chore: initialize newcomer fixture');
+ return repo;
+}
+
+/** Visit one tab through the same pointer path as a person. */
+async function tab(chrome, name) {
+ await press(chrome, `document.querySelector('[data-tab="${name}"]')`);
+ await chrome.waitFor(`!document.querySelector('[data-pane="${name}"]').hidden`);
+}
+
+// Budget: two real Chrome viewport journeys, including local source-file refreshes; a hang ceiling, not a speed claim.
+test('a new project reviews inherited defaults and files new work in its first building lane [N26]', { timeout: 90_000 }, async () => {
+ const executable = chromeExecutable();
+ assert.ok(executable, 'Chrome is required for the newcomer journey');
+ const box = machine();
+ const repo = freshProject(box);
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-newcomer-chrome-'));
+ let chrome;
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.waitFor('data?.project?.practice?.some(row => row.origin === "standard" && row.status === "pending")');
+ for (const width of [375, 1280]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor(`innerWidth === ${width}`);
+ await tab(chrome, 'doctrine');
+ await press(chrome, 'document.querySelector("#doctrine-chips [data-rows=\\"doctrine:decide\\"]")');
+ assert.equal(await chrome.stable('document.querySelector("#doctrine-chips [data-rows=\\"doctrine:decide\\"] b").textContent'), '0', `${width}: untouched template rules are not decisions waiting`);
+ assert.equal(await chrome.stable('document.querySelectorAll("#doctrine-list .srow").length'), 0, `${width}: no inherited rule appears among the person\'s calls`);
+ const defaults = await chrome.stable('document.querySelector("#doctrine-chips [data-rows=\\"doctrine:defaults\\"]")?.textContent');
+ assert.match(defaults ?? '', /^Defaults to review\d+$/, `${width}: inherited rules have an explicit defaults-to-review label`);
+ await press(chrome, 'document.querySelector("#doctrine-chips [data-rows=\\"doctrine:defaults\\"]")');
+ assert.deepEqual(JSON.parse(await chrome.stable('JSON.stringify([...document.querySelectorAll("#doctrine-list .srow")].map(row => row.dataset.row.slice(9)))')),
+ JSON.parse(await chrome.stable('JSON.stringify(data.project.practice.filter(row => row.origin === "standard").map(row => row.id))')), `${width}: every inherited default remains available to review`);
+ await press(chrome, 'document.querySelector("#doctrine-list [data-row=\\"doctrine:PB7\\"]")');
+ assert.match(await chrome.stable('document.querySelector("#doctrine-detail").textContent'), /defaults to review; override or decline one in DOCTRINE\.md/, `${width}: the default explains how to adopt a local rule`);
+ assert.equal(await chrome.stable('document.querySelectorAll("#doctrine-detail [data-row-decision]").length'), 0, `${width}: inherited defaults offer no local decision action`);
+ await tab(chrome, 'items');
+ await press(chrome, 'document.querySelector("#new-item")');
+ assert.equal(await chrome.stable('document.querySelector("#add-lane").value'), 'web', `${width}: new work starts in the first lane owning folders`);
+ assert.deepEqual(JSON.parse(await chrome.stable('JSON.stringify([...document.querySelector("#add-lane").options].map(option => option.value))')),
+ ['web', 'api', 'coordinator', 'review', 'research'], `${width}: building lanes precede coordinator and non-building lanes`);
+ }
+
+ appendFileSync(join(repo, 'DOCTRINE.md'), '\n## Local proposals\n- R1 [draft, must] Review the team\'s proposed rule. | gate: review\n- R2 [pending, aim] Should the team keep this local rule? | gate: review\n');
+ appendFileSync(join(repo, 'SPEC.md'), '\n- G1 [pending, must] Should the project greet a visitor? | gate: review\n');
+ await chrome.waitFor('data.project.practice.some(row => row.id === "R2") && data.project.spec.some(row => row.id === "G1")');
+ for (const width of [375, 1280]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor(`innerWidth === ${width}`);
+ await tab(chrome, 'doctrine');
+ await press(chrome, 'document.querySelector("#doctrine-chips [data-rows=\\"doctrine:decide\\"]")');
+ assert.deepEqual(JSON.parse(await chrome.stable('JSON.stringify([...document.querySelectorAll("#doctrine-list .srow")].map(row => row.dataset.row.slice(9)))')), ['R1', 'R2'], `${width}: local drafts and pending rules remain real decisions`);
+ await tab(chrome, 'spec');
+ await press(chrome, 'document.querySelector("#spec-chips [data-rows=\\"spec:decide\\"]")');
+ assert.deepEqual(JSON.parse(await chrome.stable('JSON.stringify([...document.querySelectorAll("#spec-list .srow")].map(row => row.dataset.row.slice(5)))')), ['G1'], `${width}: the repo\'s open spec question still waits for the person`);
+ assert.ok(await chrome.stable('document.documentElement.scrollWidth <= innerWidth'), `${width}: the newcomer filters fit without sideways scrolling`);
+ }
+ assert.deepEqual(chrome.exceptions, [], 'the newcomer journey raises no uncaught page exception');
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ await view.stop();
+ rmSync(profile, { recursive: true, force: true });
+ }
+});
+
+// Budget: the real scripted tour and two Chrome viewport journeys; a hang ceiling, not a speed claim.
+test('the actual tour leaves a labelled demo visible at phone and desktop widths [N26]', { timeout: 90_000 }, async () => {
+ const executable = chromeExecutable();
+ assert.ok(executable, 'Chrome is required for the retained tour board');
+ const box = machine();
+ const env = { ...box.env, TMPDIR: box.dir };
+ delete env.PULLBOARD_MODEL;
+ const output = box.runWithEnv(box.dir, env, 'tour');
+ assert.equal(output.trimEnd().split('\n').at(-1), 'see it: pullboard view', 'the actual tour ends with the view command');
+ const demo = /Look around: cd (.+) && pullboard log/.exec(output)?.[1];
+ assert.ok(demo, 'the tour prints its retained real repo');
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-tour-newcomer-chrome-'));
+ let chrome;
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.waitFor(`data?.project?.root === ${JSON.stringify(demo)}`);
+ for (const width of [375, 1280]) {
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor(`innerWidth === ${width}`);
+ assert.ok(await chrome.stable(`[...document.querySelectorAll('#proj-list [data-root]')].some(row => row.dataset.root === ${JSON.stringify(demo)} && /demo/.test(row.textContent))`), `${width}: the real tour board is listed and marked demo`);
+ assert.equal(await chrome.stable('document.querySelector("#proj-name").textContent'), 'demo', `${width}: the selected board is the registered tour demo`);
+ assert.ok(await chrome.stable('data.project.items.some(item => item.status === "verified" && item.merged)'), `${width}: the tour\'s actual accepted history is visible`);
+ await tab(chrome, 'items');
+ await press(chrome, 'document.querySelector("#new-item")');
+ assert.equal(await chrome.stable('document.querySelector("#add-lane").value'), 'app', `${width}: tour work also defaults to its building lane`);
+ await press(chrome, 'document.querySelector("#add-cancel")');
+ }
+ assert.deepEqual(chrome.exceptions, [], 'the retained tour raises no uncaught page exception');
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ await view.stop();
+ rmSync(profile, { recursive: true, force: true });
+ }
+});
diff --git a/test/cockpit/spec.test.js b/test/cockpit/spec.test.js
index bbd6d129..4f3786ff 100644
--- a/test/cockpit/spec.test.js
+++ b/test/cockpit/spec.test.js
@@ -274,11 +274,7 @@ test('spec rows read as a list, decided in the panel [N26]', { timeout: 300_000
try {
chrome = await openSnapshotChrome(executable, view.link.href, profile);
await chrome.waitFor("typeof data === 'object' && !!data?.project?.spec?.length && data.project.practice.some((r) => r.id === 'D8')");
- // Pullboard's own rules can wait on the person too; they list under Needs your decision, in the board's order, but are
- // changed in DOCTRINE.md rather than decided here.
- const order = JSON.parse(await chrome.stable("JSON.stringify(data.project.practice.map((r) => [r.id, r.origin, r.status, !!r.decision]))"));
- const standardWaiting = order.filter(([, origin, status, decided]) => origin === 'standard' && ['pending', 'draft'].includes(status) && !decided).map(([id, , status]) => [id, status === 'draft' ? null : status]);
- expected.doctrine.decide = [...standardWaiting, ...expected.doctrine.decide].sort(([a], [b]) => order.findIndex(([id]) => id === a) - order.findIndex(([id]) => id === b));
+ // Inherited defaults have their own review filter; local proposals still wait for the person's decision.
for (const scheme of ['light', 'dark']) {
for (const width of [1280, 375]) {
await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });