summaryrefslogtreecommitdiff
path: root/internal/tui/tui_test.go
AgeCommit message (Collapse)Author
2026-05-26flamegraph: add LiveTrie height metric ingestion (task qo)Paul Buetow
2026-05-14wire TUIFastRefreshInterval into dashboard model and update testsPaul Buetow
Add fastRefreshMs parameter to NewModelWithConfig so callers can supply the high-frequency tick cadence for stream and flame tabs. Convert the streamTickCmd/flameTickCmd package-level functions to model methods that honour fastRefreshEvery (falling back to the 200 ms constants when zero for backward-compatibility). Add SetFastRefreshInterval setter so RunWithTraceStarterConfig can apply cfg.TUIFastRefreshInterval after construction. Update all 68 test call sites to pass fastRefreshMs=200 and add three new tests covering zero-fallback, stored value, and setter behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13keep View() pure by moving state transitions into Update() handlersPaul Buetow
The dashboard model's View() was mutating sub-model state on every render: it called streamModel.SetFooterVisible() and flameModel.SetViewport() on local copies instead of keeping those fields in sync through Update(). Moved the sync points to the Update() handlers that trigger each change: - handleWindowSize: syncs stream footer visibility alongside SetViewport - handleHelpToggleKey: already updated flame viewport; now also updates stream footer visibility when the help bar is toggled - handleKey: syncs flame viewport when switching to the flame tab, covering the case that window-resize and help-toggle do not Aligned the stream model's initial showFooter value with the dashboard's default showHelp=false in NewModelWithConfig so there is no mismatch on the first render. Also extracted numeric tab shortcuts into the tab registry via ShortcutKey fields so handleShortcutKey no longer needs updating when tabs are added. Updated two tests that bypassed Update() to set dimensions directly; they now use WindowSizeMsg so sub-model viewports are initialised correctly under the new pure-View contract. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13use errgroup instead of WaitGroup for concurrent snapshot buildersPaul Buetow
Replace sync.WaitGroup with errgroup.Group in buildSubSnapshots so errors from sub-builders (buildSyscallSnapshots, buildFileSnapshots, buildProcessSnapshots, buildHistogramSnapshot) are captured and propagated rather than silently dropped. Change Engine.Snapshot() to return (*Snapshot, error), update runtime.SnapshotSource and dashboard.SnapshotSource interfaces accordingly, and adjust all callers in tui.go, dashboard/model.go, and the test helpers. Each sub-builder now returns (result, error); the error return is currently always nil but establishes the contract for future validation. The per-type Snapshot() convenience methods (histogram, syscall, file, process) panic on error since they are internal helpers where failure would be a programming bug. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13fix: move context.Context to first parameter in startTraceCmd and ↵Paul Buetow
startTraceCmdWithTimeout Per Go convention, context.Context must always be the first parameter. Updated both function signatures and all call sites in tracelifecycle.go and tui_test.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13cap filterStack undo history to 50 levels to prevent unbounded growthPaul Buetow
Adds maxFilterHistory=50 and evicts the oldest entry from both the history and label-stack slices in filterStack.push whenever the cap is exceeded. Covers the fix with a new table-driven unit test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13fix: add 30s startup timeout to startTraceCmd to prevent indefinite hang on ↵Paul Buetow
BPF attach failure If kernel lock contention or another issue causes BPF probe attachment to stall, the TUI previously remained in the 'Attaching tracepoints...' spinner state forever. startTraceCmdWithTimeout now races the starter goroutine against a configurable deadline (defaultStartupTimeout = 30s) and returns a TracingErrorMsg with a clear message when the deadline expires. The stuck goroutine is cleaned up when the caller cancels the trace context on the next user action (e.g. traceLifecycle.stop). Two new tests cover the timeout and context-cancel paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12extract TUI Model god class into focused sub-controllersPaul Buetow
Split the 1389-line tui.go Model into three focused sub-controllers that each own a single concern: - filterstack.go (filterStack): owns the filter chain, undo history, and label stack; provides push/pop/rebindProcessFilters API so the Model never manipulates filter slices directly. - tracelifecycle.go (traceLifecycle): owns trace start/stop and the active context.CancelFunc; provides beginCmd/stop API; also houses the recorder helpers (recorderStart/Stop/Active/Status) and the auto-reset cycle logic (nextAutoResetInterval, autoResetCycle). - screenrouter.go (screenRouter): owns the picker-return bookmark (pickerReturn) and the applyWindowSizeToPicker helper so screen transition code in tui.go delegates to it. The Model.Update switch is split into dispatchTypedMsg (framework messages) and dispatchAppMsg (app messages) to keep each helper under the 50-line limit. View is split into viewPickerScreen and viewDashboardScreen for the same reason. All functions are ≤50 lines. go test ./internal/tui/... passes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09refine auto-reset timer cycle and pause on blurPaul Buetow
Two follow-up refinements to the auto-reset timer added in 8da473a. - Hotkey cycle now goes off -> 10s -> 30s -> 60s -> 2m -> 5m -> off, giving the user finer control between 60s and 5m and a quicker starting cadence. - The timer now pauses while the TUI is blurred. SetFocused returns a tea.Cmd that re-arms a fresh tick on focus regain, and bumps the generation counter on every focus change so any tick scheduled before blur is dropped on arrival. autoResetTickCmd and handleAutoResetTick also gate on m.focused as defense in depth. - Dashboard chrome shows 'auto-reset: 30s (paused)' while the timer is enabled but blurred, distinguishing it from the disabled 'off' state. Tests cover the full preset cycle (including custom-value passthrough) and the pause-on-blur lifecycle: stale ticks ignored, current-gen ticks ignored while blurred, focus regain re-arms and fires the reset, no-op focus calls don't churn the generation counter, and the chrome label flips to '(paused)' as expected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-03-18refactor: extract keyboardState, filterState, processState sub-structs from ↵Paul Buetow
tui.Model (task 429) tui.Model had 33 fields mixing keyboard tracking, filter chain, process selection, and UI presentation concerns (SRP violation). Extract three focused sub-structs: - keyboardState (kb): enhancements, lastEvent{ID,At,WasPress}, suppress{ID,Until} — 7 fields managed by keys_normalize.go - filterState (filter): global filter, history slice, label stack — 3 fields for the trace filter chain - processState (proc): pid, tid, pickerReturn — 3 fields for PID/TID selection and picker navigation Model drops from 33 to 23 top-level fields. All field accesses in tui.go, keys_normalize.go, and tui_test.go are updated accordingly. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-18refactor: pass flags.Config explicitly, remove flags.Get() from library code ↵Paul Buetow
(task 429) flags.Get() (global mutable singleton) was called inside library packages, coupling them to global state and making tests fragile (DIP violation). - internal.Run() now takes an explicit flags.Config; main.go calls flags.Get() once at the CLI boundary and passes it in. - tui.Run(), RunWithTraceStarter(), RunTestFlamesWithTraceStarter() removed; callers already used the WithConfig variants directly. - tui.NewModel() preserved for test ergonomics but now uses flags.NewFlags() (pure defaults) instead of flags.Get() (global state). - Tests updated to use NewModelWithConfig() with explicit config structs instead of flags.Set*() + NewModel(), eliminating all test-level global-state mutation. flags.Get() is now called only in cmd/ior/main.go, the correct boundary. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-13test: expand parquet recording coveragePaul Buetow
2026-03-13feat: add tui parquet recording controlsPaul Buetow
2026-03-12feat: persist parquet recording across TUI restartsPaul Buetow
2026-03-10tui: hide stream buffer behind source interface (task 428)Paul Buetow
2026-03-09tui: export filtered stream rows from global CSV action (task 364)Paul Buetow
2026-03-08tui: reserve p for pid pickerPaul Buetow
2026-03-08tui: add process-tab enter filter pushPaul Buetow
2026-03-08tui: restore global filter stack and anchored matchesPaul Buetow
2026-03-08task 378: test aggregate filter restart behaviorPaul Buetow
2026-03-08task 373: preserve stream history across filter restartPaul Buetow
2026-03-08task 372: restart tracing when filters changePaul Buetow
2026-03-08task 371: wire global filter modal into top-level TUIPaul Buetow
2026-03-08task 367: carry full trace filters through TUI contextPaul Buetow
2026-03-08tests: remove sleep-based waits in tui and runtime testsPaul Buetow
2026-03-06fix(tui): restore bubble modes and stabilize flame zoom lineagePaul Buetow
2026-03-06feat(tui): add flamegraph click lineage undo and scope quit keyPaul Buetow
2026-03-06fix(tui): close help overlay on q instead of quittingPaul Buetow
2026-03-06feat(tui): add dashboard bubble viz and expand help shortcutsPaul Buetow
2026-03-06refactor: thread runtime flags through ior and tui (task 385)Paul Buetow
2026-03-06feat(tui): add flamegraph bytes metric togglePaul Buetow
2026-03-06tui: add full-screen help overlay with H and esc closePaul Buetow
2026-03-06Fix real live flamegraph key handling and startup viewport syncPaul Buetow
2026-03-06Add live flamegraph test modes and dynamic synthetic live feedPaul Buetow
2026-03-05Normalize Go import grouping with local ior sectionPaul Buetow
2026-03-05Make flame tab default and fix flame hotkey routingPaul Buetow
2026-03-05task 352: wire LiveTrie into TUI runtime bindingsPaul Buetow
2026-03-05task 350: add TabFlame tab infrastructurePaul Buetow
2026-03-05fix(tui): stabilize full-width layout and sparkline renderingPaul Buetow
2026-03-05feat(tui): set contextual window titlePaul Buetow
2026-03-05feat(tui): handle keyboard enhancement capabilitiesPaul Buetow
2026-03-05feat(tui): pause dashboard refresh on terminal blurPaul Buetow
2026-03-05feat(tui): migrate Bubble Tea stack to charm.land v2Paul Buetow
2026-03-02Replace TUI service-locator globals with runtime bindingsPaul Buetow
2026-03-01Thread runtime config instead of global flags readsPaul Buetow
2026-02-26tui: clarify export help and toggle help bar with uppercase HPaul Buetow
2026-02-26tui: revamp status keys and add pid/tid reselection flowPaul Buetow
2026-02-26tui: add shortcut to reselect pid and restart tracingPaul Buetow
2026-02-26tui: fix and widen help overlayPaul Buetow
2026-02-25Fix stream paused scrolling and apply pending TUI/probe updatesPaul Buetow