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(core): reopen expired claims during edits [B13]
Corey Olsone9f7150bdb76
diff --git a/src/board.js b/src/board.jsindex 913bd8a1..e83ca77b 100644--- a/src/board.js+++ b/src/board.js@@ -621,9 +621,15 @@ export function validateItemAddition(board, { by, lane, title, criterion = '', p*/export function editItem(board, id, { agentId, brief, route, criterion, check, checkBaseline }) {atomic(board, () => {+ const stored = itemById(board, id);+ const expiredHolder = stored.item_status === 'claimed' && !isHeld(board, stored) ? stored.item_owner : null;const { item, next, command, unfreeze } = validateItemEdit(board, id, { agentId, brief, route, criterion, check });const baseline = normalizeCheckBaseline(agentId, command, checkBaseline);- setItem(board, id, { ...next, ...(unfreeze ? { item_frozen: null, item_frozen_digest: null } : {}) });+ const clearFrozen = unfreeze || Boolean(expiredHolder);+ if (expiredHolder) {+ moveItem(board, id, 'lapse', { checks: {}, set: () => ({ item_owner: null, item_lease_until: null }) });+ }+ setItem(board, id, { ...next, ...(clearFrozen ? { item_frozen: null, item_frozen_digest: null } : {}) });if (baseline || next.item_check !== item.item_check) saveCheckBaseline(board, id, baseline);logEvent(board, agentId, 'edit', id, {...(next.item_brief !== item.item_brief ? { brief: `${next.item_brief.length} characters` } : {}),@@ -631,7 +637,8 @@ export function editItem(board, id, { agentId, brief, route, criterion, check, c...(next.item_criterion !== item.item_criterion ? { criterion: next.item_criterion } : {}),...(command !== undefined ? { check: next.item_check } : {}),...(baseline ? { checkBaseline: baseline } : {}),- ...(unfreeze && item.item_frozen_digest ? { unfrozen: item.item_frozen_digest } : {}),+ ...(clearFrozen && item.item_frozen_digest ? { unfrozen: item.item_frozen_digest } : {}),+ ...(expiredHolder ? { expiredHolder } : {}),});});}diff --git a/test/board.test.js b/test/board.test.jsindex 582d933f..df5dfdb1 100644--- a/test/board.test.js+++ b/test/board.test.js@@ -616,6 +616,46 @@ test('changing a criterion or a check drops the frozen bar, in the open; the nexassert.equal(claimAs(id, 'web-1', 'web').digest, 'digest:Page');});+test('edit after an expired claim reopens it and names its holder [B13]', () => {+ const edits = [+ { title: 'Criterion', change: { criterion: 'the new criterion' } },+ { title: 'Check', change: { check: 'node --test' } },+ { title: 'Route', change: { route: 'mid' } },+ ];+ for (const { title, change } of edits) {+ const id = store.addItem(board, {+ by: 'coordinator', lane: 'web', title, route: 'light', brief: BRIEF,+ criterion: 'the old criterion', check: 'true',+ });+ claimAs(id, 'web-1', 'web');+ clock.advance(2 * HOUR + 1);+ assert.doesNotThrow(+ () => store.editItem(board, id, { agentId: 'coordinator', ...change }),+ `an expired ${title.toLowerCase()} edit must reopen the item before writing its fields`,+ );+ const stored = store.itemById(board, id);+ assert.deepEqual([stored.item_status, stored.item_owner, stored.item_lease_until], ['open', null, null]);+ assert.equal(stored.item_frozen_digest, null);+ const event = store.events(board, { itemId: id }).findLast((entry) => entry.event_kind === 'edit');+ assert.equal(event.event_by, 'coordinator');+ assert.equal(JSON.parse(event.event_detail).expiredHolder, 'web-1');+ assert.equal(JSON.parse(event.event_detail).unfrozen, `digest:${title}`);+ }++ const live = store.addItem(board, {+ by: 'coordinator', lane: 'web', title: 'Live', route: 'light', brief: BRIEF,+ criterion: 'the old criterion', check: 'true',+ });+ claimAs(live, 'web-1', 'web');+ const digest = store.itemById(board, live).item_frozen_digest;+ assert.throws(() => store.editItem(board, live, { agentId: 'coordinator', criterion: 'not yet' }), /HELD/);+ assert.deepEqual(+ [store.itemById(board, live).item_status, store.itemById(board, live).item_owner, store.itemById(board, live).item_frozen_digest],+ ['claimed', 'web-1', digest],+ );+ assert.equal(store.events(board, { itemId: live }).some((entry) => entry.event_kind === 'edit'), false);+});+test('escalate frees an item one tier up, with what was tried attached [B15]', () => {store.register(board, { lane: 'web', path: '/repo-web-3', route: 'light' });const id = routed('Rename', 'light');