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
test(api): route person requests through trusted view [B26]
Corey Olson3d5face2d75f
diff --git a/test/api.test.js b/test/api.test.jsindex cb9af3cd..a6da41a2 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -26,7 +26,8 @@ import { createLocalApiHandler } from '../src/api.js';import { allShouts, EVENT_LOG_VERSION, closeBoard, openBoard } from '../src/board.js';import { presentationShout, relayPresentation } from '../src/relay-presentation.js';import { JSON_SHAPES } from '../src/json.js';-import { projectState } from '../src/serve.js';+import { projectState, serveView } from '../src/serve.js';+import { registerProject } from '../src/projects.js';import { SSH_SHELL_MARKERS } from '../src/person.js';import { fetchFresh } from './http-fixture.js';@@ -1486,7 +1487,29 @@ test('[A2] moves run as the named worktree agent and requests stay visible untilassert.deepEqual(afterEscalation.map((event) => event.event_kind), ['escalate', 'shout'], eventsStep.evidence);assert.equal(afterEscalation[0].event_id, escalated.event.event_id, eventsStep.evidence);- const requestStep = await observedApiStep('create person request', apiFetch(api, `${path}/requests`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text: 'Approve the API row' }) }), box.env);+ const previousHome = process.env.PULLBOARD_HOME;+ process.env.PULLBOARD_HOME = box.env.PULLBOARD_HOME;+ let personView;+ let requestStep;+ try {+ registerProject(box.repo);+ personView = await serveView({ port: 0 });+ const viewUrl = new URL(personView.url);+ requestStep = await observedApiStep('create person request through the actual view', apiFetch({+ origin: viewUrl.origin,+ secret: viewUrl.searchParams.get('k'),+ }, `${path}/requests`, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ text: 'Approve the API row' }),+ }), box.env);+ } finally {+ try { await personView?.close(); }+ finally {+ if (previousHome === undefined) delete process.env.PULLBOARD_HOME;+ else process.env.PULLBOARD_HOME = previousHome;+ }+ }const requested = requestStep.document;assertRequiredShape(requested, JSON_SHAPES.http.request.required, `create person request\n${requestStep.evidence}`);const requestId = requested.result.id;diff --git a/test/relay-sealed.test.js b/test/relay-sealed.test.jsindex 0d2ca0b7..2dbaa441 100644--- a/test/relay-sealed.test.js+++ b/test/relay-sealed.test.js@@ -13,7 +13,8 @@ import { serveRelay } from '../relay/service.js';import { createRelayAuth } from '../relay/auth.js';import { createGitHubClient } from '../relay/github.js';import { githubFixture } from './relay-fixture.js';-import { serveApi } from '../src/api.js';+import { serveView } from '../src/serve.js';+import { registerProject } from '../src/projects.js';import * as store from '../src/board.js';import { main } from '../src/cli.js';@@ -731,19 +732,20 @@ test('person recovery explicitly skips one future-engine blocker and publishes aassert.equal(humanStatus.status, 0);assert.equal(humanStatus.stdout.includes('recovery pending for sequence 1; retry pullboard relay recover --skip 1'), true,'human status shows the actionable recovery without counting it as an upload');- const localApi = await serveApi({ runCommand: main, projects: () => [{ root: box.root, name: 'private recovery fixture' }] });+ registerProject(box.root);+ const localView = await serveView({ port: 0 });try {- const apiAddress = new URL(localApi.url);- const apiRequest = await fetch(apiAddress.origin + '/api/v1/boards/' + box.id + '/requests', {- method: 'POST', headers: { 'x-pullboard-key': apiAddress.searchParams.get('k'), 'content-type': 'application/json' },+ const viewAddress = new URL(localView.url);+ const apiRequest = await fetch(viewAddress.origin + '/api/v1/boards/' + box.id + '/requests', {+ method: 'POST', headers: { 'x-pullboard-key': viewAddress.searchParams.get('k'), 'content-type': 'application/json' },body: JSON.stringify({ text: 'request while recovery is pending' }),});const apiRequestResult = await apiRequest.json();- assert.equal(apiRequestResult.error.code, 'RELAY_RECOVERY_PENDING', 'linked local API requests are guarded by the recovery lock');+ assert.equal(apiRequestResult.error.code, 'RELAY_RECOVERY_PENDING', 'the actual view request is guarded by the recovery lock');const afterApiRequest = store.openBoard(join(box.root, '.git/pullboard/board.sqlite'));try { assert.deepEqual(exportBoard(afterApiRequest), originalDocument, 'the refused API request leaves native tables unchanged'); }finally { store.closeBoard(afterApiRequest); }- } finally { await localApi.close(); }+ } finally { await localView.close(); }const beforeInbox = store.openBoard(join(box.root, '.git/pullboard/board.sqlite'));let cursorBeforeInbox;try { cursorBeforeInbox = beforeInbox.db.prepare("SELECT agent_last_shout_id FROM agent WHERE agent_id='coordinator'").get().agent_last_shout_id; }