Conversation
…size Every table-backed view built its table.Model via newTable(nil) and only set real columns inside SetSize (called on the first tea.WindowSizeMsg). Each view's Init() fires an RPC call at the same time, and if that reply arrives first — which happens reliably whenever the broker already holds one stored item at startup — SetRows runs on a zero-column table and bubbles/table.renderRow panics, killing the TUI. Seed real columns at construction time instead of nil, so SetRows never sees zero columns regardless of ordering. Bump nvpair-tui 0.7.2 -> 0.7.3 (PATCH) and product/installer 0.91.7 -> 0.91.8 accordingly. Signed-off-by: habakan <kansukebano@gmail.com>
|
Hi, thank you so much for raising this. I've been working on a MASSIVE TUI overhaul over the last few weeks and actually already resolved this issue. I would love if when I bring that into the github here you can double check this for me to make sure it stays resolved! |
|
Thanks for folding this into the overhaul! I gave #117 ( On Happy to close this one, or now if you prefer. |
This is my first contribution to this repository, so please redirect me if this isn't the right approach.
Outcome
Fixes a reliable startup crash in
nvpair-tui. Every table-backed view (Errors,Nodes,Cluster,Manual,Workloads,Engines,Proxies) builds itstable.ModelvianewTable(nil)and only sets real columns insideSetSize, which the Bubble Tea runtime calls from the firsttea.WindowSizeMsg. Each view'sInit()fires an RPC call (errors:get-initial,nodes:get-initial, etc.) at the same time, and nothing orders that response against the firstWindowSizeMsg. When the RPC reply arrives first — which happens reliably whenever the broker already holds at least one stored item at startup (e.g. one prior service error) — the view'sset*()handler callstable.SetRowson a still-zero-column table, andbubbles/table.renderRowpanics withindex out of range [0] with length 0, killing the whole TUI.Fix: seed each table with real columns at construction time instead of
nil, soSetRowsnever sees zero columns regardless of message ordering.ui/errors.go: build viav.columns()instead ofnil(it already computes columns fromv.width, clamped for a zero width).ui/nodes.go,ui/cluster.go,ui/manualnodes.go,ui/workloads.go,ui/engines.go,ui/proxies.go: callv.SetSize(0, 0)right after construction, running the sameSetColumnseach view's ownSetSizealready performs on a real resize.Bumped
nvpair-tui0.7.2 -> 0.7.3 (PATCH: bug fix, no IPC/HTTP change) andproduct/installer0.91.7 -> 0.91.8 accordingly.In scope / out of scope
In scope: the seven
newTable(nil)sites innvpair-tui/ui. Out of scope: any broader change to how views are sized or how the broker reports errors.Validation environment
Linux x86_64, Go 1.25.0.
The cross-process suite has 7 pre-existing failures (
TestBrokerRestoresClusterIdentityAfterRestart,TestLogSetLevelViaRPC,TestLogLevelEnvFallback,TestWorkloadManagerInboundRelay,TestWorkloadOutOfOrderSuppressed,TestWorkloadFailedOnNodeLoss,TestWorkloadManagerOutboundBroadcast). I confirmed these reproduce identically onmainwithout this change, so they're unrelated to this fix.Manually reproduced the panic against the published 0.1.1
.deb(a real broker with a stored service error present crashes the stocknvpair-tuion every launch), then confirmed anvpair-tuibuilt with this patch starts cleanly against the same broker and on-disk state.Compatibility and security risk
None expected — this only changes when a table's columns are initialized, not any wire format, IPC contract, or stored data.
Documentation
No user-facing behavior changes beyond "it no longer crashes," so no docs changes.