Expand description
Shared startup-splash timeline logic: the row model, event application
with same-tick count-up deferral, a frozen-row finalizer, duration
formatting, and total/other reconciliation — used identically by all
three platform splash renderers (splash.rs Windows, splash_mac.rs
macOS, splash_linux/ Linux).
WHY THIS EXISTS NOW, NOT EARLIER. Before this module, each platform
reimplemented this exact logic from scratch — splash_mac.rs’s own doc
comment explained why at the time: “editing two already-working splashes
I cannot build or run to verify” was too risky for the PR that first
needed a macOS stage panel. The predictable result (see
docs/reports/REPORT_SPLASH_SCREEN_ARCHITECTURE_RETHINK_2026_09_14.md
§1): the same-tick count-up deferral fix landed only on macOS, the
frozen-row defect (a row whose End never arrives stays visually
“running” forever once the render loop stops redrawing on a timer) was
never fixed on ANY platform — including macOS, despite it having the
count-up fix — and total/other reconciliation existed only on macOS, as
a bare unreconciled "total:" line on Windows and not at all on Linux.
Three independent implementations meant every fix needed to land three
times, and in practice none of them ever did.
Platform-specific compositing (Win32 GDI blitting, Cocoa NSTextField
layout, X11/Wayland pixel buffers) stays in each platform’s own file —
only the pure logic (no FFI, no windowing, no Instant mocking needed)
lives here, which is also what makes it unit-testable without a live
window on any platform, including the two this was written on without
being able to run them.
Structs§
- Detail
Layout - How much room a renderer has for a finished row’s end detail: the characters one line holds, and the most lines one detail may take.
- Row
- Stage
Entry - Stage
Timeline - The full timeline: every stage/sub-item seen so far, plus the state the same-tick deferral needs to carry between calls.
- SubEntry
Enums§
- Begin
Key 🔒 - Identifies which row a
Beginevent created, so the same-tick deferral inapply_tickcan recognize anEndfor a row created in the very same batch. - RowKind
- What one rendered line stands for. Platform renderers match on this and
draw it their own way (GDI text, an
NSTextFieldpair, a formatted string) — the selection of what to draw is shared, which is the part that was wrong in three places independently.
Constants§
- GAP_
MIN_ MS - A gap shorter than this is dropped when the next stage begins: it would only add a row for time nobody waited on.
- GAP_
STAGE - The
stageof a row the timeline opens itself when a stage ends and the next has not begun, so a row is always running between show and dismiss and the time between stages is measured instead of frozen (the startup audit in agentmux PR #5218, freeze points F1 and F2). - STAGE_
LABEL_ MAX_ CHARS - The widest stage label the Windows and macOS splashes show whole; longer
ones are cut with “..”. Every stage and gap label must fit
(
every_stage_label_fits_the_splash). - SUB_
DETAIL_ MAX - How many of a stage’s sub-items are rendered individually. Anything older collapses into a single tally row.
Functions§
- detail_
rows 🔒 - The detail lines to show under a row that ended: only a warn or error outcome with a detail says anything the time column does not.
- gap_
label_ after - What runs after
stageends and before the next stage reports, as the gap row’s label.Noneafter the last stage: nothing follows it. - tally_
label - The label for a collapsed-sub-items row. Shared so all three platforms word it identically.
- trunc
- Truncates to
maxchars, appending..when it does. Char-based (not byte-based) so it never splits a multi-byte codepoint. - visible_
rows - Flatten
stagesinto at mostbudgetrows: summarize each stage’s older sub-items into a tally, then — if that still doesn’t fit — keep the newest rows rather than the oldest. - wrap_
detail - Break
textinto at mostmax_lineslines of at mostwidthcharacters, at spaces. A word wider than a line is split. When the text does not fit, the last line ends in “..” (never wider thanwidth).
Type Aliases§
- Outcome
- A completed sub-item or stage’s outcome: elapsed ms, status, and an optional short annotation carried over from the originating event.