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
fix(api): refresh cached state for request receipts [A2,N26]
Corey Olson16336ee1cf3f
diff --git a/src/api.js b/src/api.jsindex 866b2f42..3b901d77 100644--- a/src/api.js+++ b/src/api.js@@ -55,12 +55,13 @@ function boardStateRevision(root, id, isMain) {event: board.db.prepare('SELECT COALESCE(MAX(event_id), 0) AS id FROM event').get().id,agents,leases,+ requestReceipts: board.db.prepare('SELECT meta_value FROM board_meta WHERE meta_key = ?').get('relay_person_requests')?.meta_value ?? null,milestones: hasExternalMilestones ? milestoneRoadmap(info.root, board) : store.roadmap(board),};}, isMain);const revision = JSON.stringify([info.commonDir, id, resolveCommit(info.root, 'HEAD'), files,- local.event, local.agents, local.leases, local.milestones, store.EVENT_LOG_VERSION,+ local.event, local.agents, local.leases, local.requestReceipts, local.milestones, store.EVENT_LOG_VERSION,]);return { cacheId: info.commonDir + '\0' + id, revision, milestones: local.milestones, cacheable: true };}diff --git a/test/api-http.test.js b/test/api-http.test.jsindex 0c0946cb..dcb4d94e 100644--- a/test/api-http.test.js+++ b/test/api-http.test.js@@ -13,6 +13,8 @@ import { createApiHandler } from '../src/api-http.js';import { registryFile, registerProject } from '../src/projects.js';import { Refused } from '../src/refused.js';import * as store from '../src/board.js';+import { preparePersonRequest } from '../src/person-request.js';+import { receivePersonRequest } from '../src/relay-requests.js';import { fetchFresh } from './http-fixture.js';const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');@@ -210,6 +212,32 @@ async function cachedHttpStateTest(t) {test('[A2, N26] an unchanged board state is reused and a move rebuilds it', cachedHttpStateTest);+test('[A2, N26] a person request receipt refreshes cached state without an event', async (t) => {+ let builds = 0;+ const box = await httpBox(t, { onStateBuild: () => { builds += 1; } });+ const first = await box.call(box.path + '/state');+ assert.equal(first.status, 200);+ assert.equal(builds, 1);++ const board = store.openBoard(join(box.root, '.git', 'pullboard', 'board.sqlite'));+ let eventCountBefore;+ let eventCountAfter;+ try {+ eventCountBefore = board.db.prepare('SELECT COUNT(*) AS count FROM event').get().count;+ const document = preparePersonRequest({ verb: 'add', args: { lane: 'app', title: 'Private receipt fixture' } }, 'cache-receipt-1');+ assert.equal(receivePersonRequest(board, document, {+ sequence: 1, at: new Date().toISOString(), sender: { kind: 'person', userId: 'private-fixture-person' },+ }).status, 'waiting');+ eventCountAfter = board.db.prepare('SELECT COUNT(*) AS count FROM event').get().count;+ } finally { store.closeBoard(board); }+ assert.equal(eventCountAfter, eventCountBefore, 'ordinary person request receipt intake writes no board event');++ const refreshed = await box.call(box.path + '/state');+ assert.ok(refreshed.document.state.personRequests.some((request) => request.id === 'cache-receipt-1'),+ 'the next state response includes the receipt received after the previous cache fill');+ assert.equal(builds, 2, 'request-receipt metadata invalidates the state snapshot');+});+test('[A2] local HTTP state accepts a safe seen cursor and committed code previews', async (t) => {const box = await httpBox(t);box.cli(box.root, 'shout', 'app', 'state cursor baseline');