From dbb98cd8dbd70dd92b8a541653e64c45b18348fa Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 18 Mar 2026 09:24:22 +0200 Subject: refactor: split TraceRuntimeBindings into RuntimePublisher and RuntimeState (task 427/ISP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TraceRuntimeBindings mixed 4 setter methods (injecting data into TUI) with 4 getter methods (reading persistent TUI-owned state), violating ISP. Split into two focused interfaces: - RuntimePublisher: SetDashboardSnapshotSource, SetEventStreamSource, SetLiveTrie, SetProbeManager — the write/inject side - RuntimeState: StreamBuffer, Recorder, StreamSequencer, FilterEpoch — the read/persistent-state side TraceRuntimeBindings now embeds both, preserving all existing call sites. RuntimePublisherFromContext() added so callers that only inject data do not see the getter surface. Three such callers are narrowed: setupBPFModule, tuiTestFlamesStarter, tuiTestLiveFlamesStarter. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- internal/ior_bpfsetup.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/ior_bpfsetup.go') diff --git a/internal/ior_bpfsetup.go b/internal/ior_bpfsetup.go index cf0b112..3500106 100644 --- a/internal/ior_bpfsetup.go +++ b/internal/ior_bpfsetup.go @@ -70,7 +70,9 @@ func setupBPFModule(parentCtx context.Context, cfg flags.Config) (*bpf.Module, * bpfModule.Close() return nil, nil, releaseBindings, setupBPFModuleError("attach probes", err) } - if bindings, ok := tui.RuntimeBindingsFromContext(parentCtx); ok { + // setupBPFModule only injects the probe manager; it does not read TUI state, + // so RuntimePublisher is the correct narrower interface to use here. + if bindings, ok := tui.RuntimePublisherFromContext(parentCtx); ok { bindings.SetProbeManager(mgr) releaseBindings = func() { bindings.SetProbeManager(nil) } } -- cgit v1.2.3