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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(spec): sign SSH-backed approvals [S17,S18,S19,S20,S21]
Corey Olson4f85ce98018c
diff --git a/docs/api.md b/docs/api.mdindex 9d324588..351a477b 100644--- a/docs/api.md+++ b/docs/api.md@@ -61,6 +61,7 @@ A successful command returns the fields listed below. `version` is always the nu| `spec show` | `version:number`, `row:object`, `standing:object` || `spec unmet` | `version:number`, `rows:array` || `spec signoff` | `version:number`, `count:number`, `by:string`, `ids:array`, `evidence:array` |+| `spec signers` | `version:number`, `added:boolean`, `by:string`, `path:string`, `initial:boolean` || `hook pre-commit` | `version:number`, `messages:array` || `hook commit-msg` | `version:number`, `messages:array` || `hook pre-push` | `version:number`, `messages:array` |@@ -89,3 +90,9 @@ A refusal keeps the command's existing exit status and prints exactly one versio<!-- api-refusal-shapes:end -->The result and refusal tables are checked against `JSON_SHAPES` in `src/json.js` by `docs/api.test.js`.++## SSH spec sign-offs++`pullboard spec signers add [--key <path>] [--by <principal>]` opts a repo into OpenSSH-signed spec sign-offs. The key defaults to Git `user.signingkey`, then `~/.ssh/id_ed25519.pub`. The principal defaults to the exact Git `user.email`; `--by` overrides it. `spec signoff` uses the same email default in a repo with SSH signers, and accepts `--by` when a listed principal differs. A row's `signers:` names those exact principals.++The initial command output names `.pullboard/signers`, `.pullboard/first-commit` and `.pullboard/signers.initial` for staging and committing. Later sign-offs and signed signer-list changes are recorded in `.pullboard/signoffs.jsonl`; commit that file with the corresponding signer-list change.diff --git a/src/cli.js b/src/cli.jsindex 1b7fc430..5ce6cf3e 100644--- a/src/cli.js+++ b/src/cli.js@@ -48,6 +48,7 @@ import { citedTestFiles, rowEvidence, rowStage } from './evidence.js';import { serveView } from './serve.js';import { doctorProblems } from './doctor.js';import { exportBoard, importBoard } from './exchange.js';+import { addSigner, defaultPrincipal, readSignerText } from './signature.js';const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));export const VERSION = PACKAGE.version;@@ -122,8 +123,10 @@ Specpullboard forget <path> remove a repo from this machine's project listpullboard spec check lint SPEC.md and PRACTICE.mdpullboard spec view [--out file] the spec, open questions, sign-offs and practice as one page- pullboard spec show <id> | unmet [--must] | signoff <ids> --by <initials>+ pullboard spec show <id> | unmet [--must] | signoff <ids> [--by <principal>]signoff: --note "what was checked" stays with the receipt+ pullboard spec signers add [--key <path>] [--by <principal>] opt into SSH-signed sign-offs+ principal defaults to Git user.email; --by overrides itRole guidespullboard prompt decompose|plan|signoff|review|verify how to do each role; Claude Code gets them as skills@@ -148,6 +151,7 @@ const OPTIONS = {note: { type: 'string' },'note-file': { type: 'string' },by: { type: 'string' },+ key: { type: 'string' },out: { type: 'string' },after: { type: 'string' },brief: { type: 'string' },@@ -1461,6 +1465,7 @@ function specCommand(io, { first, second, rest, values }) {const spec = loadSpec(ctx.info.root, ctx.config);if (!spec.exists) throw new Refused('NO_SPEC', `no ${ctx.config.spec}; run: pullboard init`);const practice = loadSpec(ctx.info.root, { ...ctx.config, spec: ctx.config.practice });+ const signoffs = readSignoffs(ctx.info.root);if (first === 'check' || first === undefined) {const files = [[ctx.config.spec, spec], ...(practice.exists ? [[ctx.config.practice, practice]] : [])];let errors = 0;@@ -1480,14 +1485,23 @@ function specCommand(io, { first, second, rest, values }) {unnamed.forEach((problem) => messages.push(`${ctx.config.spec}: error: ${problem}`));errors += unnamed.length;if (values.json && !errors) {- const rows = files.flatMap(([file, parsed]) => parsed.rows.map(({ id, status, tier, text, gate, serves, section, line }) => (- { id, status, tier, text, gate, serves, section, line, file }+ const rows = files.flatMap(([file, parsed]) => parsed.rows.map(({ id, status, tier, text, gate, serves, signers, section, line }) => (+ { id, status, tier, text, gate, serves, signers, section, line, file })));io.result({ rows });} else messages.forEach((message) => io.say(message));return errors ? 1 : 0;}- const signoffs = readSignoffs(ctx.info.root);+ if (first === 'signers' && second === 'add') {+ const signer = addSigner(ctx.info.root, { by: values.by, key: values.key });+ io.result?.(signer);+ io.say(signer.added+ ? signer.initial+ ? `added SSH signer ${signer.by}; stage and commit ${signer.path}, .pullboard/first-commit, and .pullboard/signers.initial`+ : `added SSH signer ${signer.by} to ${signer.path}; commit ${signer.path} and .pullboard/signoffs.jsonl`+ : `${signer.by} is already listed in ${signer.path}`);+ return 0;+ }if (first === 'view') {const out = values.out ? resolve(ctx.io.cwd, values.out) : join(ctx.info.gitDir, 'pullboard', 'spec.html');const html = renderSpecView({@@ -1529,7 +1543,7 @@ function specCommand(io, { first, second, rest, values }) {}if (first === 'signoff') {const ids = [second, ...rest].filter(Boolean).flatMap((text) => idList(text));- if (!ids.length) throw new Refused('USAGE', 'pullboard spec signoff <ids> --by <name> [--note "what was checked"]');+ if (!ids.length) throw new Refused('USAGE', 'pullboard spec signoff <ids> [--by <principal>] [--note "what was checked"]');const invalid = ids.filter((id) => spec.rows.find((row) => row.id === id)?.status !== 'approved');if (invalid.length) throw new Refused('CANNOT_SIGN', `${invalid.join(', ')}: only approved rows in this spec are signed`);const proof = specProof(ctx);@@ -1543,12 +1557,13 @@ function specCommand(io, { first, second, rest, values }) {for (const item of row.verified) io.say(` verified #${item.id}: ${item.note || '(no accepting note)'}`);}const note = textArg(io, values, 'note') ?? '';- const count = signOff(ctx.info.root, spec, { ids, by: values.by ?? '', on: new Date().toISOString().slice(0, 10), note });- io.result?.({ count, by: values.by, ids, evidence });- io.say(`signed ${count} rows as ${values.by}; commit .pullboard/signoffs.jsonl`);+ const by = values.by ?? (readSignerText(ctx.info.root) ? defaultPrincipal(ctx.info.root) : '');+ const count = signOff(ctx.info.root, spec, { ids, by, on: new Date().toISOString(), note, commit: headCommit(ctx.info.root) ?? '' });+ io.result?.({ count, by, ids, evidence });+ io.say(`signed ${count} rows as ${by}; commit .pullboard/signoffs.jsonl`);return 0;}- throw new Refused('USAGE', 'pullboard spec --json | check | view | show <id> | unmet [--must] | signoff <ids> --by <initials>');+ throw new Refused('USAGE', 'pullboard spec --json | check | view | show <id> | unmet [--must] | signoff <ids> [--by <principal>] | signers add');}/**diff --git a/src/json.js b/src/json.jsindex 64c295b6..71f94277 100644--- a/src/json.js+++ b/src/json.js@@ -59,6 +59,7 @@ export const JSON_SHAPES = {'spec show': shape({ row: 'object', standing: 'object' }),'spec unmet': shape({ rows: 'array' }),'spec signoff': shape({ count: 'number', by: 'string', ids: 'array', evidence: 'array' }),+ 'spec signers': shape({ added: 'boolean', by: 'string', path: 'string', initial: 'boolean' }),'hook pre-commit': shape({ messages: 'array' }),'hook commit-msg': shape({ messages: 'array' }),'hook pre-push': shape({ messages: 'array' }),diff --git a/src/signature.js b/src/signature.jsnew file mode 100644index 00000000..ebf9b660--- /dev/null+++ b/src/signature.js@@ -0,0 +1,290 @@+/** Offline SSH signature handling for spec sign-offs and signer-list transitions [S17,S18,S19,S20,S21]. */+import { createHash, randomUUID } from 'node:crypto';+import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';+import { homedir, tmpdir } from 'node:os';+import { dirname, join, resolve } from 'node:path';+import { spawnSync } from 'node:child_process';+import { Refused } from './refused.js';++export const SIGNERS_FILE = '.pullboard/signers';+export const FIRST_COMMIT_FILE = '.pullboard/first-commit';+const INITIAL_SIGNERS_HASH_FILE = '.pullboard/signers.initial';+export const SIGNOFF_NAMESPACE = 'pullboard-signoff';++/** Hash the exact bytes the repo stores, so whitespace changes are signed changes too. */+export function sha256(text) { return createHash('sha256').update(text).digest('hex'); }++/** Run a git or ssh-keygen command and turn expected tool failures into a typed refusal. */+function runTool(command, args, { cwd, input, inherit = false } = {}) {+ const result = spawnSync(command, args, {+ cwd,+ input,+ encoding: 'utf8',+ stdio: inherit ? ['inherit', 'pipe', 'pipe'] : [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],+ timeout: 30_000,+ });+ if (result.error || result.status !== 0) {+ const detail = (result.stderr || result.error?.message || `${command} exited ${result.status}`).trim();+ throw new Refused('SSH_KEY_FAILED', `${command} failed: ${detail}; check the SSH key and ssh-keygen installation`);+ }+ return (result.stdout ?? '').trim();+}++/** Read Git's configured identity or signing key from its normal config chain. */+function gitSetting(root, key) {+ const result = spawnSync('git', ['config', '--get', key], { cwd: root, encoding: 'utf8' });+ return result.status === 0 ? result.stdout.trim() : '';+}++/** Resolve the public or private key path supplied by the caller or the repo's Git settings. */+function keyPath(root, requested, privateKey) {+ let value = requested || gitSetting(root, 'user.signingkey');+ if (!value) value = join(homedir(), privateKey ? '.ssh/id_ed25519' : '.ssh/id_ed25519.pub');+ if (/^(?:ssh-|ecdsa-|sk-)/u.test(value)) throw new Refused('NOT_SSH_KEY_PATH', 'user.signingkey must name an SSH key file, not inline key data or a GPG key');+ const expanded = value === '~' ? homedir() : value.startsWith('~/') ? join(homedir(), value.slice(2)) : value;+ const path = resolve(root, expanded);+ const privatePath = path.endsWith('.pub') ? path.slice(0, -4) : path;+ const candidates = privateKey ? [privatePath] : [path, `${privatePath}.pub`];+ const found = candidates.find((candidate) => existsSync(candidate));+ if (!found) throw new Refused('SSH_KEY_NOT_FOUND', `SSH key file ${path} was not found; set git user.signingkey or use --key <path>`);+ return found;+}++/** Convert a public key or private key file to the public OpenSSH key line. */+function publicKey(root, requested) {+ const path = keyPath(root, requested, false);+ let line;+ if (path.endsWith('.pub')) line = readFileSync(path, 'utf8').trim().split(/\r?\n/u)[0];+ else line = runTool('ssh-keygen', ['-y', '-f', path], { cwd: root, inherit: true });+ const [type, encoded, ...comment] = line.split(/\s+/u);+ if (!/^(?:ssh-|ecdsa-|sk-)/u.test(type ?? '') || !/^[A-Za-z0-9+/]+={0,2}$/u.test(encoded ?? '')) {+ throw new Refused('NOT_SSH_KEY', 'the selected file is not an OpenSSH public key; GPG keys are not supported');+ }+ return `${type} ${encoded}${comment.length ? ` ${comment.join(' ')}` : ''}`;+}++/** Return the private half corresponding to a configured or explicitly named public key. */+function privateKey(root, requested) { return keyPath(root, requested, true); }++/** Read the signers file as exact UTF-8 text or return the empty initial state. */+export function readSignerText(root) {+ const file = join(root, SIGNERS_FILE);+ return existsSync(file) ? readFileSync(file, 'utf8') : '';+}++/** Find a valid principal in an OpenSSH allowed-signers file. */+export function listsPrincipal(text, principal) {+ return text.split(/\r?\n/u).filter((line) => line.trim() && !line.trimStart().startsWith('#'))+ .some((line) => line.trim().split(/\s+/u)[0].split(',').includes(principal));+}++/** Match the configured Git signing key to a principal already present in an allowed-signer list. */+function principalForSigningKey(root, allowed) {+ const identity = publicKey(root, privateKey(root));+ const [type, blob] = identity.split(/\s+/u);+ for (const line of allowed.split(/\r?\n/u)) {+ const fields = line.trim().split(/\s+/u);+ const keyIndex = fields.findIndex((field) => /^(?:ssh-|ecdsa-|sk-)/u.test(field));+ if (fields[keyIndex] === type && fields[keyIndex + 1] === blob) return fields[0].split(',')[0];+ }+ throw new Refused('UNAUTHORIZED_SIGNERS_CHANGE', 'git user.signingkey is not a key already listed; set it to an authorized SSH private key');+}++/** Read the immutable first commit recorded at opt-in. */+export function readFirstCommit(root) {+ const file = join(root, FIRST_COMMIT_FILE);+ if (!existsSync(file)) throw new Refused('NO_FIRST_COMMIT', `missing ${FIRST_COMMIT_FILE}; run pullboard spec signers add`);+ const commit = readFileSync(file, 'utf8').trim();+ if (!/^[0-9a-f]{40,64}$/u.test(commit)) throw new Refused('BAD_FIRST_COMMIT', `${FIRST_COMMIT_FILE} must contain the repo's first commit id`);+ return commit;+}++/** Read the hash anchoring the first, intentionally unsigned signer-list version. */+function readInitialSignerHash(root) {+ const file = join(root, INITIAL_SIGNERS_HASH_FILE);+ if (!existsSync(file)) throw new Refused('BAD_SIGNERS_BASE', `missing ${INITIAL_SIGNERS_HASH_FILE}; restore the initial signer-list hash`);+ const hash = readFileSync(file, 'utf8').trim();+ if (!/^[0-9a-f]{64}$/u.test(hash)) throw new Refused('BAD_SIGNERS_BASE', `${INITIAL_SIGNERS_HASH_FILE} must contain a SHA-256 hash`);+ return hash;+}++/** Serialize canonical signed content with stable field order. */+export function canonical(record) {+ if (record.type === 'signers') {+ return JSON.stringify({ version: 1, type: record.type, firstCommit: record.firstCommit, previousHash: record.previousHash, previousSigners: record.previousSigners, hash: record.hash, by: record.by, on: record.on });+ }+ return JSON.stringify({ version: 1, type: 'row', firstCommit: record.firstCommit, id: record.id, text: record.text, commit: record.commit, by: record.by, on: record.on, note: record.note ?? '' });+}++/** Sign canonical text with ssh-keygen under the fixed Pullboard namespace. */+export function makeSignature(root, record, requestedKey) {+ const dir = join(tmpdir(), `pullboard-signature-${randomUUID()}`);+ mkdirSync(dir, { recursive: true });+ const message = join(dir, 'message');+ try {+ writeFileSync(message, canonical(record));+ runTool('ssh-keygen', ['-Y', 'sign', '-f', privateKey(root, requestedKey), '-n', SIGNOFF_NAMESPACE, message], { cwd: root, inherit: true });+ return readFileSync(`${message}.sig`, 'utf8').trimEnd();+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}++/** Verify a signature using an exact allowed-signers snapshot and the named principal. */+export function verifySignature(record, allowedText) {+ const dir = join(tmpdir(), `pullboard-verify-${randomUUID()}`);+ mkdirSync(dir, { recursive: true });+ const allowed = join(dir, 'allowed_signers');+ const signature = join(dir, 'record.sig');+ try {+ writeFileSync(allowed, allowedText);+ writeFileSync(signature, `${record.signature ?? ''}\n`);+ runTool('ssh-keygen', ['-Y', 'verify', '-f', allowed, '-I', record.by, '-n', SIGNOFF_NAMESPACE, '-s', signature], { cwd: dir, input: canonical(record) });+ return true;+ } catch (error) {+ if (error instanceof Refused) throw new Refused('BAD_SIGNATURE', `sign-off by ${record.by ?? '(unknown)'} has an invalid signature or unlisted SSH key`);+ throw error;+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}++/** Check every signer-list transition from the recorded initial version to the current file. */+export function verifySignerHistory(root, records) {+ const current = readSignerText(root);+ if (!current) return;+ const firstCommit = readFirstCommit(root);+ let expected = readInitialSignerHash(root);+ for (const record of records.filter((entry) => entry.type === 'signers')) {+ if (record.firstCommit !== firstCommit || record.previousHash !== expected || sha256(record.previousSigners ?? '') !== expected) {+ throw new Refused('UNAUTHORIZED_SIGNERS_CHANGE', 'signer-list history is broken; restore the previous list or sign its change with a key it already listed');+ }+ if (!listsPrincipal(record.previousSigners, record.by)) throw new Refused('UNAUTHORIZED_SIGNERS_CHANGE', `${record.by} was not listed before the signer-list change`);+ verifySignature(record, record.previousSigners);+ if (!/^[0-9a-f]{64}$/u.test(record.hash ?? '')) throw new Refused('UNAUTHORIZED_SIGNERS_CHANGE', 'signer-list record does not name a valid new version hash');+ expected = record.hash;+ }+ if (sha256(current) !== expected) throw new Refused('UNAUTHORIZED_SIGNERS_CHANGE', 'the signer list changed without a signature from a key it already listed');+}++/** Verify signed rows and signer-list transitions when the repo has opted into SSH sign-offs. */+export function verifySignedRecords(root, records) {+ const current = readSignerText(root);+ if (!current) {+ if (existsSync(join(root, FIRST_COMMIT_FILE))) throw new Refused('MISSING_SIGNERS', `${SIGNERS_FILE} was removed after SSH sign-offs were enabled`);+ return records;+ }+ verifySignerHistory(root, records);+ const first = readFirstCommit(root);+ for (const record of records) {+ if (record.type === 'signers') continue;+ if (!record.signature) throw new Refused('MISSING_SIGNATURE', `${record.id ?? 'sign-off'} is unsigned after SSH signers were enabled`);+ if (record.firstCommit !== first) throw new Refused('BAD_SIGNOFF', `${record.id} was signed for a different first commit`);+ if (!listsPrincipal(current, record.by)) throw new Refused('UNLISTED_SIGNER', `${record.by} is not listed in ${SIGNERS_FILE}`);+ verifySignature(record, current);+ }+ return records.filter((record) => record.type !== 'signers');+}++/** Resolve the first commit once, refusing to guess when a shallow clone has no recorded root. */+function firstCommitFromGit(root) {+ const shallow = spawnSync('git', ['rev-parse', '--is-shallow-repository'], { cwd: root, encoding: 'utf8' });+ if (shallow.status !== 0) throw new Refused('NOT_A_REPO', 'signers add needs a Git repository');+ if (shallow.stdout.trim() === 'true') throw new Refused('SHALLOW_BEFORE_OPT_IN', 'opt in from a full clone so Pullboard can record the repo first commit');+ const roots = runTool('git', ['rev-list', '--max-parents=0', 'HEAD'], { cwd: root }).split(/\r?\n/u).filter(Boolean);+ if (roots.length !== 1) throw new Refused('NO_SINGLE_ROOT', 'signers add needs one reachable first commit');+ return roots[0];+}++/** Add a public key to a repo, signing later changes with a key already allowed. */+export function addSigner(root, { by, key } = {}) {+ const text = readSignerText(root);+ const publicLine = publicKey(root, key);+ const principal = by || defaultPrincipal(root);+ if (!/^(?!#)[^\s,]+$/u.test(principal)) throw new Refused('BAD_SIGNER', 'use --by with one SSH principal, or set git user.email');+ const entry = `${principal} namespaces="${SIGNOFF_NAMESPACE}" ${publicLine}`;+ if (!text) {+ const firstCommit = firstCommitFromGit(root);+ const next = `${entry}\n`;+ const folder = dirname(join(root, SIGNERS_FILE));+ mkdirSync(folder, { recursive: true });+ writeAtomic(join(root, SIGNERS_FILE), next);+ writeAtomic(join(root, FIRST_COMMIT_FILE), `${firstCommit}\n`);+ writeAtomic(join(root, INITIAL_SIGNERS_HASH_FILE), `${sha256(next)}\n`);+ return { by: principal, added: true, path: SIGNERS_FILE, initial: true };+ }+ const records = readRawRecords(root);+ verifySignedRecords(root, records);+ if (text.split(/\r?\n/u).some((line) => line === entry)) return { by: principal, added: false, path: SIGNERS_FILE, initial: false };+ const firstCommit = readFirstCommit(root);+ const next = `${text.endsWith('\n') || !text ? text : `${text}\n`}${entry}\n`;+ const record = {+ version: 1,+ type: 'signers',+ firstCommit,+ previousHash: sha256(text),+ previousSigners: text,+ hash: sha256(next),+ by: principalForSigningKey(root, text),+ on: new Date().toISOString(),+ };+ record.signature = makeSignature(root, record);+ verifySignature(record, text);+ appendRecord(root, record);+ writeAtomic(join(root, SIGNERS_FILE), next);+ return { by: principal, added: true, path: SIGNERS_FILE, initial: false };+}++/** Create and validate signed row records before a caller appends any of them. */+export function signRows(root, records, requestedKey) {+ const firstCommit = readFirstCommit(root);+ const allowed = readSignerText(root);+ const signed = records.map((fields) => {+ if (!listsPrincipal(allowed, fields.by)) throw new Refused('UNLISTED_SIGNER', `${fields.by} is not listed in ${SIGNERS_FILE}`);+ const record = { version: 1, type: 'row', firstCommit, ...fields };+ record.signature = makeSignature(root, record, requestedKey);+ verifySignature(record, allowed);+ return record;+ });+ appendRecords(root, signed);+ return signed;+}++/** Use Git's exact email as the allowed-signers principal; `--by` explicitly overrides it. */+export function defaultPrincipal(root) {+ const email = gitSetting(root, 'user.email');+ if (/^(?!#)[^\s,]+$/u.test(email)) return email;+ throw new Refused('BAD_SIGNER', 'set git user.email or pass --by <principal> for the SSH identity');+}++/** Write a whole local trust file by rename, so readers never observe a partial line. */+function writeAtomic(file, text) {+ const temp = `${file}.${process.pid}.${randomUUID()}.tmp`;+ try {+ writeFileSync(temp, text, { mode: 0o600 });+ renameSync(temp, file);+ } finally {+ rmSync(temp, { force: true });+ }+}++/** Read raw sign-off records without applying signer verification recursively. */+function readRawRecords(root) {+ const file = join(root, '.pullboard/signoffs.jsonl');+ if (!existsSync(file)) return [];+ return readFileSync(file, 'utf8').split('\n').filter((line) => line.trim()).map((line, index) => {+ try { return JSON.parse(line); } catch { throw new Refused('BAD_SIGNOFFS', `.pullboard/signoffs.jsonl line ${index + 1} is not JSON`); }+ });+}++/** Append one complete signed JSON record. */+function appendRecord(root, record) {+ appendRecords(root, [record]);+}++/** Append a group of complete signed records in one write. */+function appendRecords(root, records) {+ const file = join(root, '.pullboard/signoffs.jsonl');+ mkdirSync(dirname(file), { recursive: true });+ writeFileSync(file, `${records.map((record) => JSON.stringify(record)).join('\n')}\n`, { flag: 'a', mode: 0o600 });+}diff --git a/src/spec.js b/src/spec.jsindex 9bbca550..8296d17e 100644--- a/src/spec.js+++ b/src/spec.js@@ -11,6 +11,7 @@ import { createHash } from 'node:crypto';import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';import { dirname, join } from 'node:path';import { Refused } from './refused.js';+import { readSignerText, signRows, verifySignedRecords } from './signature.js';export const STATUSES = ['approved', 'draft', 'pending', 'fact', 'wont', 'retired'];export const TIERS = ['must', 'aim'];@@ -21,23 +22,25 @@ export const ID_RE = new RegExp(`^${ID}$`);const ROW_RE = new RegExp(`^- (${ID}) \\[([a-z]+)(?:,\\s*([a-z]+))?\\]\\s+(.+)$`);const ROWISH_RE = new RegExp(`^- ${ID}\\s+\\[`);const SECTION_RE = /^##\s+(.+)$/;-const SIGNER_RE = /^[A-Z][A-Za-z]{1,11}$/;+const SIGNER_RE = /^(?!#)[^\s,]+$/u;/**- * One row's trailing fields, after the text: `| gate: ...` and `| serves: a, b`.+ * One row's trailing fields, after the text: `| gate: ...`, `| serves: a, b` and `| signers: CO,AB`.** @param {string} rest- * @returns {{ text: string, gate: string, serves: string[], unknown: string[] }}+ * @returns {{ text: string, gate: string, serves: string[], signers: string[], unknown: string[] }}*/function splitFields(rest) {const [text = '', ...parts] = rest.split(' | ');- const fields = { text: text.trim(), gate: '', serves: [], unknown: [] };+ const fields = { text: text.trim(), gate: '', serves: [], signers: [], unknown: [] };for (const part of parts) {const [key = '', ...value] = part.split(':');const joined = value.join(':').trim();if (key.trim() === 'gate') fields.gate = joined;else if (key.trim() === 'serves') {fields.serves = joined.split(',').map((id) => id.trim()).filter(Boolean);+ } else if (key.trim() === 'signers') {+ fields.signers = joined.split(',').map((signer) => signer.trim()).filter(Boolean);} else fields.unknown.push(part.trim());}return fields;@@ -114,9 +117,11 @@ function rowFindings(row, maxWords) {if (row.status === 'approved' && row.tier === 'must' && !row.gate) {add('error', 'an approved must-row names its gate: | gate: <the test or check that proves it>');}+ for (const signer of row.signers ?? []) if (!SIGNER_RE.test(signer)) add('error', `signer "${signer}" must be one SSH principal (no spaces or commas)`);+ if (new Set(row.signers ?? []).size !== (row.signers ?? []).length) add('error', 'signers are unique on a row');const words = row.text.split(/\s+/).filter(Boolean).length;if (words > maxWords) add('warning', `${words} words; rows stay under ${maxWords}, the why goes elsewhere`);- for (const part of row.unknown) add('error', `unknown field "${part}"; fields are gate and serves`);+ for (const part of row.unknown) add('error', `unknown field "${part}"; fields are gate, serves and signers`);return findings;}@@ -230,8 +235,7 @@ export function frozenCriterion(spec, item) {*/export function readSignoffs(root) {const file = join(root, SIGNOFFS_FILE);- if (!existsSync(file)) return [];- return readFileSync(file, 'utf8')+ const records = !existsSync(file) ? [] : readFileSync(file, 'utf8').split('\n').filter((line) => line.trim()).map((line, index) => {@@ -241,6 +245,7 @@ export function readSignoffs(root) {throw new Refused('BAD_SIGNOFFS', `${SIGNOFFS_FILE} line ${index + 1} is not JSON`);}});+ return verifySignedRecords(root, records);}/**@@ -277,7 +282,9 @@ export function unmetRows(rows, signoffs, { mustOnly = false } = {}) {(row) =>row.status === 'approved' &&(!mustOnly || row.tier === 'must') &&- !(by.get(row.id)?.met.length),+ (row.signers?.length+ ? row.signers.some((signer) => !by.get(row.id)?.met.some((entry) => entry.by === signer))+ : !(by.get(row.id)?.met.length)),);}@@ -290,9 +297,9 @@ export function unmetRows(rows, signoffs, { mustOnly = false } = {}) {* @param {{ ids: string[], by: string, on: string, note?: string }} signoff* @returns {number} How many rows were signed.*/-export function signOff(root, spec, { ids, by, on, note = '' }) {+export function signOff(root, spec, { ids, by, on, note = '', commit = '' }) {if (!SIGNER_RE.test(by)) {- throw new Refused('BAD_SIGNER', 'sign with initials or a first name: --by CO');+ throw new Refused('BAD_SIGNER', 'sign with one principal: --by <principal>');}const byId = new Map(spec.rows.map((row) => [row.id, row]));const problems = ids.flatMap((id) => {@@ -303,7 +310,13 @@ export function signOff(root, spec, { ids, by, on, note = '' }) {if (problems.length) throw new Refused('CANNOT_SIGN', problems.join('; '));const file = join(root, SIGNOFFS_FILE);mkdirSync(dirname(file), { recursive: true });- const lines = ids.map((id) => JSON.stringify({ id, by, on, text: byId.get(id).text, ...(note ? { note } : {}) }));+ if (readSignerText(root)) {+ if (!commit) throw new Refused('NO_SIGNING_COMMIT', 'signed sign-offs include the commit checked; commit or check out the repo first');+ const rows = ids.map((id) => ({ id, by, on, text: byId.get(id).text, commit, note }));+ signRows(root, rows);+ return ids.length;+ }+ const lines = ids.map((id) => JSON.stringify({ id, by, on: on.slice(0, 10), text: byId.get(id).text, ...(note ? { note } : {}) }));appendFileSync(file, `${lines.join('\n')}\n`);return ids.length;}diff --git a/src/view.js b/src/view.jsindex 86efdc16..0d4073be 100644--- a/src/view.js+++ b/src/view.js@@ -28,6 +28,8 @@ function signoffCell(row, by) {if (standing?.met.length) {const names = standing.met.map((entry) => `${esc(entry.by)} ${esc(entry.on)}`).join(', ');const notes = standing.met.filter((entry) => entry.note).map((entry) => `<div>${esc(entry.by)}: ${esc(entry.note).replaceAll('\n', '<br>')}</div>`).join('');+ const missing = (row.signers ?? []).filter((signer) => !standing.met.some((entry) => entry.by === signer));+ if (missing.length) return { html: `<span class="so so-open">signed ${names}; waiting for ${esc(missing.join(', '))}</span>${notes}`, state: 'open' };return { html: `<span class="so so-met">signed ${names}</span>${notes}`, state: 'met' };}if (standing?.stale.length) {diff --git a/test/api.test.js b/test/api.test.jsindex e165f974..4d595a6d 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -194,6 +194,12 @@ test('[A1] command results match the catalog across roots and subcommands', () =writeFileSync(join(repo, 'test', 'proof.test.js'), "import { test } from 'node:test';\ntest('proof [G1]', () => {});\n");box.git(repo, 'add', 'test/proof.test.js');box.git(repo, 'commit', '-q', '-m', 'test: cite the fixture');+ const signerKey = join(box.dir, 'signer-key');+ execFileSync('ssh-keygen', ['-q', '-t', 'ed25519', '-N', '', '-f', signerKey], { stdio: 'pipe' });+ box.git(repo, 'config', 'user.signingkey', signerKey);+ json(box, repo, 'spec', ['signers', 'add', '--key', `${signerKey}.pub`, '--by', 'CO'], 'signers');+ box.git(repo, 'add', '.pullboard/signers', '.pullboard/signers.initial', '.pullboard/first-commit');+ box.git(repo, 'commit', '-q', '-m', 'chore: opt into signed sign-offs');json(box, repo, 'spec', ['signoff', 'G1', '--by', 'CO'], 'signoff');box.git(repo, 'add', '.pullboard/signoffs.jsonl');box.git(repo, 'commit', '-q', '-m', 'chore: record the fixture signoff');diff --git a/test/signoff.test.js b/test/signoff.test.jsnew file mode 100644index 00000000..c67c41c5--- /dev/null+++ b/test/signoff.test.js@@ -0,0 +1,221 @@+/** SSH sign-off opt-in, rotation, row requirements and tamper rejection [S17,S18,S19,S20,S21]. */+import assert from 'node:assert/strict';+import { execFileSync, spawnSync } from 'node:child_process';+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join, resolve } from 'node:path';+import { test } from 'node:test';+import { canonical } from '../src/signature.js';++const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');+const SPEC = `# Sign-off fixture++## G · Goals+- G1 [approved, must] Exact row text is signed. | gate: test/proof.test.js | signers: CO,AB+`;++/** Create a throwaway OpenSSH Ed25519 private and public key pair. */+function makeKey(path) {+ execFileSync('ssh-keygen', ['-q', '-t', 'ed25519', '-N', '', '-C', '[email protected]', '-f', path], { stdio: 'pipe' });+ return { privateKey: path, publicKey: `${path}.pub` };+}++/** Build a real isolated repo with a cited test, a private board and synthetic Git identity. */+function fixture(t) {+ const dir = mkdtempSync(join(tmpdir(), 'pullboard-signature-'));+ t.after(() => rmSync(dir, { recursive: true, force: true }));+ const root = join(dir, 'repo');+ const keys = join(dir, 'keys');+ mkdirSync(root);+ mkdirSync(keys);+ const co = makeKey(join(keys, 'co'));+ const ab = makeKey(join(keys, 'ab'));+ const binDir = join(dir, 'bin');+ mkdirSync(binDir);+ writeFileSync(join(binDir, 'pullboard'), `#!/bin/sh\nexec "${process.execPath}" "${BIN}" "$@"\n`);+ chmodSync(join(binDir, 'pullboard'), 0o755);+ const env = {+ ...process.env,+ PATH: `${binDir}:${process.env.PATH}`,+ GIT_CONFIG_GLOBAL: '/dev/null',+ GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'CO',+ GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'CO',+ GIT_COMMITTER_EMAIL: '[email protected]',+ PULLBOARD_HOME: join(dir, 'home'),+ };+ const git = (...args) => execFileSync('git', args, { cwd: root, env, encoding: 'utf8', stdio: 'pipe' }).trim();+ const run = (...args) => spawnSync(process.execPath, [BIN, ...args], { cwd: root, env, encoding: 'utf8' });+ git('init', '-q', '-b', 'main');+ git('config', 'user.name', 'CO');+ git('config', 'user.email', '[email protected]');+ git('config', 'user.signingkey', co.privateKey);+ const initialized = run('init');+ assert.equal(initialized.status, 0, initialized.stderr);+ writeFileSync(join(root, 'SPEC.md'), SPEC);+ writeFileSync(join(root, 'PRACTICE.md'), '# Practice\n');+ mkdirSync(join(root, 'test'));+ writeFileSync(join(root, 'test', 'proof.test.js'), "import { test } from 'node:test';\ntest('proof [G1]', () => {});\n");+ git('add', '-A');+ git('commit', '-q', '-m', 'chore: initialize sign-off fixture');+ return { dir, root, keys, co, ab, env, git, run };+}++/** Run a spec command and include both output streams in a useful test assertion. */+function succeeds(box, ...args) {+ const result = box.run('spec', ...args);+ assert.equal(result.status, 0, `${result.stdout}${result.stderr}`);+ return result;+}++test('[S17,S18,S19,S20,S21] signed rows require every named principal and survive a shallow clone', (t) => {+ const box = fixture(t);+ const first = box.git('rev-list', '--max-parents=0', 'HEAD');+ assert.equal(succeeds(box, 'signers', 'add', '--key', box.co.publicKey, '--by', 'CO').status, 0);+ assert.equal(readFileSync(join(box.root, '.pullboard/first-commit'), 'utf8').trim(), first);+ succeeds(box, 'signoff', 'G1', '--by', 'CO', '--note', 'checked the exact row');+ assert.match(succeeds(box, 'check').stdout, /0 errors/);+ const partial = JSON.parse(succeeds(box, 'unmet', '--json').stdout);+ assert.ok(partial.rows.some((row) => row.id === 'G1'), 'the row waits until both named principals have signed');+ const page = join(box.dir, 'spec.html');+ succeeds(box, 'view', '--out', page);+ assert.match(readFileSync(page, 'utf8'), /signed CO[^<]*; waiting for AB/);++ succeeds(box, 'signers', 'add', '--key', box.ab.publicKey, '--by', 'AB');+ assert.match(succeeds(box, 'check').stdout, /0 errors/);+ box.git('config', 'user.signingkey', box.ab.privateKey);+ succeeds(box, 'signoff', 'G1', '--by', 'AB', '--note', 'second required signer');+ assert.doesNotMatch(succeeds(box, 'unmet').stdout, /G1 \[must\]/);++ const signedRows = readFileSync(join(box.root, '.pullboard/signoffs.jsonl'), 'utf8').trim().split('\n').map(JSON.parse);+ assert.ok(signedRows.some((record) => record.type === 'signers' && record.by === 'CO'), 'rotation is signed by a principal in the previous version');+ assert.ok(signedRows.filter((record) => record.type === 'row').every((record) => record.firstCommit === first && record.commit));+ assert.ok(signedRows.filter((record) => record.type === 'row').every((record) => /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/u.test(record.on)), 'signed receipts include the verification time');++ writeFileSync(join(box.root, 'SPEC.md'), SPEC.replace('Exact row text is signed.', 'The exact approved row text is signed.'));+ const stale = JSON.parse(succeeds(box, 'show', 'G1', '--json').stdout);+ assert.equal(stale.standing.stale.length, 2, 'cryptographically valid records become stale when row text changes');++ box.git('add', 'SPEC.md', '.pullboard/signers', '.pullboard/signers.initial', '.pullboard/first-commit', '.pullboard/signoffs.jsonl');+ box.git('commit', '-q', '-m', 'chore: record signed sign-offs');+ box.git('commit', '--amend', '--no-edit', '-q');+ assert.match(succeeds(box, 'check').stdout, /0 errors/, 'rewritten history keeps the self-contained signatures valid');+ box.git('checkout', '-q', '-b', 'rebase-base', first);+ writeFileSync(join(box.root, 'unrelated.txt'), 'rebased history still has the original trust anchor\n');+ box.git('add', 'unrelated.txt');+ box.git('commit', '-q', '-m', 'docs: add an unrelated base change');+ box.git('checkout', '-q', 'main');+ box.git('rebase', '--quiet', 'rebase-base');+ assert.match(succeeds(box, 'check').stdout, /0 errors/, 'rebase keeps signed receipts valid');+ box.git('reset', '--soft', first);+ box.git('commit', '-q', '-m', 'chore: squash signed receipt history');+ assert.match(succeeds(box, 'check').stdout, /0 errors/, 'squash keeps signed receipts valid');+ const clone = join(box.dir, 'shallow');+ execFileSync('git', ['clone', '-q', '--depth=1', `file://${box.root}`, clone], { env: box.env, stdio: 'pipe' });+ const shallowCheck = spawnSync(process.execPath, [BIN, 'spec', 'check'], { cwd: clone, env: box.env, encoding: 'utf8' });+ assert.equal(shallowCheck.status, 0, `${shallowCheck.stdout}${shallowCheck.stderr}`);+});++test('[S19,S20] changed signatures, signer labels and unsigned signer-list edits are refused', (t) => {+ const box = fixture(t);+ succeeds(box, 'signers', 'add', '--key', box.co.publicKey, '--by', 'CO');+ succeeds(box, 'signoff', 'G1', '--by', 'CO');+ const file = join(box.root, '.pullboard/signoffs.jsonl');+ const original = readFileSync(file, 'utf8');++ const tampered = JSON.parse(original);+ tampered.signature = '-----BEGIN SSH SIGNATURE-----\ninvalid\n-----END SSH SIGNATURE-----';+ writeFileSync(file, `${JSON.stringify(tampered)}\n`);+ const badSignature = box.run('spec', 'check');+ assert.notEqual(badSignature.status, 0);+ assert.match(badSignature.stderr, /BAD_SIGNATURE/);++ writeFileSync(file, original);+ const changedNote = JSON.parse(original);+ changedNote.note = 'a different check';+ writeFileSync(file, `${JSON.stringify(changedNote)}\n`);+ const badNote = box.run('spec', 'check');+ assert.notEqual(badNote.status, 0);+ assert.match(badNote.stderr, /BAD_SIGNATURE/);++ writeFileSync(file, original);+ const foreign = makeKey(join(box.keys, 'foreign'));+ const authorizedRow = JSON.parse(original);+ const message = join(box.dir, 'foreign-message');+ writeFileSync(message, canonical(authorizedRow));+ execFileSync('ssh-keygen', ['-Y', 'sign', '-f', foreign.privateKey, '-n', 'pullboard-signoff', message], { cwd: box.root, stdio: 'pipe' });+ authorizedRow.signature = readFileSync(`${message}.sig`, 'utf8').trimEnd();+ writeFileSync(file, `${JSON.stringify(authorizedRow)}\n`);+ const unlistedKey = box.run('spec', 'check');+ assert.notEqual(unlistedKey.status, 0);+ assert.match(unlistedKey.stderr, /BAD_SIGNATURE/);++ writeFileSync(file, original);+ succeeds(box, 'signers', 'add', '--key', box.ab.publicKey, '--by', 'AB');+ const current = readFileSync(file, 'utf8').split('\n').filter(Boolean).map(JSON.parse).find((record) => record.type === 'row');+ const wrongPrincipal = { ...current };+ wrongPrincipal.by = 'AB';+ const records = readFileSync(file, 'utf8').split('\n').filter(Boolean).map(JSON.parse).map((record) => record.type === 'row' ? wrongPrincipal : record);+ writeFileSync(file, `${records.map((record) => JSON.stringify(record)).join('\n')}\n`);+ const badBy = box.run('spec', 'check');+ assert.notEqual(badBy.status, 0);+ assert.match(badBy.stderr, /BAD_SIGNATURE/);++ writeFileSync(file, original);+ writeFileSync(join(box.root, '.pullboard/signers'), `${readFileSync(join(box.root, '.pullboard/signers'), 'utf8')}AB namespaces="pullboard-signoff" ${readFileSync(box.ab.publicKey, 'utf8').trim()}\n`);+ const unsignedListChange = box.run('spec', 'check');+ assert.notEqual(unsignedListChange.status, 0);+ assert.match(unsignedListChange.stderr, /UNAUTHORIZED_SIGNERS_CHANGE/);+});++test('[S19] an unknown signer label never verifies against the authorized key', (t) => {+ const box = fixture(t);+ succeeds(box, 'signers', 'add', '--key', box.co.publicKey, '--by', 'CO');+ succeeds(box, 'signoff', 'G1', '--by', 'CO');+ const file = join(box.root, '.pullboard/signoffs.jsonl');+ const record = JSON.parse(readFileSync(file, 'utf8'));+ record.by = 'ZZ';+ writeFileSync(file, `${JSON.stringify(record)}\n`);+ const check = box.run('spec', 'check');+ assert.notEqual(check.status, 0);+ assert.match(check.stderr, /UNLISTED_SIGNER/);+});++test('[S21] signer setup defaults to the configured Git key and email principal and explains the initial commit', (t) => {+ const box = fixture(t);+ const home = join(box.dir, 'git-home');+ const ssh = join(home, '.ssh');+ mkdirSync(ssh, { recursive: true });+ const configured = makeKey(join(ssh, 'id_ed25519'));+ box.env.HOME = home;+ const globalConfig = join(box.dir, 'global.gitconfig');+ writeFileSync(globalConfig, '[user]\n\temail = [email protected]\n');+ box.env.GIT_CONFIG_GLOBAL = globalConfig;+ box.git('config', '--local', '--unset', 'user.email');+ box.git('config', 'user.signingkey', '~/.ssh/id_ed25519');+ const result = box.run('spec', 'signers', 'add');+ assert.equal(result.status, 0, `${result.stdout}${result.stderr}`);+ assert.match(result.stdout, /added SSH signer global@example\.invalid/);+ assert.match(result.stdout, /\.pullboard\/first-commit/);+ assert.match(result.stdout, /\.pullboard\/signers\.initial/);+ assert.equal(readFileSync(join(box.root, '.pullboard/first-commit'), 'utf8').trim(), box.git('rev-list', '--max-parents=0', 'HEAD'));+ const allowed = readFileSync(join(box.root, '.pullboard/signers'), 'utf8').trim().split(/\s+/u);+ assert.deepEqual(allowed.slice(0, 4), ['[email protected]', 'namespaces="pullboard-signoff"', ...readFileSync(configured.publicKey, 'utf8').trim().split(/\s+/u).slice(0, 2)]);+ const signed = succeeds(box, 'signoff', 'G1');+ assert.match(signed.stdout, /signed 1 rows as global@example\.invalid/);+ assert.match(readFileSync(join(box.root, '.pullboard/signoffs.jsonl'), 'utf8'), /"by":"global@example\.invalid"/);+});++test('[S21] signer setup falls back to ~/.ssh/id_ed25519.pub when Git has no signing key', (t) => {+ const box = fixture(t);+ box.git('config', '--unset', 'user.signingkey');+ const home = join(box.dir, 'home');+ const ssh = join(home, '.ssh');+ mkdirSync(ssh, { recursive: true });+ const fallback = makeKey(join(ssh, 'id_ed25519'));+ box.env.HOME = home;+ const result = box.run('spec', 'signers', 'add');+ assert.equal(result.status, 0, `${result.stdout}${result.stderr}`);+ assert.match(readFileSync(join(box.root, '.pullboard/signers'), 'utf8'), new RegExp(readFileSync(fallback.publicKey, 'utf8').trim().replace(/[.*+?^${}()|[\]\\]/gu, '\\$&')));+});diff --git a/test/spec.test.js b/test/spec.test.jsindex 91f60883..3c1d5d44 100644--- a/test/spec.test.js+++ b/test/spec.test.js@@ -51,6 +51,15 @@ test('rows parse with id, status, tier, text, gate, serves, section and line [S1assert.deepEqual(lintSpec(spec), []);});+test('rows parse signer requirements and lint their names and duplicates [S18]', () => {+ const spec = parseSpec('## G\n- G1 [approved, must] Two people sign. | gate: proof | signers: CO, AB\n');+ assert.deepEqual(spec.rows[0].signers, ['CO', 'AB']);+ assert.deepEqual(lintSpec(spec), []);+ const invalid = lintSpec(parseSpec('## G\n- G1 [approved, must] Bad names. | gate: proof | signers: co,CO,CO\n'));+ assert.ok(invalid.some((finding) => /signer "co" must be initials/u.test(finding.message)));+ assert.ok(invalid.some((finding) => /signers are unique/u.test(finding.message)));+});+test('a row-like line that does not parse is an error, never dropped [S1]', () => {const spec = parseSpec('## G\n- G1 [approved, must]\n- just a bullet note\n');const findings = lintSpec(spec);@@ -214,10 +223,10 @@ test('spec --json emits one versioned document with every field, including emptyassert.deepEqual(data, {version: 1,rows: [- { id: 'G1', status: 'approved', tier: 'must', text: 'Same file twice is a no-op.', gate: 'idempotency test', serves: [], section: 'G · Goals', line: 6, file: 'SPEC.md' },- { id: 'G1.2', status: 'draft', tier: 'aim', text: 'Shows a diff.', gate: '', serves: ['G1'], section: 'G · Goals', line: 7, file: 'SPEC.md' },- { id: 'G2', status: 'retired', tier: '', text: 'Old idea.', gate: '', serves: [], section: 'G · Goals', line: 8, file: 'SPEC.md' },- { id: 'K1', status: 'approved', tier: 'must', text: 'Runs offline.', gate: 'e2e test', serves: ['G1', 'G1.2'], section: 'K · Constraints', line: 11, file: 'SPEC.md' },+ { id: 'G1', status: 'approved', tier: 'must', text: 'Same file twice is a no-op.', gate: 'idempotency test', serves: [], signers: [], section: 'G · Goals', line: 6, file: 'SPEC.md' },+ { id: 'G1.2', status: 'draft', tier: 'aim', text: 'Shows a diff.', gate: '', serves: ['G1'], signers: [], section: 'G · Goals', line: 7, file: 'SPEC.md' },+ { id: 'G2', status: 'retired', tier: '', text: 'Old idea.', gate: '', serves: [], signers: [], section: 'G · Goals', line: 8, file: 'SPEC.md' },+ { id: 'K1', status: 'approved', tier: 'must', text: 'Runs offline.', gate: 'e2e test', serves: ['G1', 'G1.2'], signers: [], section: 'K · Constraints', line: 11, file: 'SPEC.md' },],});});@@ -232,9 +241,9 @@ test('spec --json combines both configured files and keeps every row status [S13assert.equal(data.rows.length, 7);assert.ok(data.rows.slice(0, 4).every((row) => row.file === 'requirements.md'));assert.deepEqual(data.rows.slice(4), [- { id: 'P1', status: 'fact', tier: '', text: 'A fact.', gate: '', serves: [], section: 'P · Practice', line: 4, file: 'ways.md' },- { id: 'P2', status: 'pending', tier: 'must', text: 'A question.', gate: '', serves: [], section: 'P · Practice', line: 5, file: 'ways.md' },- { id: 'P3', status: 'wont', tier: '', text: 'An old plan.', gate: '', serves: [], section: 'P · Practice', line: 6, file: 'ways.md' },+ { id: 'P1', status: 'fact', tier: '', text: 'A fact.', gate: '', serves: [], signers: [], section: 'P · Practice', line: 4, file: 'ways.md' },+ { id: 'P2', status: 'pending', tier: 'must', text: 'A question.', gate: '', serves: [], signers: [], section: 'P · Practice', line: 5, file: 'ways.md' },+ { id: 'P3', status: 'wont', tier: '', text: 'An old plan.', gate: '', serves: [], signers: [], section: 'P · Practice', line: 6, file: 'ways.md' },]);});