mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
fix(#647): read the pending queue once per indicator update
The try/catch around _pendingBytes() could not keep _updateConnectionIndicator() from throwing, because _computeConnectionDescriptor() read the queue again, unguarded, right after; its test only passed because it stubbed the compute out. The update now reads the queue once and hands the totals to the compute (which still reads a fresh queue when called on its own), so the hot input path walks the queue once per keystroke and ACK instead of twice. The stubbed test is gone: the COD-133 combinatorial test already pins never-throw. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d8cafc6d0d
commit
67ca0954db
2 files changed
+10
-29
No files matched your search
@@ -509,20 +509,3 @@ describe('_updateConnectionIndicator — COD-136 unchanged-skip', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('connection indicator — the backlog tracking never throws on the input path', () => {
|
||||
it('still renders when the queue cannot be read', () => {
|
||||
const { app, els } = makeApp({ activeSessionId: 's1', _wsState: 'connected' });
|
||||
(app as unknown as { _pendingBytes: () => never })._pendingBytes = () => {
|
||||
throw new Error('no queue');
|
||||
};
|
||||
// The compute reads the queue too, so stub it as the real hot path would see a healthy one.
|
||||
(app as unknown as { _computeConnectionDescriptor: () => unknown })._computeConnectionDescriptor = () => ({
|
||||
display: 'flex',
|
||||
dotClass: 'connection-dot connected',
|
||||
text: 'WS',
|
||||
title: 'Terminal connected over WebSocket',
|
||||
});
|
||||
expect(() => app._updateConnectionIndicator()).not.toThrow();
|
||||
expect(els.connectionText.textContent).toBe('WS');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user