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.

fix: reuse verdict freshness for owned relay reads [E8,H5]

Corey Olsonee1d72c22f90
diff --git a/src/native-board-state.js b/src/native-board-state.js
index d5456509..99829e40 100644
--- a/src/native-board-state.js
+++ b/src/native-board-state.js
@@ -30,7 +30,7 @@ import { projectState } from './serve.js';
import { personRequestStatuses } from './relay-requests.js';
/** Build the complete local API state, including fields that the shared project snapshot omits. */
-export function buildLocalBoardState(root, boardId, board, codeIsMain, { previous = null, fullItemRebuild = true, afterSequence = 0, changedLeases = new Set(), onItemBuild, projects = listApiProjects, scopeCommonDir = null, observedAt = Date.now() } = {}) {
+export function buildLocalBoardState(root, boardId, board, codeIsMain, { previous = null, fullItemRebuild = true, afterSequence = 0, changedLeases = new Set(), onItemBuild, projects = listApiProjects, scopeCommonDir = null, observedAt = Date.now(), freshnessReader = null } = {}) {
if (!Number.isSafeInteger(observedAt) || observedAt < 0) throw new TypeError('native projection needs an observation timestamp');
board = Object.assign(Object.create(board), { clock: { ...board.clock, now: () => new Date(observedAt) } });
board.db.exec('BEGIN');
@@ -64,11 +64,11 @@ export function buildLocalBoardState(root, boardId, board, codeIsMain, { previou
}
const config = loadConfig(root);
- const freshness = verdictProjector(root, board, { main: trunkRevisionReader(repoInfo(root))() });
+ const freshness = freshnessReader ?? verdictProjector(root, board, { main: trunkRevisionReader(repoInfo(root))() }).state;
const state = projectState(root, { seen: null, board, itemProjector: (item, context) => {
if (dirtyIds.has(item.item_id)) {
const projected = context.project();
- const verdictState = freshness.state(item);
+ const verdictState = freshness(item);
return verdictState ? { ...projected, verdictState } : projected;
}
return previous.items.get(item.item_id);
diff --git a/src/relay-presentation.js b/src/relay-presentation.js
index 24f31db7..ff81670d 100644
--- a/src/relay-presentation.js
+++ b/src/relay-presentation.js
@@ -15,6 +15,7 @@ import { stateFileInputs } from './native-board-state.js';
import { fileRevision } from './native-board-state.js';
import { resolveCommit } from './git.js';
import { trunkRevisionReader } from './trunk-revision.js';
+import { cachedVerdictStates } from './verdict-freshness.js';
// A comparison clock is an internal fingerprint input, never a displayed forecast or observation.
const COMPARISON_CLOCK = Date.UTC(2000, 0, 1);
@@ -33,9 +34,11 @@ function readRelayPresentation(root, providedBoard, observedAt) {
const boardId = store.boardId(board);
const config = loadConfig(root);
const projects = () => [{ root: info.root, name: config.name, project: config.project }];
+ // Staged caller boards retain fresh reads; only ordinary owned reads reuse committed verdict state.
+ const freshnessReader = providedBoard ? null : cachedVerdictStates(root, board, info);
/** Preserve a single authorized board, including existing unavailable external milestone entries. */
const project = (clock) => {
- const built = buildLocalBoardState(root, boardId, board, isMain, { projects, scopeCommonDir: info.commonDir, observedAt: clock });
+ const built = buildLocalBoardState(root, boardId, board, isMain, { projects, scopeCommonDir: info.commonDir, observedAt: clock, freshnessReader });
return { ...built.state, sequence: built.sequence };
};
const state = project(observedAt);