test: remove 321 low-value main and shared tests (#39429)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-07 01:37:39 -08:00
committed by GitHub
co-authored by OrcaWin
parent fc18a6be45
commit 95fadd01ba
83 changed files with 20 additions and 6679 deletions
@@ -1,11 +1,6 @@
import { describe, expect, it } from 'vitest'
import {
foldSubagentItems,
namedSubagents,
subagentFallbackText
} from './native-chat-subagent-items'
import { foldSubagentItems, subagentFallbackText } from './native-chat-subagent-items'
import { projectNativeChatTranscriptMessages } from './native-chat-transcript-projection'
import { formatWorkerTranscriptMessage } from '../../worker-transcript-text'
import type {
NativeChatMessage,
NativeChatSubagentBlock,
@@ -85,37 +80,6 @@ describe('a turn’s subagents drawn as one row', () => {
expect(new Set(rows.map((row) => groupOf(row).groupId)).size).toBe(3)
})
it('tells same-named siblings apart without taking a name a sibling already has', () => {
const rows = foldSubagentItems([
item(1, subagent('a', { label: 'Audit' })),
item(2, subagent('b', { label: 'Audit' })),
item(3, subagent('c', { label: 'Audit 2' })),
item(4, subagent('d', { label: 'Audit' })),
item(5, subagent('e', { label: 'Audit 4' }))
])
expect(groupOf(rows[0]).agents.map((agent) => agent.label)).toEqual([
'Audit',
'Audit 3',
'Audit 2',
'Audit 5',
'Audit 4'
])
})
it('hands back the same row while no sibling changed, and a new one when one did', () => {
const a = item(1, subagent('a'))
const b = item(2, subagent('b'))
const first = foldSubagentItems([a, b])[0]
expect(foldSubagentItems([a, b])[0]).toBe(first)
const settled = item(2, subagent('b', { state: 'completed' }))
const next = foldSubagentItems([a, settled])[0]
expect(next).not.toBe(first)
// The sibling that did not change keeps its line, so its memoized row stays put.
expect(groupOf(next).agents[0]).toBe(groupOf(first).agents[0])
})
it('leaves an older host’s roster row, and rows that are not one subagent, as they came', () => {
const roster: NativeChatMessage = {
...text(1, 'system', 'Ran 1 subagent'),
@@ -154,41 +118,3 @@ describe('a turn’s subagents drawn as one row', () => {
])
})
})
describe('the sentence an older client draws', () => {
it('claims no liveness it cannot keep, and names an adverse outcome', () => {
expect(subagentFallbackText(subagent('a', { label: 'Audit' }))).toBe(
'Kicked off subagent Audit'
)
expect(subagentFallbackText(subagent('a', { label: 'Audit', state: 'completed' }))).toBe(
'Ran subagent Audit'
)
expect(subagentFallbackText(subagent('a', { label: 'Audit', state: 'failed' }))).toBe(
'Ran subagent Audit (failed)'
)
})
it('is what a text surface prints, once, and the block alone still prints it', () => {
const own = item(1, subagent('a', { label: 'Audit' }))
expect(formatWorkerTranscriptMessage(own)).toBe('[system] Kicked off subagent Audit')
expect(formatWorkerTranscriptMessage({ ...own, blocks: own.blocks.slice(1) })).toBe(
'[system] [subagents] Kicked off subagent Audit'
)
})
})
describe('the subagents a row names', () => {
it('reads an older host’s roster and a subagent’s own row alike', () => {
expect(
namedSubagents(subagent('a', { run: 'r', outcomeBasis: 'stop-acknowledged', tokens: 3 }))
).toEqual([{ id: 'a', label: 'a', state: 'working', tokens: 3 }])
expect(
namedSubagents({
type: 'subagent-group',
groupId: 'g',
agents: [{ id: 'b', label: 'b', state: 'idle' }]
})
).toEqual([{ id: 'b', label: 'b', state: 'idle' }])
expect(namedSubagents({ type: 'text', text: 'x' })).toEqual([])
})
})
@@ -21,15 +21,6 @@ function row(overrides: Partial<NativeChatTurnFoldRow> = {}): NativeChatTurnFold
}
}
/** The turn in the reported session: a prompt, narration, work, then the answer. */
const TURN: NativeChatTurnFoldRow[] = [
row({ role: 'user' }),
row(),
row({ rendersProse: false }),
row(),
row()
]
/** An error-toned system row: the agent or host reporting the turn failed. */
const FAILURE = row({ role: 'system', reportsFailure: true })
@@ -105,57 +96,8 @@ describe('rendered plans in collapsed turns', () => {
})
})
describe('nativeChatTurnAnswerRows', () => {
it('ignores reasoning and system rows, which are never the agent answering', () => {
const rows = [row({ role: 'user' }), row(), row({ role: 'reasoning' }), row({ role: 'system' })]
expect([...nativeChatTurnAnswerRows(rows)]).toEqual([1])
})
})
describe('nativeChatTurnFold', () => {
it('folds a settled turn to its answer', () => {
const { foldedRows } = nativeChatTurnFold({
rows: TURN,
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect([...foldedRows].sort()).toEqual([1, 2, 3])
})
// A stored-only provider event draws nothing: a disclosure over it would open onto nothing.
it('offers no disclosure for a turn whose only other row draws nothing', () => {
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows: [
row({ role: 'user' }),
row({ role: 'system', rendersProse: false, draws: false }),
row()
],
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect(foldedRows.size).toBe(0)
expect(foldableTurnKeys.size).toBe(0)
})
it('folds nothing while the turn is still running', () => {
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows: TURN,
settledTurnKeys: NONE,
expandedTurnKeys: NONE
})
expect(foldedRows.size).toBe(0)
expect(foldableTurnKeys.size).toBe(0)
})
it('reveals every row of a turn the reader opened, and still reports it foldable', () => {
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows: TURN,
settledTurnKeys: SETTLED,
expandedTurnKeys: SETTLED
})
expect(foldedRows.size).toBe(0)
expect([...foldableTurnKeys]).toEqual(['turn-1'])
})
it('keeps a spawn roster or background task out of the fold', () => {
const rows = [row({ role: 'user' }), row(), row({ outlivesTurn: true }), row()]
@@ -168,28 +110,6 @@ describe('nativeChatTurnFold', () => {
expect(foldedRows.has(1)).toBe(true)
})
it('folds a prose-less turn whole, so its commands do not return to the transcript', () => {
const rows = [row({ role: 'user' }), row({ rendersProse: false }), row({ rendersProse: false })]
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows,
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect([...foldedRows].sort()).toEqual([1, 2])
expect([...foldableTurnKeys]).toEqual(['turn-1'])
})
it('offers no disclosure on a turn that is nothing but its answer', () => {
const rows = [row({ role: 'user' }), row()]
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows,
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect(foldedRows.size).toBe(0)
expect(foldableTurnKeys.size).toBe(0)
})
it('folds each settled turn to its own answer and leaves a running turn alone', () => {
const rows = [
row({ turnKey: 'turn-1', role: 'user' }),
@@ -207,16 +127,6 @@ describe('nativeChatTurnFold', () => {
expect([...foldedRows]).toEqual([1])
})
it('leaves rows before the first prompt alone', () => {
const rows = [row({ turnKey: undefined }), row({ turnKey: undefined })]
const { foldedRows } = nativeChatTurnFold({
rows,
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect(foldedRows.size).toBe(0)
})
it('ends a failed turn on its error, folding the work and prose before it', () => {
const rows = [row({ role: 'user' }), row(), row({ rendersProse: false }), FAILURE]
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
@@ -238,17 +148,6 @@ describe('nativeChatTurnFold', () => {
expect([...foldedRows].sort()).toEqual([1, 2])
})
it('shows a turn that is nothing but its error as that error, with no disclosure', () => {
const rows = [row({ role: 'user' }), FAILURE]
const { foldedRows, foldableTurnKeys } = nativeChatTurnFold({
rows,
settledTurnKeys: SETTLED,
expandedTurnKeys: NONE
})
expect(foldedRows.size).toBe(0)
expect(foldableTurnKeys.size).toBe(0)
})
it('never folds a compaction report, and keeps the last prose as the answer', () => {
const rows = [
row({ role: 'user' }),