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(relay): report days remaining before idle expiry [H18]

Corey Olsoncb58e631e240
diff --git a/relay/README.md b/relay/README.md
index 057b2e0b..336e6598 100644
--- a/relay/README.md
+++ b/relay/README.md
@@ -153,7 +153,7 @@ At sixty idle days, authorized `GET state` and `PUT state` responses include
`state.warning`; event polls include `warning`, live streams emit a named `warning` event,
and the board listing includes `warnings`. Streams send a warning once when it changes,
with normal authorization on every poll. A warning contains only public board
-identity, `BOARD_INACTIVE`, idle days, the ninety-day deletion deadline and next steps.
+identity, `BOARD_INACTIVE`, idle days, `daysLeft` (remaining days rounded up), the ninety-day deletion deadline and next steps.
Linked CLI and view consumers must display this on their next contact; this backend has no
notification delivery and never reads a seal. At ninety idle days, a contact or maintenance
sweep removes the board's journal, sidecars, backups, link and scoped credentials.
diff --git a/relay/retention.js b/relay/retention.js
index 8e8363ca..45c7da84 100644
--- a/relay/retention.js
+++ b/relay/retention.js
@@ -95,6 +95,7 @@ export function createRelayRetention({ directory, backupsDirectory = directory +
const age = time() - activity;
if (age < WARN) return null;
return { board: id, code: 'BOARD_INACTIVE', inactiveDays: Math.floor(age / DAY),
+ daysLeft: Math.max(0, Math.ceil((EXPIRE - age) / DAY)),
deletesAt: new Date(activity + EXPIRE).toISOString(),
message: 'This linked board is inactive and will be deleted after 90 days without new board activity.',
next: 'Make a board move before the deadline, or unlink; the local board stays complete.' };
diff --git a/test/relay-retention.test.js b/test/relay-retention.test.js
index 467bd9aa..00bbee88 100644
--- a/test/relay-retention.test.js
+++ b/test/relay-retention.test.js
@@ -79,6 +79,7 @@ test('[H18] warnings begin at sixty days on authorized contact; compaction and r
assert.equal(warned.status, 200);
assert.equal(warned.body.state.warning.code, 'BOARD_INACTIVE');
assert.equal(warned.body.state.warning.inactiveDays, 60);
+ assert.equal(warned.body.state.warning.daysLeft, 30);
assert.equal(warned.body.state.warning.deletesAt, new Date(start + 90 * DAY).toISOString());
assert.equal((await box.call(null)).body.warnings.length, 2);
assert.equal((await box.call(A, { path: '/events?after=0' })).body.warning.code, 'BOARD_INACTIVE');
@@ -97,6 +98,7 @@ test('[H18] warnings begin at sixty days on authorized contact; compaction and r
assert.equal(chunk.done, false);
delivered += new TextDecoder().decode(chunk.value);
}
+ assert.ok(delivered.includes('event: warning\n'), 'a live client can distinguish warning metadata from sealed board events');
assert.ok(delivered.includes('BOARD_INACTIVE'), 'a live view receives the same authorized warning');
} finally { clearTimeout(warningTimeout); controller.abort(); reader.releaseLock(); }