Files
orca/src/main/ipc/bounded-warning-dedupe.test.ts
T
BingZandJinjing be258e23ec Add Grok orchestration group routing (#8058)
* docs: design Grok orchestration group

* docs: plan Grok orchestration group implementation

* fix: add Grok orchestration group

* test(orchestration): accept Windows skill newlines

* Fix @grok orchestration group matching and remove stale planning docs

- Reuse the shared buildAgentNameRe matcher in groups.ts instead of a
  divergent local regex, so orchestration groups honor the same
  Windows launcher-suffix rule (grok.exe/.cmd/.bat/.ps1) as the rest
  of Orca's agent-title detection.
- Add test coverage for real Grok OSC title shapes (spinner-collapsed,
  session titles) and Windows launcher-suffix titles.
- Delete the now-completed design and implementation-plan docs for
  the Grok orchestration group work.

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-07-11 21:43:20 -07:00

32 lines
1.5 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { DEFAULT_WARNING_DEDUPE_MAX_KEYS, shouldEmitBoundedWarning } from './bounded-warning-dedupe'
describe('shouldEmitBoundedWarning', () => {
it('keeps retained warning keys quiet without cascade eviction after saturation', () => {
const warningKeys = new Set<string>()
expect(shouldEmitBoundedWarning(warningKeys, 'retained-1', 3)).toBe(true)
expect(shouldEmitBoundedWarning(warningKeys, 'retained-2', 3)).toBe(true)
expect(shouldEmitBoundedWarning(warningKeys, 'retained-3', 3)).toBe(true)
expect(shouldEmitBoundedWarning(warningKeys, 'overflow', 3)).toBe(true)
expect(shouldEmitBoundedWarning(warningKeys, 'retained-1', 3)).toBe(false)
expect(shouldEmitBoundedWarning(warningKeys, 'retained-2', 3)).toBe(false)
expect(shouldEmitBoundedWarning(warningKeys, 'retained-3', 3)).toBe(false)
expect(shouldEmitBoundedWarning(warningKeys, 'overflow', 3)).toBe(true)
expect([...warningKeys]).toEqual(['retained-1', 'retained-2', 'retained-3'])
})
it('limits repeat emissions for a stable default-cap-plus-one scan', () => {
const warningKeys = new Set<string>()
const keys = Array.from(
{ length: DEFAULT_WARNING_DEDUPE_MAX_KEYS + 1 },
(_, index) => `warning-${index}`
)
expect(keys.filter((key) => shouldEmitBoundedWarning(warningKeys, key))).toEqual(keys)
expect(keys.filter((key) => shouldEmitBoundedWarning(warningKeys, key))).toEqual([keys.at(-1)])
})
})