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(view): ignore board read stamps in stable keys [N26,N40]

Corey Olson41fc3b7f6704
diff --git a/src/view/page-script-3.js b/src/view/page-script-3.js
index 8ba5ecc7..f8c29478 100644
--- a/src/view/page-script-3.js
+++ b/src/view/page-script-3.js
@@ -423,14 +423,17 @@ async function revokeCredential(id) {
}
/**
- * A board read as text with its clock readings blanked: the flow's observation time (asOf) and each queue's oldest age
- * (ageMinutes) are stamped afresh on every read, so two reads that differ only there show the same board (#644).
+ * A board read as text with its clock readings blanked: root observedAt, the flow's observation time (asOf) and each
+ * queue's oldest age (ageMinutes) are stamped afresh on every read, so clock-only changes show the same board (#644).
* Authenticated local report metadata compares recorded facts and native expiry, not display-only duration increments.
* Matching whole JSON keys is safe: a quote inside any string value is escaped, so no title can look like one.
*/
function boardText(state) {
+ const observations = new Set([state?.project, ...(state?.group?.repos ?? []).map(repo => repo.board)]);
return JSON.stringify(state, (_key, value) => value && typeof value === 'object' && reportValidators.has(value)
- ? { reportValidator: reportValidators.get(value) } : value).replace(/"(asOf|ageMinutes)":(?:"[^"]*"|[-+.0-9eE]+|null)/g, '"$1":null');
+ ? { reportValidator: reportValidators.get(value) }
+ : observations.has(value) && value && Object.hasOwn(value, 'observedAt') ? { ...value, observedAt: null } : value)
+ .replace(/"(asOf|ageMinutes)":(?:"[^"]*"|[-+.0-9eE]+|null)/g, '"$1":null');
}
/** Show each queue's oldest age from the board on hand in place: the one thing on the page that moves with the clock alone. */
diff --git a/test/cockpit/fixture.js b/test/cockpit/fixture.js
index 5ffaa67c..dd8ab3c9 100644
--- a/test/cockpit/fixture.js
+++ b/test/cockpit/fixture.js
@@ -610,6 +610,10 @@ async function boardOf(view, root) {
/** Check each reported queue age before comparing observations, so independent clocks stay exact. */
function assertObservationAges(observation) {
+ if (Object.hasOwn(observation ?? {}, 'observedAt')) {
+ assert.equal(typeof observation.observedAt, 'string', 'project.observedAt is a read timestamp');
+ assert.ok(Number.isFinite(Date.parse(observation.observedAt)), 'project.observedAt is a valid read timestamp');
+ }
const flow = observation?.proofStats?.flow;
for (const [state, queue] of Object.entries(flow?.queues ?? {})) {
const oldest = queue?.oldest;
@@ -634,12 +638,13 @@ function withoutObservationAges(value, path = []) {
const flowClock = path.length === 2 && path[0] === 'proofStats' && path[1] === 'flow' && key === 'asOf';
const queueAge = path.length === 5 && path[0] === 'proofStats' && path[1] === 'flow'
&& path[2] === 'queues' && path[4] === 'oldest' && key === 'ageMinutes';
- return !flowClock && !queueAge;
+ const readClock = path.length === 0 && key === 'observedAt';
+ return !flowClock && !queueAge && !readClock;
})
.map(([key, entry]) => [key, withoutObservationAges(entry, [...path, key])]));
}
-/** Validate both clocks independently, then compare every field except asOf and ageMinutes. */
+/** Validate clocks independently, then compare every field except declared observation stamps and derived ages. */
function assertObservationsEqual(expected, actual, message) {
assertObservationAges(expected);
assertObservationAges(actual);
diff --git a/test/cockpit/fixture.test.js b/test/cockpit/fixture.test.js
index f592703f..bcc02b5b 100644
--- a/test/cockpit/fixture.test.js
+++ b/test/cockpit/fixture.test.js
@@ -341,6 +341,7 @@ test('observation-time ages compare by their own clock [A10]', () => {
const secondAsOf = '2026-10-10T10:00:00.129Z';
/** Build one synthetic board observation at the supplied capture time. */
const snapshot = asOf => ({
+ observedAt: asOf,
board: { id: 'same-board', event: { event_id: 42 } },
proofStats: {
flow: {
@@ -360,6 +361,12 @@ test('observation-time ages compare by their own clock [A10]', () => {
const second = snapshot(secondAsOf);
assertObservationsEqual(first, second, '129ms-separated observations match after validating their own ages');
+ const wrongClock = { ...second, observedAt: 'not a timestamp' };
+ assert.throws(() => assertObservationsEqual(first, wrongClock, 'invalid read clock must be rejected'), error => error.code === 'ERR_ASSERTION' && /observedAt/u.test(error.message));
+ const nestedClock = structuredClone(second);
+ nestedClock.board.observedAt = secondAsOf;
+ assert.throws(() => assertObservationsEqual(first, nestedClock, 'nested observedAt remains invariant'), error => error.code === 'ERR_ASSERTION');
+
const wrongAge = structuredClone(second);
wrongAge.proofStats.flow.queues.open.oldest.ageMinutes += 1;
assert.throws(() => assertObservationsEqual(first, wrongAge, 'wrong age must be rejected'), error => error.code === 'ERR_ASSERTION' && /ageMinutes/u.test(error.message));