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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Golden-frame regressions: the whole rendered screen, compared cell by cell.
//!
//! # Why a frame and not an assertion
//!
//! Three separate bugs shipped in one session — inline code rendered as a row
//! of disconnected boxes, a modal clipped mid-word at its border, a status band
//! advertising a keybinding that no longer existed — and every unit test passed
//! through all of them. They assert on `Line`/`Span` *values*, which cannot see
//! a shredded background, a glyph past column 78, or a sentence nobody reread.
//!
//! A golden frame is the missing detector: it captures what the terminal
//! actually painted, so any visual change has to be looked at and accepted by a
//! human before it lands.
//!
//! # How it stays deterministic
//!
//! Two problems have to be solved or the snapshots are useless.
//!
//! **Cells, not bytes.** Ratatui redraws only the cells that changed and jumps
//! over the rest with cursor moves, so the raw pty byte stream is not the
//! screen — a rendered `[Image #1] ` arrives split as `[Image` … `#1]`. The
//! bytes are fed to a real VT parser and the *grid* is snapshotted.
//!
//! **Volatile content is redacted, not banned.** A frame legitimately contains
//! a version, a sandbox path with a nanosecond timestamp, a hostname, and a
//! clock. [`normalize`] rewrites exactly those to placeholders. Everything else
//! is compared verbatim — the redaction list is deliberately short and explicit,
//! because each entry is a thing the snapshot can no longer catch.
//!
//! What is deliberately NOT snapshotted: the startup web-capability notice
//! (its text names the host triple and a healthy local setup suppresses it
//! entirely) and vertical blank padding (which moves with it). There is no
//! whole-startup-screen frame for the same reason — it would assert almost
//! nothing this project controls and a great deal it does not.
//!
//! Run with `UPDATE_SNAPSHOTS=1` to (re)write `tests/snapshots/*.txt`. Review
//! the diff like any other diff: an unexplained change is the bug.
use ;
use Duration;
/// Assistant markdown as the transcript actually paints it: multi-word inline
/// code, a wrapped bullet list, and a table.
///
/// This is the frame that would have caught the shredded-inline-code bug. The
/// transcript is seeded on disk and loaded with `--resume`, so no model is
/// called and the content is fixed forever.
/// The `/model` picker pane, filtered to no matches.
///
/// Which models exist is a property of the developer's machine — installed
/// Ollama models, provider keys — so a populated list can never be a stable
/// snapshot. Filtering to a string nothing matches makes the frame
/// deterministic while still pinning what actually broke historically: the
/// border, the title, the hint row, and the filter footer. That the picker
/// *does* list real models is asserted behaviorally in `pty_visual.rs`.
/// Every safety mode's footer, in one frame per mode. Plan is a cycle position
/// like the rest — the band that used to read
/// `plan mode on (alt+p to toggle) - restores: <mode>` is gone, and a golden
/// frame is what makes its return impossible to miss.