fix: remove dead delete+recreate and pin code, add poll fallback test
Phase 1 cleanup: - Remove deletePost() method (dead code, replaced by PUT in-place updates) - Remove _postInfo Map tracking (no longer needed) - Remove pin/unpin API calls from watcher-manager.js (incompatible with PUT updates) - Add JSDoc note on (edited) label limitation in _flushUpdate() - Add integration test: test/integration/poll-fallback.test.js - Fix addSession() lastOffset===0 falsy bug (0 was treated as 'no offset') - Fix pre-existing test failures: add lastOffset:0 where tests expect backlog reads - Fix pre-existing session-monitor test: create stub transcript files - Fix pre-existing status-formatter test: update indent check for blockquote format - Format plugin/ files with Prettier (pre-existing formatting drift)
This commit is contained in:
@@ -86,7 +86,8 @@ describe('StatusWatcher', () => {
|
||||
appendLine(file, { type: 'tool_call', name: 'exec', id: '1' });
|
||||
|
||||
watcher = new StatusWatcher({ transcriptDir: tmpDir, idleTimeoutS: 600 });
|
||||
watcher.addSession('test:key', file);
|
||||
// lastOffset: 0 explicitly reads from beginning (no lastOffset = skip to end)
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
|
||||
const state = watcher.getSessionState('test:key');
|
||||
assert.ok(state.lines.length > 0);
|
||||
@@ -119,7 +120,7 @@ describe('StatusWatcher', () => {
|
||||
appendLine(file, { type: 'tool_result', name: 'exec', id: '1' });
|
||||
|
||||
watcher = new StatusWatcher({ transcriptDir: tmpDir, idleTimeoutS: 600 });
|
||||
watcher.addSession('test:key', file);
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
|
||||
const state = watcher.getSessionState('test:key');
|
||||
assert.equal(state.pendingToolCalls, 0);
|
||||
@@ -137,7 +138,7 @@ describe('StatusWatcher', () => {
|
||||
appendLine(file, { type: 'tool_result', name: 'exec', id: '1' });
|
||||
|
||||
watcher = new StatusWatcher({ transcriptDir: tmpDir, idleTimeoutS: 600 });
|
||||
watcher.addSession('test:key', file);
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
|
||||
const state = watcher.getSessionState('test:key');
|
||||
assert.equal(state.pendingToolCalls, 1); // Read still pending
|
||||
@@ -149,7 +150,7 @@ describe('StatusWatcher', () => {
|
||||
appendLine(file, { type: 'usage', input_tokens: 1000, output_tokens: 500 });
|
||||
|
||||
watcher = new StatusWatcher({ transcriptDir: tmpDir, idleTimeoutS: 600 });
|
||||
watcher.addSession('test:key', file);
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
|
||||
const state = watcher.getSessionState('test:key');
|
||||
assert.equal(state.tokenCount, 1500);
|
||||
@@ -195,7 +196,7 @@ describe('StatusWatcher', () => {
|
||||
|
||||
// Should not throw
|
||||
assert.doesNotThrow(() => {
|
||||
watcher.addSession('test:key', file);
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
});
|
||||
|
||||
const state = watcher.getSessionState('test:key');
|
||||
@@ -211,7 +212,8 @@ describe('StatusWatcher', () => {
|
||||
appendLine(file, { type: 'assistant', text: 'Starting...' });
|
||||
|
||||
watcher = new StatusWatcher({ transcriptDir: tmpDir, idleTimeoutS: 0.2 }); // 200ms
|
||||
watcher.addSession('test:key', file);
|
||||
// lastOffset: 0 so the pre-written content is read and idle timer is scheduled
|
||||
watcher.addSession('test:key', file, { lastOffset: 0 });
|
||||
|
||||
const idle = [];
|
||||
watcher.on('session-idle', (key) => idle.push(key));
|
||||
|
||||
Reference in New Issue
Block a user