Skip to content

Commit 45cb830

Browse files
ThinkOffAppclaude
andcommitted
tests: fresh fixture timestamps for the poller's age gate; assert on lines, not text
The seen-state fixtures carried midnight timestamps that the new age gate rightly skips after 6 h; the stale-gate test matched the March text that #92's asker-context legitimately appends to the fresh line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 170c0c5 commit 45cb830

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎test/seen-state.test.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ test('the live poller remembers each message as it is handled, not once per batc
3333
const stub = path.join(stubDir, 'curl');
3434
// first call (seeding, limit=50) must return nothing so the ids are unseen;
3535
// later calls return the two messages
36+
const t1 = new Date(Date.now() - 2000).toISOString(); const t2 = new Date(Date.now() - 1000).toISOString();
3637
writeFileSync(stub, `#!/bin/sh
37-
case "$*" in *limit=50*) echo "[]";; *) echo '[{"id":"m1","from":"petrus","body":"hello one","created_at":"2026-09-02T00:00:01Z"},{"id":"m2","from":"petrus","body":123,"created_at":"2026-09-02T00:00:02Z"}]';; esac
38+
case "$*" in *limit=50*) echo "[]";; *) echo '[{"id":"m1","from":"petrus","body":"hello one","created_at":"${t1}"},{"id":"m2","from":"petrus","body":123,"created_at":"${t2}"}]';; esac
3839
`);
3940
chmodSync(stub, 0o755);
4041
process.env.PATH = `${stubDir}:${savedPath}`;
@@ -66,8 +67,9 @@ test('with #92 thread context: the state-of-play header lands once, before the f
6667
try {
6768
const stubDir = path.join(dir, 'bin'); mkdirSync(stubDir);
6869
const stub = path.join(stubDir, 'curl');
70+
const t1 = new Date(Date.now() - 2000).toISOString(); const t2 = new Date(Date.now() - 1000).toISOString();
6971
writeFileSync(stub, `#!/bin/sh
70-
case "$*" in *limit=50*) echo "[]";; *) echo '[{"id":"s1","from":"@claudeMB","body":"state: the card is the benchmark table v2, not hardware","created_at":"2026-09-02T00:00:01Z"},{"id":"o1","from":"petrus","body":"claudemm what is the card","created_at":"2026-09-02T00:00:02Z"}]';; esac
72+
case "$*" in *limit=50*) echo "[]";; *) echo '[{"id":"s1","from":"@claudeMB","body":"state: the card is the benchmark table v2, not hardware","created_at":"${t1}"},{"id":"o1","from":"petrus","body":"claudemm what is the card","created_at":"${t2}"}]';; esac
7173
`);
7274
chmodSync(stub, 0o755);
7375
process.env.PATH = `${stubDir}:${savedPath}`;

‎test/stale-gate.test.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ case "$*" in *limit=50*) echo "[]";; *) echo '[{"id":"old1","from":"petrus","bod
2727
const seen = loadSeenIds(seenFile);
2828
assert.ok(seen.has('old1') && seen.has('new1'), 'both remembered');
2929
const notify = existsSync(notifyFile) ? readFileSync(notifyFile, 'utf8') : '';
30-
assert.ok(!/codex make 2.0 release/.test(notify), 'the March message is not delivered');
30+
// #92 appends the asker's previous message as context to the fresh line, so
31+
// the March TEXT may appear inside it; what must not exist is a LINE for it.
32+
assert.ok(!notify.split('\n').some((l) => l.startsWith('[2026-03-08')), 'the March message is not delivered as a line');
3133
assert.match(notify, /petrus: claudemm are you there/, 'control: the fresh message is delivered');
3234
assert.ok(logs.some((l) => /1 message\(s\) older than 21600s marked seen without notifying/.test(l)), logs.join('\n'));
3335
} finally {

0 commit comments

Comments
 (0)