summaryrefslogtreecommitdiff
path: root/docs/tui-flamegraph-behavior.md
blob: cc9bb5d9a84e5a540827e95891b9c4fff2196adf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# TUI Flamegraph Expected Behavior

This document records the expected interaction and layout behavior for the TUI
flamegraph. It is intended as a stable reference for regressions and for tests
under `internal/tui/flamegraph/` and `internal/tui/dashboard/`.

## Interaction

- `space` toggles pause. `p` does not pause the flamegraph and remains reserved
  for the global PID picker at the top-level TUI.
- `enter` and left-click zoom into the selected or clicked frame.
- Clicking an ancestor frame in the zoom lineage re-roots the view to that
  ancestor.
- `u`, `backspace`, and `esc` undo one zoom step.
- Direct clicks into a deep descendant create a single undo step back to the
  previous zoom root, not an implicit stack of every skipped ancestor.
- While paused, navigation and zoom must continue to work against the frozen
  snapshot.

## Layout

- The selected frame must not render with underline or a horizontal highlight
  line across the bar.
- The current zoom root must span the full flamegraph width.
- The children of the current zoom root must be normalized to the full viewport
  width, even when the zoom root has self time or exclusive weight.
- Zooming from any direction must produce the same full-width result for the
  newly selected zoom root.
- The zoom lineage rows shown above the zoomed subtree provide context, but they
  must not steal horizontal space from the zoomed subtree.

## Rendering

- Rendering the dashboard view must not mutate persistent flamegraph state.
- Redundant same-size viewport updates must be no-ops.
- In paused mode, repeated renders must not reintroduce stale frame geometry or
  leave artifacts from a previous layout on screen.

## Regression Coverage

These expectations are covered by tests in:

- `internal/tui/flamegraph/renderer_test.go`
- `internal/tui/flamegraph/model_test.go`
- `internal/tui/flamegraph/stress_test.go`
- `internal/tui/dashboard/model_test.go`