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.

test(publish): require second-agent PR status [B3,R3]

Corey Olson2cfc6ae27df0
diff --git a/test/pr-bridge-fixture.js b/test/pr-bridge-fixture.js
index f854239b..d45e45da 100644
--- a/test/pr-bridge-fixture.js
+++ b/test/pr-bridge-fixture.js
@@ -86,7 +86,7 @@ export function landBridgeItems(box) {
/** Stand in for GitHub over real HTTP, refusing every merge endpoint. */
export async function bridgeProvider(t, box) {
- const state = { requests: [], pulls: [], checks: [], annotations: [], annotationsByRun: {}, next: 1 };
+ const state = { requests: [], pulls: [], checks: [], statuses: [], annotations: [], annotationsByRun: {}, next: 1 };
const server = createServer(async (req, res) => {
let raw = '';
for await (const chunk of req) raw += chunk;
@@ -116,6 +116,11 @@ export async function bridgeProvider(t, box) {
}
return reply(200, pull);
}
+ const statusRoute = /^\/repos\/fixture\/repository\/statuses\/([a-f0-9]+)$/u.exec(url.pathname);
+ if (statusRoute && req.method === 'POST') {
+ const status = { ...body, sha: statusRoute[1] };
+ state.statuses.push(status); return reply(201, status);
+ }
if (/\/commits\/[a-f0-9]+\/check-runs$/u.test(url.pathname)) return reply(200, { total_count: state.checks.length, check_runs: state.checks });
const annotations = /\/check-runs\/(\d+)\/annotations$/u.exec(url.pathname);
if (annotations) return reply(200, state.annotationsByRun[annotations[1]] ?? state.annotations);
diff --git a/test/pr-bridge.test.js b/test/pr-bridge.test.js
index fc3c5a83..e6e9ce4e 100644
--- a/test/pr-bridge.test.js
+++ b/test/pr-bridge.test.js
@@ -66,6 +66,21 @@ test("publish opens one pull request with each item's receipt and records the pe
});
+test('a pull request carries a verified-by-a-second-agent status and an outside pull request reads not verified [B3,R3]', async t => {
+ const box = bridgeProject(t);
+ landBridgeItems(box);
+ const provider = await bridgeProvider(t, box);
+ const published = await runBridgeCLI(box, 'publish', '--json');
+ assert.equal(published.code, 0, published.err);
+ const pull = provider.pulls[0];
+ const status = provider.statuses.findLast(entry => entry.sha === pull.head.sha
+ && entry.context === 'pullboard/verified-by-second-agent');
+ assert.equal(status?.state, 'failure',
+ 'the actual PR must carry not verified while its unreceipted configuration/merge commits lack second-agent proof');
+ assert.equal(status.description, 'not verified');
+});
+
+
test('publication modes are opt-in and invalid values refuse before a push [B3,R3]', () => {
assert.equal(configFromSource('{}').publish?.pullRequest ?? false, false);
for (const mode of [false, 'release', 'item']) {