You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No panics in the library, in any build (audit, error channel, CI enforcement) #279
Decided (user, 2026-11-16): panics in the library are unacceptable in every build, debug included. This supersedes the earlier debug-panic-on-misuse pattern (duplicate keys, a table's wrong cell count, splitter ranges, unknown command ids, Ui::shell() outside a draw, and so on).
Approach:
Audit: inventory every panic site in library code (src/, crates/*/src; tests and xtask exempt): explicit (panic!, unwrap, expect, unreachable!, assert!, debug_assert!) and implicit (slice/array indexing, clamp on computed bounds, integer division and overflow, RefCell and Mutex borrows and poisoning, Option and Result unwraps in disguise). Classify each one:
(A) reachable from end-user input or data;
(B) API misuse by the app;
(C) an internal invariant.
The replacement for each class:
A: handle it (clamp safely, skip, or recover).
B: make it unrepresentable (typestate or types) where possible; otherwise report it through one library error channel and use a safe fallback.
C: restructure so the invariant holds by construction, or recover silently plus report.
One error channel: a single reporting path for misuse, decided once. For example: once per (context, site) to stderr or log, surfaced in the F12 debug overlay, and queryable in tests so they can assert on misuse without a panic.
Enforcement in cargo xtask ci: clippy lints over library code (clippy::panic, unwrap_used, expect_used, unreachable, indexing_slicing, panic_in_result_fn, plus a check for assert!/debug_assert!), allowed in tests.
Existing "debug panic" behaviour in merged and open PRs gets converted. Follow-ups are #278 (shell() still panics outside a draw) and the misuse checks across the library.
Policy for open PRs (2026-11-16): a PR must not add panic sites. Anything it introduces is converted before it merges. Patterns already on main are converted in this issue's sweep. In progress: #264, #268 (wordy-guy) and #271, #275, #267, #260 (blocky). #271's T1 cell-count debug panic becomes "drop extras, blank gaps, report".
Audit (main at 5fbc2c2, library code only; tests, examples, benches and xtask excluded)
Explicit sites (115):
A, reachable from data or input (4): duplicate or colliding keys from data (key.rs:274, :276), an overlay anchored to a vanished node (pipeline.rs:660), two focus_on_open (overlay_input.rs:650).
B, app misuse (21): command validation, an unknown command, a missing style entry, layout and key clashes, Wrap::Around on Grid, motion without shown, needs_identity, the drag-handle checks, Ui::shell() outside a draw, and others.
C, internal invariants (79): 49 taffy-tree .expects and 30 structural.
T, test support (11).
Implicit sites:
A (5):clamp with a reversed or NaN app range (number.rs:112, stepper.rs:385), the tooltip arrow clamp on a NaN rect (tooltip.rs:519), Duration overflow (transition.rs:88, tooltip.rs:387), and egui's own NaN debug asserts reachable through NaN layout.
C: about 205 index operations, all into per-frame vectors the library builds itself.
Nounwrap, todo, RefCell or NonZero; the Mutex locks already recover from poisoning.
Work packages
WP1, the error channel:src/report.rsProblem enum, report(ctx, problem, subject, msg) deduplicated per (problem, call site, subject), sent to log (eggshell::misuse warn, eggshell::internal error), shown in the F12 overlay, with testing::reports/assert_reported/assert_no_reports.
WP2, misuse checks (25): typestate where possible (PasteCommand, a Chord newtype, a Nav::Grid without Wrap, motion only after shown, drag_handle only on a drag source); otherwise report and fall back.
WP7, test support: exempt the deliberate test assertions, and make Placed::overlay and Timeline::frame return Option.
WP8, lints: a crate-level deny of panic, unwrap_used, expect_used, unreachable, indexing_slicing (as a ratchet with module-level #[expect]), string_slice and others, with clippy.toml disallowing assert!/debug_assert!, f32::clamp, panicking Duration constructors and Mutex::lock.
WP1: the error channel as designed (log targets eggshell::misuse/eggshell::internal, the F12 overlay list, and testing::reports/assert_reported/assert_no_reports).
Costly checks (duplicate-key detection, cross-layout key claims): debug builds only, report-only and never panic. Cheap checks run in every build.
WP7: the testing module's assertion helpers are exempt (explicit lint expect with a reason). Anything on the draw path stays panic-free.
WP6 decided (user, 2026-11-16): option B. ui.shell() is removed and ui.try_shell() -> Option<Shell> is the only form, keeping the context slot with #278's stack-restoring guard (it works inside egui's nested Ui scopes). NodeUi::node_id() and related accessors also become non-panicking. eggshell's own walk holds the shell directly instead of looking it up through Ui.
The three library crates now deny panic, unwrap, expect, unreachable, todo, unimplemented, indexing and string slicing, assert!/debug_assert!, clamp, the panicking Duration constructors and Mutex::lock, outside tests. A contributor exempts a site with #[expect(lint, reason = ..)] at the narrowest scope. Tag v0.1.0-m8.32.
Activity
samitbasu commentedon Nov 16, 2026
Policy for open PRs (2026-11-16): a PR must not add panic sites. Anything it introduces is converted before it merges. Patterns already on main are converted in this issue's sweep. In progress: #264, #268 (wordy-guy) and #271, #275, #267, #260 (blocky). #271's T1 cell-count debug panic becomes "drop extras, blank gaps, report".
samitbasu commentedon Nov 16, 2026
Audit (main at 5fbc2c2, library code only; tests, examples, benches and xtask excluded)
Explicit sites (115):
focus_on_open(overlay_input.rs:650).Wrap::Aroundon Grid, motion withoutshown,needs_identity, the drag-handle checks,Ui::shell()outside a draw, and others..expects and 30 structural.Implicit sites:
clampwith a reversed or NaN app range (number.rs:112, stepper.rs:385), the tooltip arrow clamp on a NaN rect (tooltip.rs:519),Durationoverflow (transition.rs:88, tooltip.rs:387), and egui's own NaN debug asserts reachable through NaN layout.No
unwrap,todo,RefCellorNonZero; the Mutex locks already recover from poisoning.Work packages
src/report.rsProblemenum,report(ctx, problem, subject, msg)deduplicated per (problem, call site, subject), sent tolog(eggshell::misusewarn,eggshell::internalerror), shown in the F12 overlay, withtesting::reports/assert_reported/assert_no_reports.PasteCommand, aChordnewtype, aNav::GridwithoutWrap, motion only aftershown,drag_handleonly on a drag source); otherwise report and fall back.LayoutTreewrapper whose accessors can't fail.Identifiednode variant, split root declarations, and aNodesarena replacing about 205 index operations.ValueRangenewtype, one NaN-total clamp helper, non-finite lengths rejected at the Tw boundary,try_from_secs.Placed::overlayandTimeline::framereturnOption.panic,unwrap_used,expect_used,unreachable,indexing_slicing(as a ratchet with module-level#[expect]),string_sliceand others, with clippy.toml disallowingassert!/debug_assert!,f32::clamp, panickingDurationconstructors andMutex::lock.samitbasu commentedon Nov 16, 2026
Decided (user, 2026-11-16):
logtargetseggshell::misuse/eggshell::internal, the F12 overlay list, andtesting::reports/assert_reported/assert_no_reports).testingmodule's assertion helpers are exempt (explicit lintexpectwith a reason). Anything on the draw path stays panic-free.samitbasu commentedon Nov 16, 2026
WP6 decided (user, 2026-11-16): option B.
ui.shell()is removed andui.try_shell() -> Option<Shell>is the only form, keeping the context slot with #278's stack-restoring guard (it works inside egui's nestedUiscopes).NodeUi::node_id()and related accessors also become non-panicking. eggshell's own walk holds the shell directly instead of looking it up throughUi.Rich text: no panics; on_link only on what spans adds (#279)
4 remaining items
Merge icons-128 (lucide SVG icons) into field-245
Markdown: no panics in the parser or the builder (#279)
Slider readout: bound a typed value with max/min, not clamp (#279)
Merge field-245 (lucide SVG icons, #279 fixes) into slider-130b
Merge origin/main into wp1-report (v0.1.0-m8.22)
Merge pull request #302 from samitbasu/wp5-numbers
Merge pull request #303 from samitbasu/wp7-testing
#279 WP2: Wrap on the linear navs; Markdown misuse; report hidden
Merge pull request #304 from samitbasu/wp2-misuse
Merge pull request #308 from samitbasu/wp6-shell
Merge pull request #309 from samitbasu/wp3-tree
Merge pull request #313 from samitbasu/wp4-structure
Merge pull request #319 from samitbasu/wp8-lints
samitbasu commentedon Nov 17, 2026
Complete (2026-11-17). All eight work packages have merged:
The three library crates now deny panic, unwrap, expect, unreachable, todo, unimplemented, indexing and string slicing, assert!/debug_assert!, clamp, the panicking Duration constructors and Mutex::lock, outside tests. A contributor exempts a site with
#[expect(lint, reason = ..)]at the narrowest scope. Tag v0.1.0-m8.32.