Skip to content

fix(telemetry): normalize log severity queries - #19

Merged
kitlangton merged 1 commit into
mainfrom
fix/severity-case-maintenance
Sep 2, 2026
Merged

kitlangton merged 1 commit into
mainfrom
fix/severity-case-maintenance

Conversation

@kitlangton

Copy link
Copy Markdown
Owner

Why

Logs stored with severity text such as Info appear in unfiltered results but disappear when filtering for INFO. Stats and facets also split casing variants into separate buckets.

What Changes

Apply the isolated backend severity fix proposed in #12: compare severities case-insensitively and normalize severity groups and facets.

Operation Before After
Filter INFO over Info, INFO, info 1 matching log 3 matching logs
Group those logs by severity 3 buckets One INFO bucket, count 3
Returned and persisted severity text Original casing Original casing

Add a matching NOCASE severity/time index to preserve direct indexed lookups. An in-memory probe with one million synthetic logs measured approximately 140 ms without the matching index versus 0.08 ms with it. The additive index used approximately 19 MiB and took 298 ms to construct in that probe; disk construction varies.

Scope

Backend only. This does not include #12's UI redesign or badge changes, and does not alter trace permalink routing. Existing log text and the old index are not rewritten or removed.

Related #12.

Verification

bun install --frozen-lockfile
bun run test src/telemetry.test.ts
bun run typecheck
bun run web:typecheck
bun run web:build
env TMPDIR=/private/var/folders/dd/5fz89drs5p9_r0fk7rwqqnbr0000gn/T/opencode bun run test
# Successful full-suite rerun with the isolated tuistory relay running:
PATH="$TOOLS/node_modules/.bin:$PATH" TMPDIR="$TOOLS" TUISTORY_LOG_FILE_PATH="$TOOLS/relay.log" bun run test
env TMPDIR=/private/var/folders/dd/5fz89drs5p9_r0fk7rwqqnbr0000gn/T/opencode MOTEL_OTEL_PORT=32386 MOTEL_OTEL_BASE_URL=http://127.0.0.1:32386 MOTEL_OTEL_ENABLED=false bun run release:validate
git diff --cached --check

Seven new regressions were verified red/green; the telemetry suite passes all 60 tests. Server/web typechecks, web build, and clean-consumer release validation pass. Release validation used isolated temporary storage and port 32386.

The initial full suite had three TUI setup failures because the global tuistory installation could not load node-pty's native binary. Installing tuistory@0.0.9 and node-pty@1.0.0 with its native build in an isolated $TOOLS directory resolved the environment issue without changing global tools. With that owned relay running, the full suite passes 211 tests, zero failures, including all 11 real-TUI tests, with no exclusions.

An isolated smoke test verified persisted rows through a fresh read-only service and HTTP search, stats, and facets without changing original severity text.
Independent SQL probes also verified empty/default severity values, aggregate limits, same-timestamp pagination, read-only databases without the new index, and reopening a writer on populated storage.

Apply the backend severity fix proposed in #12 while leaving its UI redesign out of scope. Match stored casing variants and normalize stats and facets without changing returned or persisted severity text.

Add regression coverage at the telemetry store seam and a matching NOCASE index to retain direct severity lookups on large databases.
@kitlangton
kitlangton merged commit 1cd0065 into main Sep 2, 2026
1 check passed
@kitlangton
kitlangton deleted the fix/severity-case-maintenance branch September 2, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant