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.

feat(blueprint): every starter carries a criterion and a check [S1,I1]

Corey Olsond47713f7758f
diff --git a/src/blueprints.js b/src/blueprints.js
index 184a0efd..b99d1055 100644
--- a/src/blueprints.js
+++ b/src/blueprints.js
@@ -17,10 +17,12 @@
* gate "npm test" optional, set in pullboard.json only when it has no gate
* rules [{ key, text, why, tier?, gate? }] tier must|aim (must), gate (review)
* questions [{ key, ask, choices, default }] default is one of choices
- * items [{ key, title, cites?, after?, lane?, route?, criterion?, brief?, check? }]
+ * items [{ key, title, cites?, after?, lane?, route?, criterion, brief?, check }]
*
- * An item's route is light, mid or strong (strong when left out), as pullboard add takes it. Its
- * brief, criterion and check pass through to add unchanged, so a light or mid item is filed when it
+ * Every starter item carries a criterion and a check, or the blueprint is refused with
+ * BLUEPRINT_ITEM_UNCHECKED when it is read or saved: a starter that cannot be verified cannot be
+ * accepted. An item's route is light, mid or strong (strong when left out), as pullboard add takes
+ * it. Its brief, criterion and check pass through to add unchanged, so a light or mid item is filed when it
* carries what add requires for that route and refused with add's own refusal when it does not.
* A check is stored on the item and never run during add: no check baseline starts, so nothing a
* blueprint supplies executes. A blueprint is read from the bundled set or a local path, never a URL.
@@ -99,7 +101,7 @@ export function readBlueprint(reference, cwd) {
* @property {string} [gate]
* @property {{ key: string, text: string, why: string, tier: string, gate: string }[]} rules
* @property {{ key: string, ask: string, choices: string[], default: string }[]} questions
- * @property {{ key: string, title: string, cites: string[], after: string[], lane?: string, route: string, criterion: string, brief: string }[]} items
+ * @property {{ key: string, title: string, cites: string[], after: string[], lane?: string, route: string, criterion: string, brief: string, check: string }[]} items
*/
/**
@@ -173,13 +175,16 @@ export function validateBlueprint(value, source = 'blueprint') {
}
line(`${at}.lane`, item.lane, { required: false });
if (item.route !== undefined && !ROUTES.includes(item.route)) fail(`${at}.route`, `must be one of ${ROUTES.join(', ')}`);
- line(`${at}.check`, item.check, { required: false });
- line(`${at}.criterion`, item.criterion, { required: false });
+ // A blank check or criterion is a missing one, refused below by name as BLUEPRINT_ITEM_UNCHECKED.
+ const blank = (text) => typeof text === 'string' && !text.trim();
+ if (!blank(item.check)) line(`${at}.check`, item.check, { required: false });
+ if (!blank(item.criterion)) line(`${at}.criterion`, item.criterion, { required: false });
if (item.brief !== undefined && typeof item.brief !== 'string') fail(`${at}.brief`, 'must be text');
});
if (problems.length) {
throw new Refused('BAD_BLUEPRINT', `${source} is not a valid blueprint: ${problems.slice(0, 5).join('; ')}${problems.length > 5 ? `; and ${problems.length - 5} more` : ''}; fix the file and run pullboard blueprint add again`);
}
+ refuseUncheckedItems(value.name, items);
return {
...value,
rules: rules.map((rule) => ({ ...rule, tier: rule.tier ?? 'must', gate: rule.gate ?? 'review' })),
@@ -188,6 +193,24 @@ export function validateBlueprint(value, source = 'blueprint') {
};
}
+/**
+ * Refuse a blueprint whose starter item has no criterion or no check, naming the blueprint and the
+ * item. A starter without both cannot be built against a bar or verified, so it could never reach
+ * an accept (#724). The check is stored on the item and still never run by add or init.
+ *
+ * @param {string} name - The blueprint's name, already checked.
+ * @param {{ key: string, title: string, criterion?: string, check?: string }[]} items
+ * @returns {void}
+ */
+function refuseUncheckedItems(name, items) {
+ for (const item of items) {
+ const missing = [item.criterion, item.check].map((text) => (typeof text === 'string' ? text.trim() : ''));
+ const lacks = [!missing[0] && 'no criterion', !missing[1] && 'no check'].filter(Boolean);
+ if (!lacks.length) continue;
+ throw new Refused('BLUEPRINT_ITEM_UNCHECKED', `blueprint ${name} starter item ${item.key} (${JSON.stringify(item.title)}) has ${lacks.join(' and ')}; give every starter item a criterion and a check command, then run pullboard blueprint add again`);
+ }
+}
+
/**
* The marker line a blueprint leaves after its rows once everything is added, so the same version
* adds nothing twice even after the person rewords or declines its rows.
diff --git a/src/blueprints/data-pipeline.json b/src/blueprints/data-pipeline.json
index 13ac6196..a24835b0 100644
--- a/src/blueprints/data-pipeline.json
+++ b/src/blueprints/data-pipeline.json
@@ -14,5 +14,9 @@
"questions": [
{ "key": "Q1", "ask": "The warehouse is", "choices": ["Snowflake", "BigQuery", "Postgres", "Something else"], "default": "Snowflake" },
{ "key": "Q2", "ask": "Jobs run", "choices": ["Daily", "Hourly", "Weekly", "On demand"], "default": "Daily" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every schema change has its migration", "cites": ["DP1", "Q1"], "criterion": "Every table's schema in the code is produced by its migrations, so a schema change without a migration fails the tests. tests/test_migrations.py checks each table against its migrations without touching the warehouse and fails before the change.", "brief": "Files:\n- the migrations folder\n- tests/test_migrations.py\nTest:\n- tests/test_migrations.py compares each declared table schema with the one its migrations produce, offline", "check": "python3 -m pytest tests/test_migrations.py" },
+ { "key": "2", "title": "A failed job names the rows and the reason", "cites": ["DP2"], "criterion": "When a job fails on bad input, its error names the rows that failed and why. tests/test_job_errors.py feeds a job one bad row from a local fixture and fails before the change.", "brief": "Files:\n- the job code\n- tests/test_job_errors.py\nTest:\n- tests/test_job_errors.py runs a job on a local fixture with one bad row and checks the error names that row and the reason", "check": "python3 -m pytest tests/test_job_errors.py" }
]
}
diff --git a/src/blueprints/ios-app.json b/src/blueprints/ios-app.json
index 55785d54..de42aa7e 100644
--- a/src/blueprints/ios-app.json
+++ b/src/blueprints/ios-app.json
@@ -14,5 +14,10 @@
"questions": [
{ "key": "Q1", "ask": "The oldest iOS it supports is", "choices": ["iOS 17", "iOS 16", "iOS 18", "Only the latest"], "default": "iOS 17" },
{ "key": "Q2", "ask": "Its screens are built with", "choices": ["SwiftUI", "UIKit", "Both"], "default": "SwiftUI" }
+ ],
+ "items": [
+ { "key": "1", "title": "One command runs the app's tests on a simulator", "cites": ["Q1", "Q2"], "criterion": "scripts/test.sh builds the app, runs its tests on an iOS simulator for the oldest iOS it supports, and exits with an error when a test fails. Before this item the script does not exist, so the check fails.", "brief": "Files:\n- scripts/test.sh\nTest:\n- sh scripts/test.sh runs every test; sh scripts/test.sh <TestCase> runs one test case through xcodebuild -only-testing", "check": "sh scripts/test.sh" },
+ { "key": "2", "title": "Every screen has a light and a dark screenshot test", "cites": ["IOS1"], "after": ["1"], "criterion": "Each screen is drawn in light mode and in dark mode and compared with a recorded screenshot of each. The ScreenModeTests test case holds these tests and fails before the change.", "brief": "Files:\n- the app's test target\nTest:\n- ScreenModeTests draws each screen in both modes and compares it with its recorded screenshot", "check": "sh scripts/test.sh ScreenModeTests" },
+ { "key": "3", "title": "Every control keeps its VoiceOver label", "cites": ["IOS2"], "after": ["1"], "criterion": "Every control a person can tap on each screen has a VoiceOver label. The AccessibilityLabelTests test case checks each screen and fails before the change.", "brief": "Files:\n- the app's test target\nTest:\n- AccessibilityLabelTests opens each screen and fails on a tappable control without a label", "check": "sh scripts/test.sh AccessibilityLabelTests" }
]
}
diff --git a/src/blueprints/library.json b/src/blueprints/library.json
index bc090495..b174e59f 100644
--- a/src/blueprints/library.json
+++ b/src/blueprints/library.json
@@ -14,5 +14,9 @@
"questions": [
{ "key": "Q1", "ask": "The library is written in", "choices": ["JavaScript or TypeScript", "Python", "Rust", "Something else"], "default": "JavaScript or TypeScript" },
{ "key": "Q2", "ask": "It is published to", "choices": ["npm", "PyPI", "crates.io", "Somewhere else"], "default": "npm" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every docs example runs as a test", "cites": ["LIB2"], "criterion": "Every example in the docs runs as part of the test suite, so a change that breaks an example fails the tests. test/docs-examples.test.js runs each example and fails before the change.", "brief": "Files:\n- test/docs-examples.test.js\nTest:\n- test/docs-examples.test.js reads each example from the docs, runs it, and fails when one throws", "check": "npm test -- test/docs-examples.test.js" },
+ { "key": "2", "title": "Removing a public name fails until the major version goes up", "cites": ["LIB1"], "criterion": "A recorded list of the library's public names is compared with what it exports, and a removed or renamed name fails the tests unless the major version went up. test/public-api.test.js holds that comparison and fails before the change.", "brief": "Files:\n- test/public-api.json (the recorded public names)\n- test/public-api.test.js\nTest:\n- test/public-api.test.js compares the exports with the recorded names and the version in package.json", "check": "npm test -- test/public-api.test.js" }
]
}
diff --git a/src/blueprints/pullboard.json b/src/blueprints/pullboard.json
index 12455e7a..26e3ddb7 100644
--- a/src/blueprints/pullboard.json
+++ b/src/blueprints/pullboard.json
@@ -11,5 +11,8 @@
{ "key": "PB1", "text": "A builder never verifies their own work.", "why": "the agent that wrote a change is the one least likely to see what it missed." },
{ "key": "PB2", "text": "Every item's check fails before the change and passes after it.", "why": "a check that passes either way proves nothing." },
{ "key": "PB3", "text": "Main only moves when the whole test suite passes.", "why": "two changes can each pass alone and still break each other." }
+ ],
+ "items": [
+ { "key": "1", "title": "The gate runs every test in the project", "cites": ["PB3"], "criterion": "pullboard.json names a gate, and that gate runs every test file in the project. test/gate.test.js lists the test files, checks the gate reaches each one, and fails before the change.", "brief": "Files:\n- pullboard.json (its gate)\n- test/gate.test.js\nTest:\n- test/gate.test.js lists every test file and fails on one the gate command does not run", "check": "node --test test/gate.test.js" }
]
}
diff --git a/src/blueprints/research.json b/src/blueprints/research.json
index 0c4e8869..0cb0ed85 100644
--- a/src/blueprints/research.json
+++ b/src/blueprints/research.json
@@ -14,5 +14,8 @@
"questions": [
{ "key": "Q1", "ask": "The research is about", "choices": ["A technical question", "A market or product", "Academic literature", "Something else"], "default": "A technical question" },
{ "key": "Q2", "ask": "Trusted sources are", "choices": ["Official documentation and papers", "Any public source I approve", "Only sources I list"], "default": "Official documentation and papers" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every claim in a finding links to its source", "cites": ["RS1", "Q2"], "criterion": "Every claim in the findings folder carries a link to its source. test/finding-sources.test.js reads each finding, fails on a claim without a link, and fails before the change.", "brief": "Files:\n- findings/ (one claim per bullet)\n- test/finding-sources.test.js\nTest:\n- test/finding-sources.test.js reads every finding and fails on a claim bullet without a link", "check": "node --test test/finding-sources.test.js" }
]
}
diff --git a/src/blueprints/serverless.json b/src/blueprints/serverless.json
index 4bbc8477..ff454e7c 100644
--- a/src/blueprints/serverless.json
+++ b/src/blueprints/serverless.json
@@ -15,5 +15,9 @@
{ "key": "Q1", "ask": "It runs on", "choices": ["AWS", "Google Cloud", "Azure", "Cloudflare"], "default": "AWS" },
{ "key": "Q2", "ask": "Its region is", "choices": ["The one nearest my users", "A US region", "An EU region", "Another region"], "default": "The one nearest my users" },
{ "key": "Q3", "ask": "Its database is", "choices": ["A managed key-value store", "A managed SQL database", "None yet"], "default": "A managed key-value store" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every function has an alarm", "cites": ["SV1", "Q1"], "criterion": "The infrastructure code defines an error alarm for every function it deploys. test/alarms.test.js reads the infrastructure definition, fails on a function without an alarm, and fails before the change.", "brief": "Files:\n- the infrastructure definition\n- test/alarms.test.js\nTest:\n- test/alarms.test.js lists every function in the infrastructure definition and fails on one without an error alarm", "check": "npm test -- test/alarms.test.js" },
+ { "key": "2", "title": "Every function stops before its platform's time limit", "cites": ["SV2", "Q1"], "criterion": "Every function sets a timeout below the time limit of the platform it runs on. test/timeouts.test.js reads each function's timeout and fails before the change.", "brief": "Files:\n- the infrastructure definition\n- test/timeouts.test.js\nTest:\n- test/timeouts.test.js compares each function's timeout with its platform's limit", "check": "npm test -- test/timeouts.test.js" }
]
}
diff --git a/src/blueprints/test-reliability.json b/src/blueprints/test-reliability.json
index 3f5d603b..33e641ab 100644
--- a/src/blueprints/test-reliability.json
+++ b/src/blueprints/test-reliability.json
@@ -13,5 +13,8 @@
],
"questions": [
{ "key": "Q1", "ask": "Tests run with", "choices": ["Vitest", "Jest", "pytest", "Something else"], "default": "Vitest" }
+ ],
+ "items": [
+ { "key": "1", "title": "Find a flaky test and make it deterministic", "cites": ["TR1", "TR2"], "criterion": "A test that failed in repeated runs of the unchanged suite is found, named in the submit note, and fixed so the suite passes ten runs in a row with no sleep or wall-clock wait. Before the fix, ten repeated runs of npm test fail at least once.", "brief": "Files:\n- the flaky test and the code it waits on\nTest:\n- run npm test twenty times with nothing changed to find a test that fails some of the time (TR2)\n- replace its sleep or wall-clock wait with a fake clock or an awaited event (TR1), then run the check", "check": "set -e; for run in 1 2 3 4 5 6 7 8 9 10; do npm test; done" }
]
}
diff --git a/src/blueprints/web-app.json b/src/blueprints/web-app.json
index a4c821c7..38287d59 100644
--- a/src/blueprints/web-app.json
+++ b/src/blueprints/web-app.json
@@ -23,8 +23,8 @@
{ "key": "Q4", "ask": "A change is done when", "choices": ["It runs on a preview link", "Its tests pass", "I have looked at it"], "default": "It runs on a preview link" }
],
"items": [
- { "key": "1", "title": "Set up the test runner with one passing test", "cites": ["W1", "W2"] },
- { "key": "2", "title": "The home page works at phone width", "cites": ["W3"] },
- { "key": "3", "title": "Every change gets a preview link", "cites": ["Q2", "Q4"], "after": ["1"] }
+ { "key": "1", "title": "Set up the test runner with one passing test", "cites": ["W1", "W2"], "criterion": "npm test runs the project's test runner and passes, with one real test in test/smoke.test.js that checks the app starts. Before this item npm test has no runner to start, so it fails.", "brief": "Files:\n- package.json (its test script)\n- test/smoke.test.js\nTest:\n- test/smoke.test.js checks the app starts\nUse the test runner your framework recommends, and give it a one-line reason (W5).", "check": "npm test" },
+ { "key": "2", "title": "The home page works at phone width", "cites": ["W3"], "criterion": "The home page shows all of its content at 375 pixels wide without sideways scrolling. test/home-phone-width.test.js checks the page at that width and fails before the change.", "brief": "Files:\n- the home page\n- test/home-phone-width.test.js\nTest:\n- test/home-phone-width.test.js renders the home page 375 pixels wide and fails when anything scrolls sideways", "check": "npm test -- test/home-phone-width.test.js" },
+ { "key": "3", "title": "Every change gets a preview link", "cites": ["Q2", "Q4"], "after": ["1"], "criterion": "Every pull request gets a preview link from the host the deploy question names. test/preview-config.test.js reads the deploy settings, checks that previews are turned on, and fails before the change.", "brief": "Files:\n- the host's deploy settings file\n- test/preview-config.test.js\nTest:\n- test/preview-config.test.js reads the deploy settings and fails when previews are off", "check": "npm test -- test/preview-config.test.js" }
]
}
diff --git a/src/blueprints/website.json b/src/blueprints/website.json
index 54d0829e..366a5308 100644
--- a/src/blueprints/website.json
+++ b/src/blueprints/website.json
@@ -14,5 +14,9 @@
"questions": [
{ "key": "Q1", "ask": "The site is built with", "choices": ["Astro", "Hugo", "Next.js", "Something else"], "default": "Astro" },
{ "key": "Q2", "ask": "It is hosted on", "choices": ["Netlify", "Vercel", "GitHub Pages", "My own server"], "default": "Netlify" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every internal link points at a real page", "cites": ["WEB2"], "criterion": "Every link from one page of the site to another points at a page that exists in the built site. test/links.test.js builds the site, follows every internal link, and fails before the change.", "brief": "Files:\n- test/links.test.js\nTest:\n- test/links.test.js builds the site locally, follows every internal link, and fails on a link to a missing page", "check": "npm test -- test/links.test.js" },
+ { "key": "2", "title": "Every page reads in full with JavaScript turned off", "cites": ["WEB1"], "criterion": "The main text of every page is in the HTML the site serves, before any script runs. test/no-javascript.test.js reads every built page without running its scripts and fails before the change.", "brief": "Files:\n- test/no-javascript.test.js\nTest:\n- test/no-javascript.test.js reads each built page as plain HTML and fails when its main text is missing", "check": "npm test -- test/no-javascript.test.js" }
]
}
diff --git a/src/blueprints/writing.json b/src/blueprints/writing.json
index 9c0afd04..e0c9d1e5 100644
--- a/src/blueprints/writing.json
+++ b/src/blueprints/writing.json
@@ -14,5 +14,9 @@
"questions": [
{ "key": "Q1", "ask": "The voice is", "choices": ["Plain and direct", "Friendly and casual", "Formal", "Like my past posts"], "default": "Plain and direct" },
{ "key": "Q2", "ask": "Posts publish to", "choices": ["My own blog", "Substack", "Medium", "Somewhere else"], "default": "My own blog" }
+ ],
+ "items": [
+ { "key": "1", "title": "Every fact in a post links to where it came from", "cites": ["WR1"], "criterion": "Every fact a post marks carries a link to where it came from. test/post-sources.test.js reads each post, fails on a marked fact without a link, and fails before the change.", "brief": "Files:\n- posts/\n- test/post-sources.test.js\nTest:\n- test/post-sources.test.js reads every post and fails on a marked fact without a link", "check": "node --test test/post-sources.test.js" },
+ { "key": "2", "title": "A post publishes only after you approve it", "cites": ["WR2", "Q2"], "criterion": "A post is published only when it records your approval, and the publish step refuses a post without it. test/post-approval.test.js tries to publish an unapproved post, expects a refusal, and fails before the change.", "brief": "Files:\n- the publish step\n- test/post-approval.test.js\nTest:\n- test/post-approval.test.js runs the publish step on an unapproved post and expects it to refuse, without publishing anything", "check": "node --test test/post-approval.test.js" }
]
}
diff --git a/src/cli.js b/src/cli.js
index 950ef125..5865d28d 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -2325,6 +2325,12 @@ async function addBlueprint(ctx, board, me, blueprint, { report = true } = {}) {
...(entry.check === undefined ? {} : { check: entry.check }) } }));
// The same checks pullboard add uses, before anything is written. A blueprint's item check is
// stored, never run: no check baseline starts during add, so nothing a blueprint supplies executes.
+ // Every bundled starter carries a check (#724), and only the coordinator sets one, so an agent's
+ // add is refused with the step that works: add it from the coordinator's checkout.
+ if (me.id !== COORDINATOR && starters.some(({ item }) => item.check !== undefined)) {
+ throw new Refused('COORDINATOR_CHECK', `the ${blueprint.name} blueprint's starter items carry checks, and only the coordinator sets an item check; run pullboard blueprint add from the main checkout, or ask your coordinator: pullboard shout coordinator "please add the ${blueprint.name} blueprint"`,
+ 'run the same pullboard blueprint add from the main checkout, where the coordinator works');
+ }
for (const { item } of starters) store.validateItemAddition(board, item);
const files = [];
if (plan.specRows !== source) files.push({ file: ctx.config.spec, before: source, after: plan.specRows });
diff --git a/src/next-steps.js b/src/next-steps.js
index d8afe8fe..edd35c13 100644
--- a/src/next-steps.js
+++ b/src/next-steps.js
@@ -67,6 +67,7 @@ export const NEXT_STEPS = Object.freeze({
BAD_SINCE: 'pass a date: --since 2026-10-08',
BLOCKED: 'take another item with pullboard next, or shout the lane it waits on: pullboard shout <lane> "<text>"',
BLUEPRINT_EXISTS: 'choose a file that does not exist: pullboard blueprint save <new-file>',
+ BLUEPRINT_ITEM_UNCHECKED: 'give the starter item named in the message a criterion and a check command, then run pullboard blueprint add <file> again',
BLUEPRINT_URL: 'download and read the blueprint yourself, then run pullboard blueprint add <local-file>',
BOARD_BUSY: 'wait for the other pullboard process to finish, then retry',
BOARD_SCOPE_UNAVAILABLE: 'link the board: pullboard relay on',
diff --git a/test/blueprint.test.js b/test/blueprint.test.js
index 1c732492..f74ff6ca 100644
--- a/test/blueprint.test.js
+++ b/test/blueprint.test.js
@@ -5,7 +5,7 @@ import { hostname, tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { after, test } from 'node:test';
import { runFixtureChild, runFixtureGit } from './fixture-child.js';
-import { bundledBlueprints, readBlueprint } from '../src/blueprints.js';
+import { bundledBlueprints, readBlueprint, validateBlueprint } from '../src/blueprints.js';
import { parseSpec } from '../src/spec.js';
import { createE2eHelpers } from './e2e-helpers.js';
@@ -37,7 +37,8 @@ function freshBoard(config = {}) {
const repo = join(dir, 'repo');
mkdirSync(repo);
const git = (...args) => runFixtureGit(args, { cwd: repo, env });
- const run = (...args) => runFixtureChild(process.execPath, [BIN, ...args], { cwd: repo, env, encoding: 'utf8' });
+ const runIn = (cwd, ...args) => runFixtureChild(process.execPath, [BIN, ...args], { cwd, env, encoding: 'utf8' });
+ const run = (...args) => runIn(repo, ...args);
git('init', '-q', '-b', 'main');
const init = run('init');
assert.equal(init.status, 0, init.stdout + init.stderr);
@@ -45,7 +46,7 @@ function freshBoard(config = {}) {
writeFileSync(file, `${JSON.stringify({ ...JSON.parse(readFileSync(file, 'utf8')), ...config }, null, 2)}\n`);
git('add', '-A');
git('commit', '-q', '-m', 'chore: set up blueprint fixture');
- return { dir, repo, run, git };
+ return { dir, repo, run, runIn, git };
}
/** Run one command with --json and return its document, failing with its output. */
@@ -165,12 +166,14 @@ test('blueprint add files a blueprint as drafts or nothing at all [S1,I1]', () =
assert.equal(json(box, 'list', '--all').items.length, 0, `${name}: no item is added`);
return JSON.parse(result.stdout).error;
};
+ // Every starter carries a criterion and a check, so each refusal below is the board's own.
+ const bar = { criterion: 'A test fails without the change.', check: 'true' };
// A later starter the board refuses (here a brief over its limit) stops the add before any write.
- const late = refused('late-refusal', [{ key: '1', title: 'First starter', cites: ['W1'] }, { key: '2', title: 'Second starter', brief: 'x'.repeat(8001) }]);
+ const late = refused('late-refusal', [{ key: '1', title: 'First starter', cites: ['W1'], ...bar }, { key: '2', title: 'Second starter', brief: 'x'.repeat(8001), ...bar }]);
assert.equal(late.code, 'BRIEF_TOO_LONG');
// A light or mid starter without what pullboard add requires is refused with add's own refusal.
for (const route of ['light', 'mid']) {
- const error = refused(`${route}-route`, [{ key: '1', title: 'First starter', cites: ['W1'] }, { key: '2', title: 'Second starter', route }]);
+ const error = refused(`${route}-route`, [{ key: '1', title: 'First starter', cites: ['W1'], ...bar }, { key: '2', title: 'Second starter', route, ...bar }]);
assert.equal(error.code, 'NO_BRIEF');
assert.match(error.message, new RegExp(`an item routed ${route} must be buildable cold`, 'u'));
}
@@ -208,15 +211,118 @@ test('every gallery blueprint is bundled and valid [S1]', () => {
}
});
+// A starter check ships to someone else's repo: it only runs the project's own tests, so it holds
+// no deletion, download, install, remote shell, publish, redirect or command substitution.
+const UNSAFE_CHECK = /\b(?:rm|curl|wget|sudo|ssh|scp|install|publish|push|deploy)\b|[>`]|\$\(/u;
+
+test('every bundled starter item carries a criterion and a check [S1,I1]', () => {
+ // Every bundled blueprint files at least one starter, and each carries a criterion and a check.
+ for (const name of bundledBlueprints()) {
+ const blueprint = readBlueprint(name, process.cwd());
+ assert.ok(blueprint.items.length >= 1, `${name} files at least one starter item`);
+ for (const item of blueprint.items) {
+ assert.ok(item.criterion.trim(), `${name} starter ${item.key} carries a criterion`);
+ assert.ok(String(item.check ?? '').trim(), `${name} starter ${item.key} carries a check`);
+ assert.doesNotMatch(item.check, UNSAFE_CHECK, `${name} starter ${item.key} only runs the project's own tests`);
+ }
+ }
+ const flaky = readBlueprint('test-reliability', process.cwd()).items;
+ assert.ok(flaky.some((item) => /flaky/u.test(item.title) && /repeated runs/u.test(item.criterion) && /deterministic/u.test(item.title)),
+ 'test-reliability files one: find a flaky test by repeated runs, then make it deterministic');
+
+ // blueprint add files every bundled starter with its criterion and check, stored and never run.
+ const box = freshBoard({ gate: 'true' });
+ const expected = [];
+ for (const name of bundledBlueprints()) {
+ const added = json(box, 'blueprint', 'add', name);
+ const items = readBlueprint(name, process.cwd()).items;
+ assert.equal(added.items.length, items.length, `${name} files every starter`);
+ assert.deepEqual(added.checksNotRun, added.items.map((item) => item.id), `${name}: every check is stored, none run`);
+ expected.push(...items.map((item) => [item.title, item.criterion, item.check]));
+ }
+ const filed = json(box, 'list', '--all').items.sort((a, b) => a.item_id - b.item_id);
+ assert.deepEqual(filed.map((item) => [item.item_title, item.item_criterion, item.item_check]), expected);
+ assert.ok(filed.every((item) => (item.item_check_baseline ?? null) === null), 'no check baseline ran');
+
+ // init --blueprint files them with both and prints that the checks are stored, not run.
+ const web = readBlueprint('web-app', process.cwd());
+ const fresh = emptyRepo();
+ const started = fresh.run('init', '--blueprint', 'web-app');
+ assert.equal(started.status, 0, started.stdout + started.stderr);
+ const startedItems = (JSON.parse(fresh.run('list', '--json').stdout).items ?? []).sort((a, b) => a.item_id - b.item_id);
+ assert.deepEqual(startedItems.map((item) => [item.item_title, item.item_criterion, item.item_check]), web.items.map((item) => [item.title, item.criterion, item.check]));
+ assert.match(started.stdout, new RegExp(`checks stored, not run: ${startedItems.map((item) => `#${item.item_id}`).join(', ')}; no check baseline ran`, 'u'));
+});
+
+test('blueprint add files a blueprint as drafts only from the coordinator, who sets checks [S1,I1]', () => {
+ // A bundled starter carries a check and only the coordinator sets one: an agent in a lane is
+ // refused before anything is written and told to add it from the main checkout.
+ const box = freshBoard({ lanes: { web: { owns: ['web/'] } } });
+ const spec = readFileSync(join(box.repo, 'SPEC.md'), 'utf8');
+ const worktree = join(box.dir, 'web');
+ box.git('worktree', 'add', '-q', worktree, '-b', 'web/starter');
+ const joined = box.runIn(worktree, 'join', 'web', '--model', 'fixture-model');
+ assert.equal(joined.status, 0, joined.stdout + joined.stderr);
+ const refused = box.runIn(worktree, 'blueprint', 'add', 'web-app', '--json');
+ assert.equal(refused.status, 1, refused.stdout + refused.stderr);
+ const error = JSON.parse(refused.stdout).error;
+ assert.equal(error.code, 'COORDINATOR_CHECK');
+ assert.match(error.message, /web-app blueprint's starter items carry checks/u);
+ assert.match(error.next, /from the main checkout/u);
+ assert.equal(readFileSync(join(box.repo, 'SPEC.md'), 'utf8'), spec, 'nothing is written');
+ assert.equal(json(box, 'list', '--all').items.length, 0, 'no item is filed');
+ assert.equal(json(box, 'blueprint', 'add', 'web-app').items.length, 3, 'the coordinator adds it');
+});
+
+test('a starter item without a check is refused [S1,I1]', () => {
+ // Loaded from a file or checked before a save writes one: a starter without a criterion or a
+ // check is refused by name, the blueprint's and the item's.
+ const starter = { key: '2', title: 'Second starter', cites: ['W1'], criterion: 'A test fails without it.', check: 'npm test' };
+ const cases = [
+ ['no-check', { ...starter, check: undefined }, /no check/u],
+ ['blank-check', { ...starter, check: ' ' }, /no check/u],
+ ['no-criterion', { ...starter, criterion: undefined }, /no criterion/u],
+ ];
+ const box = freshBoard();
+ const spec = readFileSync(join(box.repo, 'SPEC.md'), 'utf8');
+ for (const [name, item, why] of cases) {
+ const value = { ...PUBLISHED, name, items: [PUBLISHED.items[0], item] };
+ assert.throws(() => validateBlueprint(value, `${name}.json`), (error) => {
+ assert.equal(error.code, 'BLUEPRINT_ITEM_UNCHECKED');
+ assert.match(error.message, new RegExp(`blueprint ${name} starter item 2 \\("Second starter"\\)`, 'u'));
+ assert.match(error.message, why);
+ return true;
+ });
+ writeFileSync(join(box.repo, `${name}.json`), `${JSON.stringify(value)}\n`);
+ const refused = box.run('blueprint', 'add', `${name}.json`, '--json');
+ assert.equal(refused.status, 1, refused.stdout + refused.stderr);
+ const error = JSON.parse(refused.stdout).error;
+ assert.equal(error.code, 'BLUEPRINT_ITEM_UNCHECKED');
+ assert.match(error.message, new RegExp(`blueprint ${name} starter item 2`, 'u'));
+ }
+ assert.equal(readFileSync(join(box.repo, 'SPEC.md'), 'utf8'), spec, 'a refused blueprint writes nothing');
+ assert.equal(json(box, 'list', '--all').items.length, 0, 'and files no item');
+
+ // init --blueprint refuses it before writing anything.
+ const outside = mkdtempSync(join(tmpdir(), 'pullboard-blueprint-unchecked-'));
+ DIRS.push(outside);
+ writeFileSync(join(outside, 'unchecked.json'), JSON.stringify({ ...PUBLISHED, name: 'unchecked', items: [{ ...starter, check: undefined }] }));
+ const empty = emptyRepo();
+ const init = empty.run('init', '--blueprint', join(outside, 'unchecked.json'), '--json');
+ assert.notEqual(init.status, 0);
+ assert.equal(JSON.parse(init.stdout).error.code, 'BLUEPRINT_ITEM_UNCHECKED');
+ assert.deepEqual(readdirSync(empty.repo).filter((entry) => entry !== '.git'), [], 'init writes nothing');
+});
+
test('blueprint add files a blueprint as drafts with light and mid starters add accepts [S1,I1]', () => {
// A light or mid starter carrying its brief, criterion and check is filed on that route, with
- // all three passed to the item unchanged; a strong starter needs none of them.
+ // all three passed to the item unchanged; a strong starter needs no brief.
const box = freshBoard({ gate: 'true' });
const brief = 'Files:\n- web/index.html\nTest:\n- test/home.test.js asserts the page fits 375 pixels';
const items = [
{ key: '1', title: 'Light starter', cites: ['W3'], route: 'light', brief, criterion: 'The home page fits 375 pixels.', check: 'true' },
{ key: '2', title: 'Mid starter', cites: ['W1'], route: 'mid', brief, criterion: 'A test fails without the change.', check: 'true', after: ['1'] },
- { key: '3', title: 'Strong starter', cites: ['W2'] },
+ { key: '3', title: 'Strong starter', cites: ['W2'], criterion: 'The suite passes on main.', check: 'true' },
];
writeFileSync(join(box.repo, 'routes.json'), `${JSON.stringify({ ...PUBLISHED, name: 'routes', items })}\n`);
const added = json(box, 'blueprint', 'add', 'routes.json');
@@ -225,7 +331,7 @@ test('blueprint add files a blueprint as drafts with light and mid starters add
assert.deepEqual(filed.map((item) => [item.item_title, item.item_route, item.item_check, item.item_criterion, item.item_brief]), [
['Light starter', 'light', 'true', items[0].criterion, brief],
['Mid starter', 'mid', 'true', items[1].criterion, brief],
- ['Strong starter', 'strong', '', '', ''],
+ ['Strong starter', 'strong', 'true', items[2].criterion, ''],
]);
assert.equal(filed[1].item_after, String(filed[0].item_id));
});
@@ -337,7 +443,7 @@ test('init --blueprint starts a board from a blueprint [I1,S1]', () => {
const checkedRepo = emptyRepo();
const checked = checkedRepo.run('init', '--blueprint', withCheck);
assert.equal(checked.status, 0, checked.stdout + checked.stderr);
- assert.match(checked.stdout, /checks stored, not run: #\d+; no check baseline ran/u, 'the summary says the check was not run');
+ assert.match(checked.stdout, /checks stored, not run: #\d+(?:, #\d+)*; no check baseline ran/u, 'the summary says the checks were not run');
const filed = JSON.parse(checkedRepo.run('list', '--json').stdout).items ?? [];
assert.equal(filed.length, PUBLISHED.items.length, 'every starter is filed, the checked one included');
const starter = filed.find((item) => item.item_title === PUBLISHED.items[0].title);