Skip to content

[TUI] Wiring tui traffic watch - #232

Merged
davixcky merged 35 commits into
traffic-tuifrom
wiring-tui-traffic-watch
Oct 27, 2025
Merged

davixcky merged 35 commits into
traffic-tuifrom
wiring-tui-traffic-watch

Conversation

@davixcky

Copy link
Copy Markdown
Contributor

This is a stack PR #226

@gitar-bot

gitar-bot Bot commented Oct 24, 2025 •

Copy link
Copy Markdown

Gitar analyzes/fixes CI failures, runs prompts as workflows and addresses comments starting with Gitar.

⚙️ Options:

  • Automatically accept changes

📝 Submit Feedback

Base automatically changed from add-skeleton-tui to traffic-tui October 24, 2025 12:11
tw.checkForNewContent()
case <-tw.resumeCh:
// Manual resume signal - check immediately
tw.checkForNewContent()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would lift the calls to checkForNewContent out of the select{} for better initial reactivity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here the call is to be able to resume or get new data if any of those channels trigger

@foxish

foxish commented Oct 24, 2025 •

Copy link
Copy Markdown
Member

Some issues I found:

  • There's no --tui if I recall what we had planned, it should be --inspect.

  • When I have the TUI up and hit the up/down key, it exits immediately, is this expected?

  • Panic found

    Panic

    signadot traffic record --sandbox dev-apisvr-foxish --tui
    Traffic will be written to /Users/anirudhramanathan/.signadot/traffic/watch-json.
    Waiting (up to --wait-timeout=30s) for sandbox to be ready...
    ✓ Sandbox status: Ready: All desired workloads are available.
    Caught panic:
    
    open /Users/anirudhramanathan/.signadot/traffic/watch-json/meta.jsons: no such file or directory
    
    Restoring terminal...
    
    goroutine 1 [running]:
    runtime/debug.Stack()
        /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/debug/stack.go:26 +0x64
    runtime/debug.PrintStack()
        /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/debug/stack.go:18 +0x1c
    github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0x14000446500, {0x102985520, 0x140000fe840})
          /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:847 +0xa0
    github.com/charmbracelet/bubbletea.(*Program).Run.func2()
        /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:638 +0xdc
    panic({0x102985520?, 0x140000fe840?})
        /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/panic.go:792 +0x124
    github.com/signadot/cli/internal/tui/views/trafficwatch.(*MainView).Init(0x14000173508)
        /Users/anirudhramanathan/Documents/cli/internal/tui/views/trafficwatch/main_view.go:127 +0x2c0
    github.com/charmbracelet/bubbletea.(*Program).Run(0x14000446500)
        /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:685 +0x68c
    github.com/signadot/cli/internal/tui.(*TrafficWatchTUI).Run(0x102d4e4c0?)
        /Users/anirudhramanathan/Documents/cli/internal/tui/traffic_watch.go:28 +0x60
    github.com/signadot/cli/internal/command/traffic.record(0x14000458b90, {0x0?, 0x0?}, {0x102d20d58, 0x1400011c028}, {0x102d20d58, 0x1400011c030}, {0x0?, 0x0?, 0x0?})
        /Users/anirudhramanathan/Documents/cli/internal/command/traffic/record.go:154 +0x674
    github.com/signadot/cli/internal/command/traffic.newRecord.func1(0x140000e4908, {0x14000624c90, 0x0, 0x3})
        /Users/anirudhramanathan/Documents/cli/internal/command/traffic/record.go:61 +0x84
    github.com/spf13/cobra.(*Command).execute(0x140000e4908, {0x14000624c30, 0x3, 0x3})
        /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0x854
    github.com/spf13/cobra.(*Command).ExecuteC(0x1400030a008)
        /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x378
    github.com/spf13/cobra.(*Command).Execute(0x1041b08f8?)
        /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:1041 +0x1c
    main.main()
        /Users/anirudhramanathan/Documents/cli/cmd/signadot/main.go:11 +0x20
    Error: program was killed: program experienced a panic
    
  • Panic Found:

    Panic maybe same as above:

    signadot traffic inspect -d=/Users/anirudhramanathan/.signadot/traffic/watch-json
    Directory /Users/anirudhramanathan/.signadot/traffic/watch-json contains valid traffic data
    Caught panic:
    
    open /Users/anirudhramanathan/.signadot/traffic/watch-json/meta.yamls: no such file or directory
    
    Restoring terminal...
    
    goroutine 1 [running]:
    runtime/debug.Stack()
       /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/debug/stack.go:26 +0x64
    runtime/debug.PrintStack()
       /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/debug/stack.go:18 +0x1c
    github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0x140003f7900, {0x1064fd520, 0x14000272930})
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:847 +0xa0
    github.com/charmbracelet/bubbletea.(*Program).Run.func2()
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:638 +0xdc
    panic({0x1064fd520?, 0x14000272930?})
       /Users/anirudhramanathan/.gvm/gos/go1.24.7/src/runtime/panic.go:792 +0x124
    github.com/signadot/cli/internal/tui/views/trafficwatch.(*MainView).Init(0x14000107508)
       /Users/anirudhramanathan/Documents/cli/internal/tui/views/trafficwatch/main_view.go:127 +0x2c0
    github.com/charmbracelet/bubbletea.(*Program).Run(0x140003f7900)
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:685 +0x68c
    github.com/signadot/cli/internal/tui.(*TrafficWatchTUI).Run(0x140004f7bb8?)
       /Users/anirudhramanathan/Documents/cli/internal/tui/traffic_watch.go:28 +0x60
    github.com/signadot/cli/internal/command/traffic.runTrafficWatchTUI({0x16ba4721c?, 0x1400010e028?})
       /Users/anirudhramanathan/Documents/cli/internal/command/traffic/inspect.go:110 +0x48
    github.com/signadot/cli/internal/command/traffic.inspectTraffic(0x1400050e440, {0x106898d58, 0x1400010e028}, {0x475c55baafcc27cd?, 0x140004f7b80?})
       /Users/anirudhramanathan/Documents/cli/internal/command/traffic/inspect.go:70 +0x278
    github.com/signadot/cli/internal/command/traffic.newInspect.func1(0x140006aac08, {0x14000060d90?, 0x4?, 0x105e0a951?})
       /Users/anirudhramanathan/Documents/cli/internal/command/traffic/inspect.go:32 +0x50
    github.com/spf13/cobra.(*Command).execute(0x140006aac08, {0x14000060d70, 0x1, 0x1})
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0x854
    github.com/spf13/cobra.(*Command).ExecuteC(0x14000302008)
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x378
    github.com/spf13/cobra.(*Command).Execute(0x107d288f8?)
       /Users/anirudhramanathan/.gvm/pkgsets/go1.24.7/global/pkg/mod/github.com/spf13/[email protected]/command.go:1041 +0x1c
    main.main()
       /Users/anirudhramanathan/Documents/cli/cmd/signadot/main.go:11 +0x20
    Error: error running traffic watch: program was killed: program experienced a panic
    
  • Ctrl+C no longer exits a record session correctly (when there is no TUI). Appears to happen sometimes but haven't been able to repro reliably.

  • JSON should be the default when output format is not specified, not YAML.

