test(web): cover empty-draft queue flush with a keyless replay scenario
Also pin the queue-item-not-found convergence arm through the hub and document the repeated-trigger contract on steerQueue.
This commit is contained in:
@@ -152,7 +152,10 @@ export class InputHub implements InputService {
|
||||
* order — the same strict-steer operation as the queue dock's per-row
|
||||
* button. A turn closing mid-way (`steer-unavailable`) or a row already
|
||||
* claimed by the agent (`queue-item-not-found`) converges silently, while a
|
||||
* genuine failure surfaces as one composer notice.
|
||||
* genuine failure surfaces as one composer notice. Repeated triggers
|
||||
* (e.g. two rapid empty-draft chords) rely on that `queue-item-not-found`
|
||||
* convergence: the snapshot may still list a row the host already steered,
|
||||
* and the duplicate strict steer is a silent no-op.
|
||||
* @param session - the addressed host session.
|
||||
* @param shell - the resident shell (notice outlet).
|
||||
*/
|
||||
|
||||
@@ -125,12 +125,25 @@ describe('InputHub queue steering (empty-draft accelerated Enter)', () => {
|
||||
await b.runtime.sessions.updateSnapshot('s1', (draft) => {
|
||||
draft.queue = [row('q-1'), row('q-2')]
|
||||
})
|
||||
// The turn closes before the second row: the flush stops, silently.
|
||||
b.updateQueue.mockResolvedValueOnce({
|
||||
ok: false, error: { code: 'steer-unavailable', message: 'closed', details: {} },
|
||||
} as never)
|
||||
b.shell.steerQueue()
|
||||
await vi.waitFor(() => { expect(b.updateQueue).toHaveBeenCalledTimes(1) })
|
||||
expect(b.shell.notices.getSnapshot()).toBeNull()
|
||||
|
||||
// A row the host already claimed (e.g. a repeated empty-draft chord):
|
||||
// the duplicate strict steer is a silent no-op.
|
||||
await b.runtime.sessions.updateSnapshot('s1', (draft) => {
|
||||
draft.queue = [row('q-3')]
|
||||
})
|
||||
b.updateQueue.mockResolvedValueOnce({
|
||||
ok: false, error: { code: 'queue-item-not-found', message: 'claimed', details: {} },
|
||||
} as never)
|
||||
b.shell.steerQueue()
|
||||
await vi.waitFor(() => { expect(b.updateQueue).toHaveBeenCalledTimes(2) })
|
||||
expect(b.shell.notices.getSnapshot()).toBeNull()
|
||||
await b.runtime.dispose()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user