mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
fix(assistant): a change left waiting past its day no longer holds the next one back
The open changes of a thread are now the ones still inside their decision window. A call older than a day already reads as expired in the thread and can no longer be decided, but it stayed approval_requested until the nightly sweep, so "+ Tour", "+ Day" and "Plan this" answered decide_first with nothing left to decide, and a decision had to name the expired call too. listOpen takes the window's start, and every caller passes the same cutoff.
This commit is contained in:
@@ -324,7 +324,9 @@ describe('proposed changes', () => {
|
||||
const { threadId, messageId } = await threadWithMessage();
|
||||
await calls.insertProposals([proposal('c1', threadId, messageId), proposal('c2', threadId, messageId)]);
|
||||
await calls.insertProposals([]);
|
||||
expect((await calls.listOpen(threadId)).map((row) => row.id)).toEqual(['c1', 'c2']);
|
||||
expect((await calls.listOpen(threadId, AT)).map((row) => row.id)).toEqual(['c1', 'c2']);
|
||||
// Proposed before `notBefore`, a change waits no more, though no sweep has marked it expired yet.
|
||||
expect(await calls.listOpen(threadId, LATER)).toEqual([]);
|
||||
|
||||
expect(await calls.claimDecision('c1', threadId + 1, true, AT, LATER)).toBe(false);
|
||||
expect(await calls.claimDecision('c1', threadId, true, '2026-10-21 00:00:00', LATER)).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user