summaryrefslogtreecommitdiff
path: root/internal/ior_mode_test.go
AgeCommit message (Collapse)Author
2026-05-20test(task-17): assert aggregate-only stats surfacing pathPaul Buetow
2026-05-19t6 stabilize family recording integrationPaul Buetow
2026-05-18t6 add syscall family dashboard aggregationPaul Buetow
2026-05-13test: replace time.Sleep with deterministic synchronization in unit testsPaul Buetow
Replace three time.Sleep usages in tests with channel-based and happens-before reasoning: - internal/ior_mode_test.go: waitForStreamRows no longer polls with time.Sleep(1ms); starter() only returns after the trace goroutine closes the started channel, which happens after all printCb pushes, forming a happens-before edge that guarantees the rows are visible. - internal/probemanager/manager_test.go: the intermediate attach-count assertions (enter==1, exit==0) are now checked immediately after <-enterBlocked, which is itself a happens-before edge, rather than after a 50ms sleep. The concurrent goroutine 2 is started afterwards; the final count assertions after both goroutines complete verify the serialization invariant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13enforce gofmt formatting and add Fmt/FmtCheck mage targetsPaul Buetow
Run gofmt -w on 9 files that had minor alignment/whitespace drift (pair.go, filter.go, ior_mode_registry.go, ior_mode_test.go, runtime.go, engine.go, dashboard/model.go, flamegraph/model.go, flamegraph/renderer.go). Add two new Mage targets to Magefile.go: - `mage fmt` – rewrites all .go files in-place via go/format - `mage fmtCheck` – dry-run check; fails with a list of offending files, suitable as a CI gate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13replace package-level test doubles in ior.go with constructor injection (DIP)Paul Buetow
Introduce runnerDeps struct to bundle all injectable function dependencies (getEUID, runTrace, runParquet, runTraceWithContext, runTUI*) that were previously package-level vars overridden in tests. The modeRegistry now carries a runnerDeps instance and passes it to each handler's run() method, eliminating global state mutation in tests. - Add runnerDeps struct and defaultRunnerDeps() constructor in ior_mode_registry.go - Convert modeRegistry from a []modeHandler slice type to a struct with handlers + deps fields; add newModeRegistry(deps) constructor - Update modeHandler.run() signature to accept runnerDeps; handlers call deps.getEUID / deps.runTrace etc. instead of globals - Update SetTUIRunners to write into defaultRegistry.deps instead of package-level vars - Add dispatchRunWithDeps helper for test isolation without global mutation - Remove root-privilege check from runTraceWithContext and runHeadlessParquet; each mode handler owns the EUID gate via deps.getEUID - Rewrite ior_mode_test.go: replace save/restore patterns with stubDeps() helper and dispatchRunWithDeps; add three new root-privilege tests replacing the removed TestRunTraceWithContextRequiresRoot Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12invert dependency: internal no longer imports internal/tuiPaul Buetow
Introduce internal/runtime as a neutral contract package that both the core engine (internal) and the TUI layer (internal/tui) depend on. - internal/runtime: defines TraceStarter, StreamSource, EventSink, LiveTrieSource, SnapshotSource, ProbeManager, RuntimePublisher, RuntimeState, TraceRuntimeBindings, and all context key/helper functions (RuntimeBindingsFromContext, RuntimePublisherFromContext, ContextWithRuntimeBindings, ContextWithTraceFilters, TraceFiltersFromContext). These were previously defined in internal/tui, forcing the core package to import the TUI layer. - internal/streamrow: add RingBuffer (moved from internal/tui/eventstream) so the core tracing engine can use the ring buffer without importing the TUI layer. - internal/tui/eventstream/ringbuffer.go: change to a thin re-export of streamrow.RingBuffer via a type alias, preserving the existing API for all callers within the TUI layer. - internal/tui/tui.go: replace locally-defined interface declarations (TraceStarter, SnapshotSource, ProbeManager, RuntimePublisher, RuntimeState, TraceRuntimeBindings) with type aliases from internal/runtime. Delegate all context helper functions to runtime. - internal/ior.go, internal/ior_bpfsetup.go: remove imports of internal/tui and internal/tui/eventstream; use internal/runtime and internal/streamrow instead. Add SetTUIRunners injection point so the concrete TUI runner functions are wired in by cmd/ior/main.go. - cmd/ior/main.go: call internal.SetTUIRunners with the concrete TUI runner functions before internal.Run, completing the wiring without creating a cycle. - Test files (internal/ior_mode_test.go, internal/bench_pipeline_test.go): updated to use runtime.* and streamrow.* types in place of tui.* and eventstream.* types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08swap global filter in place to skip BPF reattachPaul Buetow
Changing the global filter used to call stopTrace + beginTraceCmd, which detached and re-attached every tracepoint and re-loaded the BPF object. On heavily loaded I/O systems that took several seconds and showed an 'Attaching tracepoints...' overlay each time. The probe set never depends on the global filter (ShouldIAttachTracepoint only reads CLI regex flags), so the restart was gratuitous. Now the eventloop holds its filter behind atomic.Pointer with SetFilter / Filter accessors, and the trace starter registers el.SetFilter via the runtime bindings as a SetLiveFilterSetter callback. applyGlobalFilter and undoGlobalFilter call runtime.applyLiveFilter first; only if no trace is running do they fall back to the full restart path.
2026-05-07update docs and ascii bannerPaul Buetow
2026-03-13test: expand parquet recording coveragePaul Buetow
2026-03-13feat: add headless parquet recording modePaul Buetow
2026-03-12feat: persist parquet recording across TUI restartsPaul Buetow
2026-03-10task 434: unify trace filter plumbingPaul Buetow
2026-03-08task 368: filter live pairs before TUI ingestionPaul 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-06refactor: rename flags.Flags to flags.Config (task 383)Paul Buetow
2026-03-06refactor: thread runtime flags through ior and tui (task 385)Paul Buetow
2026-03-06refactor: remove web flamegrapher and keep TUI-onlyPaul Buetow
2026-03-06Add live flamegraph test modes and dynamic synthetic live feedPaul Buetow
2026-03-05Enable TUI-mode pprof artifacts and trace capturePaul Buetow
2026-03-03Add watch mode for dynamic flamegraph updatesPaul Buetow
2026-02-27internal: validate live CLI mode behaviorPaul Buetow
2026-02-27ior: route live mode through trace pipelinePaul Buetow
2026-02-26tui: add paused stream CSV export and foreground editor openPaul Buetow
2026-02-24tui: wire eventloop stats engine into dashboard snapshotsPaul Buetow
2026-02-24ior: route default mode through tui and add plain flagPaul Buetow