Files
ottyl/tickets/072-log-preview-format-column.md
T

45 lines
1.9 KiB
Markdown

# 072 — Log Preview needs a format column (`ottyl_fmt`)
## Summary
Wishlist feedback: "Log preview needs format column." `ottyl_fmt`
(json/logfmt/none, `crate::logfmt::detect_format`) already exists as a
reserved, filterable pseudo-param (`OTTYL_RESERVED_PARAM_NAMES`,
`src/engine.rs:1960`; filter-bar support via
`compile_ottyl_fmt_comparison`, `src/engine.rs:1067`) — you can already
filter `ottyl_fmt==json` in the search bar. But it isn't surfaced as a
visible column in the Log Preview table
(`webapp/src/components/LogPreview.tsx`), and it can't be, because
`LogEntryDto` (`src/dto.rs:10-16`) doesn't include it: `params` only
holds declared `ParamDeclaration` matches, and format detection is
computed line-locally elsewhere, never attached to the returned log
entry.
## Scope
- Add the per-line detected format to `LogEntryDto` (`src/dto.rs:10`),
populated wherever log entries are assembled for the `Logs` query
response in `engine.rs` (reuse `crate::logfmt::detect_format`, the
same detection `ottyl_fmt` filtering already calls).
- Add `ottyl_fmt` as a column option in Log Preview's `ColumnPicker`
(`webapp/src/components/LogPreview.tsx:28-56`) alongside declared
params — it's a reserved pseudo-param like `ottyl_seq`/`ottyl_ts`, so
treat it the way the params list already flags `reserved`
(`dto.rs:38`, `ParamDeclarationDto.reserved`) rather than requiring
it be "declared" to show up as a pickable column.
- Render the column value as the short format label (`json`/`logfmt`/
`none`) matching what `ottyl_fmt` filter comparisons already produce.
## Acceptance criteria
- A "Format" (or `ottyl_fmt`) column is available in the Log Preview's
column picker and, once toggled on, shows the correct detected format
per row — json lines show `json`, logfmt lines show `logfmt`, neither
shows `none`.
- No change to filter-bar `ottyl_fmt` comparison behavior (still works
as before).
## Depends on
None.