refactor(telemetry): drop dead live-collector smoke and the compact/end severity probe

tests/otel.e2e.ts self-skipped on $DSH_OTLP_E2E_ENDPOINT, which nothing in
the repo sets — it never ran; the mock-collector wire spec and the keyless
Loader-composition e2e already cover the pipeline both ways.

The severityOf compact/end probe parsed another package's merged event
shape by string comparison — an untyped cross-package contract that breaks
silently — and its only consumer was the test's own stand-in declaration.
Unknown event types now uniformly fall through as info; outcome semantics
stay with the owning package.
This commit is contained in:
kingwl
2026-07-23 17:49:17 +08:00
parent 70febffe1a
commit b5523b0b48
7 changed files with 14 additions and 50 deletions

View File

@@ -218,15 +218,11 @@ function severityOf(event: SessionEvent): TelemetrySeverity {
return event.data.reason.kind === 'error' ? 'error' : 'info'
case 'prompt/blocked':
return 'warn'
default: {
// Merge-extensible fall-through (no assertNever): types this seam does
// not depend on still get their RFC-pinned severity via a widened
// probe — `compact/end` is declared by dsh-compact, which the seam
// deliberately does not import.
const type: string = event.type
if (type === 'compact/end' && (event.data as { error?: unknown }).error !== undefined) return 'error'
default:
// Merge-extensible fall-through (no assertNever): event types this seam
// does not depend on — including plugin-merged ones it never heard of —
// pass through as info; their owners' outcome semantics stay theirs.
return 'info'
}
}
}

View File

@@ -44,9 +44,10 @@ declare module 'cordis' {
/**
* Severity of a telemetry record, pre-mapped at capture so a receiver can
* alert with zero configuration: `error` for events whose own outcome flag
* says so (`tool/result.isError`, `turn/end` error reasons, `compact/end`
* errors) and for `agent-error` operational records, `warn` for
* `prompt/blocked`, `info` for everything else.
* says so (`tool/result.isError`, `turn/end` error reasons) and for
* `agent-error` operational records, `warn` for `prompt/blocked`, `info`
* for everything else — including event types merged by other packages,
* whose outcome semantics stay with their owners.
*/
export type TelemetrySeverity = 'info' | 'warn' | 'error'