mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
Fix mail pointer repoint scheduler tests with pending count getter
Add pendingCount getter to MailPointerRepointScheduler to expose the number of handles awaiting repoint. Replace flaky vi.getTimerCount() assertions with direct scheduler state checks.
This commit is contained in:
@@ -1282,6 +1282,13 @@ function setInMemoryOrchestrationMessages(
|
||||
runtime.setOrchestrationDb(db as unknown as OrchestrationDb)
|
||||
}
|
||||
|
||||
function pendingMailPointerRepoints(runtime: OrcaRuntimeService): number {
|
||||
const internals = runtime as unknown as {
|
||||
mailPointerRepointScheduler: { pendingCount: number }
|
||||
}
|
||||
return internals.mailPointerRepointScheduler.pendingCount
|
||||
}
|
||||
|
||||
function bindSinglePtyRun(db: InMemoryOrchestrationMessages, terminalHandle: string): string {
|
||||
db.setRun({
|
||||
id: 'run_test',
|
||||
@@ -35712,7 +35719,7 @@ describe('OrcaRuntimeService', () => {
|
||||
|
||||
await vi.advanceTimersByTimeAsync(20_000)
|
||||
expect(pendingReads).not.toHaveBeenCalled()
|
||||
expect(vi.getTimerCount()).toBe(0)
|
||||
expect(pendingMailPointerRepoints(runtime)).toBe(0)
|
||||
|
||||
runtime.onPtyData('pty-1', '\x1b]0;Codex done\x07', 101)
|
||||
expect(pendingReads).toHaveBeenCalledTimes(1)
|
||||
@@ -35799,7 +35806,7 @@ describe('OrcaRuntimeService', () => {
|
||||
typeof payload === 'string' && payload.includes('orca orchestration check')
|
||||
)
|
||||
).toHaveLength(1)
|
||||
expect(vi.getTimerCount()).toBe(0)
|
||||
expect(pendingMailPointerRepoints(runtime)).toBe(0)
|
||||
db.close()
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
|
||||
@@ -20,6 +20,11 @@ export class MailPointerRepointScheduler {
|
||||
this.timersByHandle.set(handle, timer)
|
||||
}
|
||||
|
||||
/** Handles still awaiting a repoint; a quiet scheduler holds none. */
|
||||
get pendingCount(): number {
|
||||
return this.timersByHandle.size
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
for (const timer of this.timersByHandle.values()) {
|
||||
clearTimeout(timer)
|
||||
|
||||
Reference in New Issue
Block a user