# 045 — Timeline/log ordering by params other than `ottyl_ts`, with drop/fallback toggle ## Summary Log lines are currently rendered in whatever order the backend returns them, which is ingest order (`sequence`, monotonically increasing per `src/ingest.rs`) surfaced via `webapp/src/components/LogPreview.tsx:258-261` (`log.sequence`/`log.timestamp_ms`). `webapp/src/components/LogTimeline.tsx` only draws pre-bucketed histogram bars from `fetchTimeline` (`webapp/src/lib/api.ts:257` → `GET /api/timeline`, `src/api.rs:249 get_timeline`) and has no per-line sort control at all. There is no way to order by a declared param, and no defined behavior for lines missing whatever param is chosen for ordering. ## Scope - Default ordering stays by `ottyl_ts` (see ticket 044 for the rename). - Add the ability to choose a different declared param as the sort key for the timeline/log list (backend: extend the timeline/log query path in `src/api.rs`/`src/engine.rs` to accept a sort-by param; frontend: expose the choice near the timeline/log controls, likely in `LogTimeline.tsx`/`LogPreview.tsx` or their shared settings). - Add an explicit toggle controlling how lines lacking the chosen sort param are handled: (a) fall back to ordering those lines by `ottyl_seq`, or (b) drop them from view entirely. Persist this toggle alongside other view settings. - Ensure the toggle and sort-by selection are scoped sensibly (e.g. per timeline/session) rather than silently global if that would surprise users switching between dashboards. ## Acceptance criteria - User can pick any declared param as the ordering key for the timeline/log view, in addition to the `ottyl_ts` default. - With the fallback toggle on, lines missing the sort param appear ordered by `ottyl_seq` relative to each other; with it off, those lines are excluded from the view — both verified with a seeded fixture mixing lines with and without the param. - Existing default (`ottyl_ts`-ordered) behavior is unchanged when no alternate sort param is selected. ## Depends on 044 (reserved param naming — this ticket's default sort key and fallback key should use the renamed `ottyl_ts`/`ottyl_seq`).