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(core): verify handled issue and pull authors [C7]
Corey Olsonccf4698241ee
diff --git a/src/board.js b/src/board.jsindex 87bd78cf..4e5f9f12 100644--- a/src/board.js+++ b/src/board.js@@ -1,6 +1,7 @@import { foreignBlockers } from './cross-repo-dependencies.js';import { REFERENCE_ENGINE } from './reference-engine.js';import { validateReferenceTargets } from './reference-lines.js';+import { validateReferenceAuthors } from './reference-authors.js';import {dependencyValues,validateNativeDependencies,@@ -691,9 +692,9 @@ function checkRouted({ brief, route, criterion, check }, engine = ENGINE_VERSION* @param {{ by: string, lane: string, title: string, criterion?: string, specIds?: string[], parentId?: number | null, after?: (number | string)[], brief?: string, route?: string, check?: string }} item* @returns {number} The new item's id.*/-export function addItem(board, { by, lane, title, criterion = '', specIds = [], parentId = null, after = [], brief = '', route = 'strong', check, checkBaseline, barActor }) {+export function addItem(board, { by, lane, title, criterion = '', specIds = [], parentId = null, after = [], brief = '', route = 'strong', check, checkBaseline, barActor, referenceAuthors }) {return atomic(board, () => {- const item = { by, lane, title, criterion, specIds, parentId, after, brief, route, check, checkBaseline, barActor };+ const item = { by, lane, title, criterion, specIds, parentId, after, brief, route, check, checkBaseline, barActor, referenceAuthors };return insertItem(board, item, validateItemAddition(board, item));});}@@ -750,13 +751,13 @@ function validateItemDependencies(board, itemId, after) {}/** Validate an addition before its sender runs a new check, and again when the ordered move applies. */-export function validateItemAddition(board, { by, lane, title, criterion = '', parentId = null, after = [], brief = '', route = 'strong', check }) {+export function validateItemAddition(board, { by, lane, title, criterion = '', parentId = null, after = [], brief = '', route = 'strong', check, referenceAuthors }) {const command = coordinatorCheck(by, check) ?? '';const cleanTitle = title.trim();if (!cleanTitle) throw new Refused('NO_TITLE', 'an item needs a title');checkRoute(route);const engine = board.executionEngineVersion ?? ENGINE_VERSION;- if (engine >= REFERENCE_ENGINE) validateReferenceTargets(brief);+ if (engine >= REFERENCE_ENGINE) { validateReferenceTargets(brief); validateReferenceAuthors(brief, referenceAuthors); }checkRouted({ brief: brief.trim(), route, criterion, check: command }, engine);if (parentId !== null) {const parent = itemById(board, parentId);@@ -780,11 +781,11 @@ export function validateItemAddition(board, { by, lane, title, criterion = '', p* @param {number} id* @param {{ agentId: string, brief?: string, route?: string, criterion?: string, check?: string, after?: (number | string)[] }} change*/-export function editItem(board, id, { agentId, brief, route, criterion, check, after, checkBaseline, reason, barActor }) {+export function editItem(board, id, { agentId, brief, route, criterion, check, after, checkBaseline, reason, barActor, referenceAuthors }) {atomic(board, () => {const stored = itemById(board, id);const expiredHolder = stored.item_status === 'claimed' && !isHeld(board, stored) ? stored.item_owner : null;- const { item, next, command, unfreeze, bar } = validateItemEdit(board, id, { agentId, brief, route, criterion, check, after, reason });+ const { item, next, command, unfreeze, bar } = validateItemEdit(board, id, { agentId, brief, route, criterion, check, after, reason, referenceAuthors });const baseline = normalizeCheckBaseline(agentId, command, checkBaseline);const pendingFields = [...(next.item_criterion !== item.item_criterion ? ['criterion'] : []),@@ -846,7 +847,7 @@ function notifyFileGrowth(board, before, after) {}/** Validate an edit without side effects, so a refused change never starts a shell baseline; a bar correction needs a reason [B31]. */-export function validateItemEdit(board, id, { agentId, brief, route, criterion, check, after, reason }) {+export function validateItemEdit(board, id, { agentId, brief, route, criterion, check, after, reason, referenceAuthors }) {const engine = board.executionEngineVersion ?? ENGINE_VERSION;if (after !== undefined && engine < 10) {throw new Refused('ENGINE_VERSION', `editing item dependencies requires engine 10; this board uses engine ${engine}; upgrade Pullboard before using --after`);@@ -889,7 +890,7 @@ export function validateItemEdit(board, id, { agentId, brief, route, criterion,if (moved.length && item.item_status !== 'open' && (routeChanged || !correctionWhileClaimed)) {throw new Refused('HELD', `item #${id} is ${item.item_status}; change its route, criterion or check only while it is open`);}- if (brief !== undefined && engine >= REFERENCE_ENGINE) validateReferenceTargets(brief);+ if (brief !== undefined && engine >= REFERENCE_ENGINE) { validateReferenceTargets(brief); validateReferenceAuthors(brief, referenceAuthors); }checkRouted({ brief: next.item_brief, route: next.item_route, criterion: next.item_criterion, check: next.item_check }, engine);const unfreeze = next.item_criterion !== item.item_criterion || next.item_check !== item.item_check;return { item, next, command, unfreeze, bar: barCorrectionFields(board, item, next, { reason }) };diff --git a/src/commands/add.js b/src/commands/add.jsindex 6f9c6622..9cf4e719 100644--- a/src/commands/add.js+++ b/src/commands/add.js@@ -1,4 +1,5 @@import { dependencyValues } from '../item-dependencies.js';+import { referenceAuthors } from '../reference-authors.js';/** The pullboard add command, in its own module so an item adding another command never edits these lines. */import * as store from '../board.js';import {@@ -71,6 +72,8 @@ export async function run(io, args) {check: values.check,};buildInFilelessLane(ctx.config, first, after);+ const authors = referenceAuthors(ctx.info.root, item.brief);+ if (authors.length) item.referenceAuthors = authors;const { command } = store.validateItemAddition(board, item);if (command) refuseCheckSyntax(command);if (command) item.checkBaseline = values.wait ? checkBaseline(ctx.info.root, command) : prepareCheckBaseline(ctx.info.root, command);diff --git a/src/commands/edit.js b/src/commands/edit.jsindex 81b6567e..d8bde749 100644--- a/src/commands/edit.js+++ b/src/commands/edit.js@@ -1,4 +1,5 @@import { barReadySetting } from '../bar-readiness.js';+import { referenceAuthors } from '../reference-authors.js';/** The pullboard edit command, in its own module so an item adding another command never edits these lines. */import * as store from '../board.js';import {@@ -50,6 +51,10 @@ export async function run(io, args) {after: editAfter(values.after),...(values.reason !== undefined ? { reason: values.reason } : {}),};+ if (change.brief !== undefined) {+ const authors = referenceAuthors(ctx.info.root, change.brief);+ if (authors.length) change.referenceAuthors = authors;+ }const { item, command } = store.validateItemEdit(board, id, change);if (command && command !== item.item_check) refuseCheckSyntax(command);if (command && (command !== item.item_check || barReadySetting(board).enabled)) change.checkBaseline = values.wait ? checkBaseline(ctx.info.root, command) : prepareCheckBaseline(ctx.info.root, command);diff --git a/src/moves/addItem.js b/src/moves/addItem.jsindex b44cef61..7258141e 100644--- a/src/moves/addItem.js+++ b/src/moves/addItem.js@@ -1,3 +1,4 @@+import { REFERENCE_ENGINE } from '../reference-engine.js';import { CROSS_REPO_DEPENDENCY_ENGINE } from '../cross-repo-dependency-engine.js';import { hasForeignDependencies } from '../item-dependencies.js';import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';@@ -18,7 +19,7 @@ function existingEngine(args, board, at) {/** Preserve every historical floor while preventing older replicas from flattening foreign references. */function minimumEngine(args, board, at) {- return Math.max(existingEngine(args, board, at), hasForeignDependencies(args[0]?.after) ? CROSS_REPO_DEPENDENCY_ENGINE : 1);+ return Math.max(args[0]?.referenceAuthors !== undefined ? REFERENCE_ENGINE : 1, existingEngine(args, board, at), hasForeignDependencies(args[0]?.after) ? CROSS_REPO_DEPENDENCY_ENGINE : 1);}/** Read precisely the actor argument used by this operation [H2,H16]. */diff --git a/src/moves/editItem.js b/src/moves/editItem.jsindex 97e805e2..ca1795b8 100644--- a/src/moves/editItem.js+++ b/src/moves/editItem.js@@ -1,3 +1,4 @@+import { REFERENCE_ENGINE } from '../reference-engine.js';import { CROSS_REPO_DEPENDENCY_ENGINE } from '../cross-repo-dependency-engine.js';import { hasForeignDependencies } from '../item-dependencies.js';import { RIGOR_AUTO_ENGINE } from '../rigor-auto-engine.js';@@ -24,7 +25,7 @@ function existingEngine(args, board, at) {/** Preserve every historical floor while preventing older replicas from flattening foreign references. */function minimumEngine(args, board, at) {- return Math.max(existingEngine(args, board, at), hasForeignDependencies(args[1]?.after) ? CROSS_REPO_DEPENDENCY_ENGINE : 1);+ return Math.max(args[1]?.referenceAuthors !== undefined ? REFERENCE_ENGINE : 1, existingEngine(args, board, at), hasForeignDependencies(args[1]?.after) ? CROSS_REPO_DEPENDENCY_ENGINE : 1);}/** Read precisely the actor argument used by this operation [H2,H16]. */diff --git a/src/reference-authors.js b/src/reference-authors.jsnew file mode 100644index 00000000..c3ae8b48--- /dev/null+++ b/src/reference-authors.js@@ -0,0 +1,36 @@+/** Bind explicit GitHub acknowledgements to source authors without executing referenced content [C7]. */+import { handledReferences } from './reference-lines.js';+import { githubPullClient } from './pr-github.js';+import { Refused } from './refused.js';++/** Recognize only a fixed GitHub issue or PR route; arbitrary references never become fetch URLs. */+function githubReference(target) {+ const match = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/(issues|pull)\/([1-9]\d*)\/?(?:[?#].*)?$/u.exec(target);+ if (!match || [match[1], match[2]].some(part => ['.', '..'].includes(part)) || !Number.isSafeInteger(Number(match[4]))) return null;+ return { repository: `${match[1]}/${match[2]}`, kind: match[3], number: Number(match[4]) };+}++/** Fetch only handled issue/PR authors and carry their checked identity in the same ordered move. */+export function referenceAuthors(root, brief) {+ return handledReferences(brief).flatMap(reference => {+ const source = githubReference(reference.target);+ if (!source) return [];+ const client = githubPullClient(root, source.repository);+ const data = source.kind === 'issues' ? client.readIssue(source.number) : client.read(source.number);+ const author = data?.user?.login;+ if (typeof author !== 'string' || author.toLowerCase() !== reference.handle.toLowerCase()) {+ throw new Refused('REFERENCE_AUTHOR', `${reference.target} was authored by ${author ? `@${author}` : 'an unknown author'}, not @${reference.handle}; use the source author or remove the handle.`);+ }+ return [{ target: reference.target, author }];+ });+}++/** Replay the coordinator's author attestation deterministically, without making network requests. */+export function validateReferenceAuthors(brief, authors = []) {+ const required = handledReferences(brief).filter(reference => githubReference(reference.target));+ if (!Array.isArray(authors) || authors.length !== required.length || required.some((reference, index) =>+ authors[index]?.target !== reference.target || typeof authors[index]?.author !== 'string'+ || authors[index].author.toLowerCase() !== reference.handle.toLowerCase())) {+ throw new Refused('REFERENCE_AUTHOR', 'handled GitHub references need matching source author attestations; use pullboard add or edit to read the issue or PR author, or remove the handle.');+ }+}