Skip to content

add traffic inspect command - #225

Merged
davixcky merged 3 commits into
traffic-tuifrom
add-inspect-command
Oct 22, 2025
Merged

davixcky merged 3 commits into
traffic-tuifrom
add-inspect-command

Conversation

@davixcky

Copy link
Copy Markdown
Contributor

No description provided.

@gitar-bot

gitar-bot Bot commented Oct 20, 2025

Copy link
Copy Markdown

Gitar automatically fixes CI failures and addresses comments starting with Gitar.

⚙️ Options:

  • Fix CI failures*

🔄 To revert changes, post a comment:

Gitar revert to commit <desired commit SHA>

📚 Docs

* Gitar never force pushes to your branch

@scott-cotton

Copy link
Copy Markdown
Member

Overall LGTM

I guess some question around -d defaulting. Probably we should have renamed the default dir
to HOME/.signadot/traffic. (drop the /watch).

For the dir checking, I'd suggest

  • if empty don't say it is invalid, but empty -- it might become valid later
  • provide an option --wait that allows a directory that is empty and waits

Comment thread internal/command/traffic/inspect.go Resolved
@davixcky

Copy link
Copy Markdown
Contributor Author

@scott-cotton @daniel-de-vera comments addressed

@daniel-de-vera

Copy link
Copy Markdown
Contributor

@davixcky, given that this feature is still under partial development, I would target the PR to a feature branch (e.g. traffic-tui) instead of main.

Comment thread internal/command/traffic/inspect.go Outdated
Comment on lines +23 to +30
This command validates that the specified directory contains valid traffic data
by checking for the presence of meta files (meta.json, meta.yaml, meta.jsons, or meta.yamls).
If the directory doesn't contain any of these meta files, it will return an error
indicating it's not a valid traffic directory.

When the --wait flag is used, the command will wait for the directory to contain
valid traffic data if it's initially empty, checking every second until meta files
are found.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think what we are expecting to be an input here is the --output-dir from signadot traffic record, right?

This description and the current implementation in:

for _, entry := range entries {
if entry.IsDir() {
continue
}
name := entry.Name()
if name == "meta.json" || name == "meta.yaml" ||
name == "meta.jsons" || name == "meta.yamls" {
return true, nil
}
}

seem a bit mixed up. For example, the logic currently accepts a directory as valid if it contains a meta.json file, which IMO, it shouldn’t be the case. Those meta.json files are expected to exist inside each request directory, not at the root.

I'm not suggesting we validate the contents of the discovered files (at least not at this stage), but the current logic feels confusing to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In other words, I would implement the check as:

 for _, entry := range entries { 
 	if entry.IsDir() { 
 		continue 
 	} 
 	name := entry.Name() 
 	if name == "meta.jsons" || name == "meta.yamls" { 
 		return true, nil 
 	} 
 } 

And change the description to something like:

Inspect traffic data from a directory containing recorded traffic.

This command validates that the specified directory contains traffic data
produced by a signadot traffic record session. If the directory does not 
contain valid data, the command returns an error.

When the --wait flag is provided, the command will wait until valid traffic data
becomes available in the specified directory.

@davixcky
davixcky changed the base branch from main to traffic-tui October 22, 2025 14:56
@davixcky

Copy link
Copy Markdown
Contributor Author

@daniel-de-vera thanks, also updated the branch target

@daniel-de-vera daniel-de-vera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@davixcky
davixcky merged commit f74b6be into traffic-tui Oct 22, 2025
@davixcky
davixcky deleted the add-inspect-command branch October 22, 2025 14:58
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