fix: log digests strip the dates, so a failed-then-fixed error looks live #39

Closed
opened 2026-11-05 06:48:16 +00:00 by david · 1 comment
Owner

knox_search(scope=logs) returns a digest like:

levels: E151 W370 | err: level=ERROR run=<RUN> message="Failed to drain Session" cause="AI.Error: Upstream request failed: Insufficient account funds" ;; level=ERROR run=<RUN> message="Failed to fetch models.dev" cause="Cause([Die(Error: ENOSPC: no space left on device, mkdir '/home/david/.local/state/opencode/lo...

Everything that makes an error diagnosable has been normalized away, including when it happened. A disk-full failure from Oct 22 (fixed the same day) and a provider billing rejection from Nov 1 render as identical-looking lines, so a resolved fault reads exactly like a live one. Dating them required going back to the raw log.

Cause

normalizeLogLine strips timestamp= first (tsPrefixRE = ^timestamp=\S+\s*), so the day is gone before signatures are de-duplicated and rendered. The timestamp is the one volatile field that carries meaning: it is what separates "still happening" from "already fixed".

Expected

  • Every signature carries the day(s) it was seen: 2026-10-22 level=ERROR ... when seen once, 2026-10-01..2026-11-01 level=ERROR ... for a range.
  • Signatures are ordered most-recently-seen first, so the summary's err: sample shows what is live now instead of what sorts first alphabetically.
  • Times of day, run ids and session/message ids still normalize away: the content hash stays stable within a day, and moves only when a recurring error recurs on a new day (which is exactly when the digest should be rewritten).
  • Ingester version bumps to log-parser/v3.
`knox_search(scope=logs)` returns a digest like: ``` levels: E151 W370 | err: level=ERROR run=<RUN> message="Failed to drain Session" cause="AI.Error: Upstream request failed: Insufficient account funds" ;; level=ERROR run=<RUN> message="Failed to fetch models.dev" cause="Cause([Die(Error: ENOSPC: no space left on device, mkdir '/home/david/.local/state/opencode/lo... ``` Everything that makes an error diagnosable has been normalized away, including **when** it happened. A disk-full failure from Oct 22 (fixed the same day) and a provider billing rejection from Nov 1 render as identical-looking lines, so a resolved fault reads exactly like a live one. Dating them required going back to the raw log. ## Cause `normalizeLogLine` strips `timestamp=` first (`tsPrefixRE` = `^timestamp=\S+\s*`), so the day is gone before signatures are de-duplicated and rendered. The timestamp is the one volatile field that carries meaning: it is what separates "still happening" from "already fixed". ## Expected - Every signature carries the day(s) it was seen: `2026-10-22 level=ERROR ...` when seen once, `2026-10-01..2026-11-01 level=ERROR ...` for a range. - Signatures are ordered most-recently-seen first, so the summary's `err:` sample shows what is live now instead of what sorts first alphabetically. - Times of day, run ids and session/message ids still normalize away: the content hash stays stable within a day, and moves only when a recurring error recurs on a new day (which is exactly when the digest should be rewritten). - Ingester version bumps to `log-parser/v3`.
Author
Owner

Already in main: log-parser/v3, TestLogDigestKeepsDates, and the {text, first, last} signature rendering all landed with the #45 squash, so PR #40 had an empty diff against main.

Verified just now: go test ./internal/ingest -run 'LogDigest|LogContentHash' passes, including the day-range rendering. Closing the PR and this issue — no work remains.

(git log -S TestLogDigestKeepsDates attributes it to 00f277c, which is why the open PR looked mergeable on Gitea and empty locally.)

Already in `main`: `log-parser/v3`, `TestLogDigestKeepsDates`, and the `{text, first, last}` signature rendering all landed with the #45 squash, so PR #40 had an empty diff against main. Verified just now: `go test ./internal/ingest -run 'LogDigest|LogContentHash'` passes, including the day-range rendering. Closing the PR and this issue — no work remains. (`git log -S TestLogDigestKeepsDates` attributes it to 00f277c, which is why the open PR looked mergeable on Gitea and empty locally.)
david closed this issue 2026-11-09 00:27:15 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#39