Comment thread cmd/tui/tui.go Resolved
@scott-cotton

Copy link
Copy Markdown
Member

@davixcky

Wiring overall looks reasonable to me.

There are some minor issues I see on presentation such as

  • command inspect help should describe what it does rather than only details about how it is done
  • the --tui flag should be --inspect.

I think the models directory needs an overhaul. I can take that in a stacked PR.

But overall this looks good to me to work on top of in terms of wiring and code layout. So, IMO, feel free to merge to the traffic-tui branch.

@davixcky
davixcky merged commit 026b5ca into traffic-tui Oct 27, 2025
@davixcky
davixcky deleted the wiring-tui-traffic-watch branch October 27, 2025 14:06
davixcky added a commit that referenced this pull request Oct 28, 2025
* add traffic inspect command (#225)

* add traffic inspect command

* add support for wait and reword messages

* fix pr comments

* Skeleton TUI (#226)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* [TUI] Wiring tui traffic watch (#232)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* remove model mock files

* add lipgloss dependency

* add simple watcher and use libconnect type:

* replace bufferred channel with non

* replace round with ceiling

* fix build

* load absolute meta, request and response

* rename symbol

* rename symbol

* pass record dir and meta format

* fix build

* fix yaml support

* add tui call from the inspect

* add tui flag in record

* make sure inspect look for json

* remove hardcoded path

* rename tui flag to inspect

* remove tui cmd

* remove models directory and move loader to utils (#234)

* use pointers for http.{Request,Response}

* make sure width is valid for logs

* disable logs temporarily

* add basic error handling for filemanager (#236)

* add basic error handling for filemanager

* make sure error message is displayed

* remove sprintf from status render

* pass pointer instead of copy on linemessages

* make union type for scanner
davixcky added a commit that referenced this pull request Oct 29, 2025
* add traffic inspect command (#225)

* add traffic inspect command

* add support for wait and reword messages

* fix pr comments

* Skeleton TUI (#226)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* [TUI] Wiring tui traffic watch (#232)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* remove model mock files

* add lipgloss dependency

* add simple watcher and use libconnect type:

* replace bufferred channel with non

* replace round with ceiling

* fix build

* load absolute meta, request and response

* rename symbol

* rename symbol

* pass record dir and meta format

* fix build

* fix yaml support

* add tui call from the inspect

* add tui flag in record

* make sure inspect look for json

* remove hardcoded path

* rename tui flag to inspect

* remove tui cmd

* remove models directory and move loader to utils (#234)

* use pointers for http.{Request,Response}

* make sure width is valid for logs

* disable logs temporarily

* add logs viewer

* fix regression and make sure logs render ok
davixcky added a commit that referenced this pull request Oct 29, 2025
* add traffic inspect command (#225)

* add traffic inspect command

* add support for wait and reword messages

* fix pr comments

* Skeleton TUI (#226)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* [TUI] Wiring tui traffic watch (#232)

* skeleton tui

* fix escape logs

* only update if have too

* make sure by default nothing is selected

* move between panes and tabs with arrow

* fix wrong re-render caused by map

* use utility for setting up status

* update mock to contain routing key

* fix help menu and clear status

* center empty states

* add viewport for right panel

* make sure right pane occupy more width

* add basic paginator for left pane

* make sure left pane scroll move between pages

* make short help aware of context

* remove model mock files

* add lipgloss dependency

* add simple watcher and use libconnect type:

* replace bufferred channel with non

* replace round with ceiling

* fix build

* load absolute meta, request and response

* rename symbol

* rename symbol

* pass record dir and meta format

* fix build

* fix yaml support

* add tui call from the inspect

* add tui flag in record

* make sure inspect look for json

* remove hardcoded path

* rename tui flag to inspect

* remove tui cmd

* remove models directory and move loader to utils (#234)

* use pointers for http.{Request,Response}

* make sure width is valid for logs

* disable logs temporarily

* add logs viewer

* fix regression and make sure logs render ok

* stay on logs on incoming

* clear logs logic and add some coloring

* add cosmetic visual for rendering

* make sure render properly

* constraint width for requests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants