Skip to content

facets: restore top-level + severity facets, empty-state row, more tests#401

Merged
tonyalaribe merged 2 commits into
masterfrom
facets-restore-and-tests
May 29, 2026
Merged

facets: restore top-level + severity facets, empty-state row, more tests#401
tonyalaribe merged 2 commits into
masterfrom
facets-restore-and-tests

Conversation

@tonyalaribe

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #399. Restores facets that got dropped in the consolidation, adds an empty-state row for facets with no observed values, and lays down three high-level tests that pin the renderer↔producer contract.

  • Top-level columns flow through the catalog. Added FCTopLevel field category; ProcessMessage.extractObservation now walks the span's flat columns (name, kind, level, status_code, status_message, severity.*) into the catalog. toFacetSummary emits these bare. level, name, kind, status_code are back in the Common Filters group; a new Severity group hosts severity.severity_text, severity.severity_number, status_message.
  • KQL fast-filter parity. severity.severity_text and severity.severity_number join flattenedOtelAttributes. A new topLevelOtelColumns set in Pkg.Parser.Expr carries the bare columns. prop_facetsAreFast accepts membership in either set.
  • Empty-state UX. Facets with no values in the current window render a muted "no values in window" row instead of being silently dropped. The round-13 section-level filter is reverted (groups always have at least one row now).
  • High-level tests.
    • Layer A: apiFacets handler — GET /api/v1/facets returns dotted keys only; no ___ keys leak.
    • Layer A: renderer — feed a synthetic FacetSummary into renderFacets, assert the HTML carries data-field="<dotted>" markers, group headers render, and the empty-state row appears for unpopulated facets.
    • Round-trip: extended the ingestion test to assert name, level, severity.severity_text show up post-flush via the new FCTopLevel path.
    • Pure: every facetDefs entry sits in flattenedOtelAttributestopLevelOtelColumns.

Test plan

  • cabal test doctests --test-option="--match=Pages.LogExplorer.Log" — passes (whitelist invariant intact)
  • USE_EXTERNAL_DB=true cabal test integration-tests --test-option="--match=/Facets/"9 / 9 examples pass
  • hlint clean on the touched files
  • Manual smoke: visit /p/<pid>/log_explorer, confirm Severity + Common Filter sections render, and empty facets show the muted "no values in window" row instead of disappearing.

🤖 Generated with Claude Code

tonyalaribe and others added 2 commits May 29, 2026 22:29
The previous PR dropped facets whose paths weren't in
flattenedOtelAttributes — that excluded both top-level columns
(level/name/kind/status_code/severity_*) and OTel paths the catalog
walker didn't observe.

This change:

- Adds FCTopLevel field category; ProcessMessage.extractObservation
  now also walks the row's top-level columns (name/kind/level/
  status_code/status_message/severity.*) into the catalog. toFacetSummary
  emits these bare (no attributes./resource. prefix).
- Adds severity.severity_text and severity.severity_number to
  flattenedOtelAttributes so KQL compiles them to flat-column
  scans on severity___severity_*.
- Adds topLevelOtelColumns Set in Pkg.Parser.Expr — bare columns
  that are fast-filter targets. prop_facetsAreFast accepts membership
  in either set.
- Restores the dropped facetDefs entries (level, name, kind,
  status_code, plus a Severity group with severity_text/_number/
  status_message). FacetGroup gains FGSeverity.
- renderFacets now shows a "no values in window" row for facets with
  no observed values (instead of dropping them silently). The
  round-13 section-level filter is reverted since groups now always
  have at least one row.
- Three new high-level tests in FacetsSpec:
  * Layer A: GET /api/v1/facets returns dotted keys only, no ___.
  * Layer A: renderFacets HTML contains data-field markers keyed by
    the canonical dotted path; empty-state row is present.
  * Doctest-style: every facet path is in the fast-filter sets.
  Plus an extension to the ingestion round-trip test that asserts
  name/level/severity.severity_text show up post-flush.
@tonyalaribe
tonyalaribe merged commit b54913c into master May 29, 2026
3 checks passed
@tonyalaribe
tonyalaribe deleted the facets-restore-and-tests branch May 29, 2026 21:18
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