Skip to content

refactor: move Loki TUI from --watch to --report-only - #36

Merged
noexecstack merged 1 commit into
mainfrom
refactor/report-only-tui
Apr 8, 2026
Merged

refactor: move Loki TUI from --watch to --report-only#36
noexecstack merged 1 commit into
mainfrom
refactor/report-only-tui

Conversation

@noexecstack

Copy link
Copy Markdown
Owner

Summary

  • --watch + --from loki now errors with a message pointing to --report-only, since --watch implies live monitoring which only applies to hubble observe
  • --report-only launches an interactive TUI (browse, scroll, select flows for policy generation) when on a terminal; falls back to plain text otherwise
  • Fix Loki TUI black screen: the old --watch path re-parsed all flows on every refresh cycle, blocking the first frame render on large datasets; now parses once up front
  • Add --since/--until validation to catch inverted Loki time windows (e.g. --since 5m --until 1h)
  • Fix misleading docstring on _parse_flow_list that claimed flows must be pre-unwrapped
  • Bump version to 0.16.0

Test plan

  • All 144 existing tests pass
  • Verify --watch works as before (live hubble)
  • Verify --watch --from loki produces a clear error message
  • Verify --report-only shows interactive TUI on a terminal
  • Verify --report-only prints plain text in a non-TTY context (e.g. piped)
  • Verify --from loki --report-only fetches and displays flows correctly
  • Verify --since 5m --until 1h produces a validation error

--watch with --from loki was misleading: it fetched historical data once
then sat idle re-parsing the same static flows on every refresh cycle,
causing a black screen on large datasets. The "watch" name implies live
monitoring, which only applies to the hubble observe path.

Changes:
- --watch now errors when combined with --from loki, pointing users to
  --report-only instead
- --report-only launches an interactive TUI (browse, scroll, select
  flows for policy generation) when stderr is a terminal; falls back to
  plain text output otherwise
- The TUI parses flows once up front instead of re-parsing on every
  refresh, eliminating the blank-screen issue
- Add --since/--until validation to catch inverted Loki time windows
- Fix _parse_flow_list docstring that incorrectly stated flows must be
  pre-unwrapped (the code handles both wrapped and unwrapped)
@noexecstack
noexecstack merged commit f02d623 into main Apr 8, 2026
5 checks passed
@noexecstack
noexecstack deleted the refactor/report-only-tui branch April 8, 2026 18:34
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.

1 participant