| Age | Commit message (Collapse) | Author |
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
(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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|