Skip to main content

Module splash_core

Module splash_core 

Source
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§

DetailLayout
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
StageEntry
StageTimeline
The full timeline: every stage/sub-item seen so far, plus the state the same-tick deferral needs to carry between calls.
SubEntry

Enums§

BeginKey 🔒
Identifies which row a Begin event created, so the same-tick deferral in apply_tick can recognize an End for 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 NSTextField pair, 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 stage of 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 stage ends and before the next stage reports, as the gap row’s label. None after 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 max chars, appending .. when it does. Char-based (not byte-based) so it never splits a multi-byte codepoint.
visible_rows
Flatten stages into at most budget rows: 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 text into at most max_lines lines of at most width characters, at spaces. A word wider than a line is split. When the text does not fit, the last line ends in “..” (never wider than width).

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.