Repository navigation
#279 WP2: misuse becomes a compile error or a report with a fallback - #304
Merged
Merged
Conversation
No misuse check in the library panics any more, in any build. Where a type can say it, the misuse no longer compiles; where it is data the library cannot see until a frame, it is reported through the WP1 channel and the library recovers. Compile errors (typestate or types): - Command::paste returns a PasteCommand, the only kind with on_error. - A command's shortcut is a Chord, whose constructor refuses a bare Esc or Enter; made in a const, the reserved chord is a compile error. Problem::ReservedChord goes, since the table can no longer hold one. - OverlayChain gains a Motion state: shown() turns Static into Animated, and only an Animated chain has the motion setters. - NodeHandle gains a Kind: drag_source() returns a DragSource handle, the only kind with drag_handle. - An icon-only or empty button Face holds its accessible name. Report and fall back: - Unknown command id: the menu item (or button) is disabled; reported. - Classes that need an identity on an anonymous node are dropped; a group that senses nothing senses hover; group_hover without a group never shows. Each is reported. - A missing overlay anchor or boundary is reported; the overlay is still hidden and dismissed as before. - focus_on_open twice: the first marked node wins; reported. - Nav::Grid told to Wrap::Around stops; reported as UnsupportedNav (the typestate shape is left for a decision). - A misplaced drag handle is reported and the whole source lifts. - A button with an empty label and no name is reported. - A table row of the wrong cell count, or too many rows, is reported. - The Markdown parser collects what it recovered from and the widget reports it; report() is public for that. Breaking changes: Command::paste/on_error, Command::shortcut, Commands::add, Problem variants, OverlayChain and NodeHandle type parameters, Face::Icon/Face::Empty and From<Icon> for Face. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
Owner
Author
|
Decisions (user, 2026-11-17):
|
Review follow-ups on #304: - Nav::Menu, Nav::Submenu and Nav::Listbox carry their Wrap and Nav::Grid takes none, so a grid that wraps around cannot be written. OverlayChain::wrap, Wrap::of, Behavior::wrap and the grid's UnsupportedNav report path are gone. Each nav keeps its old default: menus, submenus and listboxes go round, the select stops. A virtual list takes Nav::Listbox(Wrap::Stop); Around there is reported as UnsupportedNav and the list stops. - Malformed Markdown is reported as a new Problem::MalformedMarkdown on eggshell::misuse, one report per kind, not as Problem::Internal: it is the author's data, not an eggshell bug. - report() is #[doc(hidden)] and not a stable API; it is pub only for eggshell-ui-extras. Breaking: Nav's Menu/Submenu/Listbox variants take a Wrap; OverlayChain loses wrap(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
Owner
Author
|
Gate (my run on 36803bd with current main): |
This was referenced Nov 17, 2026
samitbasu
added a commit
that referenced
this pull request
Nov 17, 2026
WP2 (#304) made a shortcut a `Chord` and built `Command` around a private `Binding`, with `PasteCommand` for the clipboard. The mount lifts whole command tables, so the new shapes need no change in its sink; the docs example and the mount tests take `Chord` for their shortcuts. Two new tests prove a paste command declared inside a mount gets the menu click (a read) and the chord (the event) through the lens, and hears a failed read there. Dropping the mount's table forwarding fails the chord test; the baseline passes. Part of #251 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LesfK54UWq1haPSEr9X22o
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #279
Fixes #283
No misuse check in the library panics any more, in any build. Where a type can express it, the misuse no longer compiles (each with a
compile_faildoctest beside a passing one). Where the problem is data the library only sees during a frame, it is reported through the WP1 channel (report/Problem) and the library recovers.Sites
Command::on_erroron a plain command (commands.rs)PasteCommandhason_errorReservedChordChord::newreturnsNonefor them; in aconstit is a compile error.shown(overlay_chain.rs)debug_assert!shown()turns aStaticchain into anAnimatedone, which alone has the settersdrag_handleon a node that is not a drag source (builder.rs)debug_assert!drag_source()returns aNodeHandle<…, DragSource>, which alone hasdrag_handledebug_assert!Face::IconandFace::Emptyhold the namedebug_assert!UnnamedUnknownCommand; the item is drawn disabled, labelled by the id; the button is added disabledneeds_identityon an anonymous node (Builder::node)debug_assert!NeedsIdentity; the identity-needing classes are dropped (group_hoveris kept)groupthat senses nothing (Builder::node)debug_assert!GroupSensesNothing(new); the group senses hovergroup_hoverwith no group above (draw.rs)debug_assert!GroupHoverWithoutGroup; the look never showsunreachable!MissingAnchorat the declaration; the overlay is hidden (Detached) and dismissed, as release builds already didfocus_on_opentwice in one overlay (overlay_input.rs)debug_assert!FocusOnOpenTwice; the first marked node takes focusNav::GridwithWrap::Around(overlay_chain.rs)debug_assert!Wrapis a payload of the linear navs only;Nav::Gridtakes none and.wrap()is gonedrag_handlekey not in the subtree, or naming a source (builder.rs)debug_assert!DragHandleat the call; the whole source liftsTODO(#279))TableShape(new); rows dropped / blanks kept / extra cell dropped, as beforeTODO(#279)×4)Parsed::malformed;Markdown::addreports each asMalformedMarkdown(new, oneggshell::misuse: it is the author's data, not an eggshell bug), one report per kind; the recovery is unchangedEvery converted
should_panictest is now a test that asserts the report and, where there is one, the fallback through the real path (kittest harness orHeadless).Breaking changes
Command::pastereturns aPasteCommand;on_errorlives only there.Commands::addtakesimpl Into<Command<A>>, so call sites are unchanged.A shortcut is a
Chord.Command::chord()still returnsOption<KeyboardShortcut>.Problem:ReservedChordremoved (unrepresentable now);GroupSensesNothing,Unnamed,TableShapeandMalformedMarkdownadded.OverlayChaingains a motion state (defaulted, so existing type names still compile).showncan be called once.NodeHandlegains a kind (defaulted). A trait implemented forNodeHandle<'_, 'f, A>now covers onlyAnyNode;eggshell-ui-shadcn'sDragChipwas made generic over the kind.Faceholds the name of a face without a label.Wrapmoves onto the linear navs;.wrap()is gone. Each nav keeps its old default: menus, submenus and listboxes went round unless told otherwise, the select stopped, a grid stops.The code snippets in
docs/overlays.md(lines 489, 502, 520, 534) are updated to the new form; the prose around them is not.A virtual list stops at its ends: it takes
Nav::Listbox(Wrap::Stop)(orNav::None);Nav::Listbox(Wrap::Around)there is reported asUnsupportedNav, as other navs already were, and the list stops. Giving the virtual list a nav type of its own would make that unrepresentable too; left for a decision.reportstays#[doc(hidden)]and is not a stable API: it ispubonly soeggshell-ui-extrascan report through the same channel (asBuilder::keyed_under).Behaviour changes
group_hover), transition andanimate_layoutare dropped.groupthat senses nothing now senses hover, so itsgroup_hoverchildren respond.Debug); before, release builds left the item out..named.eggshell::misuseas warnings.Left alone
pipeline.rsunreachable!on the base root), WP6 (Ui::shell()), WP7 (testingassertions), WP8 (lints).TODO(#279)indraw.rs(text with links and no id: an internal invariant, likely WP4'sIdentifiedvariant) and intesting.rs(PixelsPerPoint::newhas no context: WP7).Prose for the user
Not edited; these now describe behaviour that changed:
docs/dnd.md:11: a misplaced drag handle "panics in debug builds" (now reported, or a compile error for a non-source).docs/overlays.md:195: a missing boundary node is a debug panic (now reported).docs/overlays.md:215: a missing anchor on the opening frame is a debug panic (now reported).docs/overlays.md:703: motion methods withoutshownare a debug panic (now a compile error).docs/overlays.md:754: an unknown command id panics in a debug build (now a disabled, reported item).docs/overlays.md:680and:763:OverlayChain::wrapandWrap::of(nav), both gone; a grid withWrap::Aroundis now unrepresentable.src/builder.rs~126,Builderrustdoc: duplicate paths "panic" (WP1 made them a report).Navvariants,Wrap,focus_on_open,drag_handle,Menu::command,ButtonChain::command,Face, motion setters) minimally; reword as you like. New public items carryTODO(prose).Likely conflicts with #300
src/commands.rs(Command/Commands::add),src/builder.rs(commands(),NodeHandle),crates/eggshell-ui-extras/src/markdown/mod.rs(Markdown::add),src/lib.rsexports, and smaller hunks insrc/pipeline.rsandsrc/draw.rs.cargo xtask ci: exit 0.🤖 Generated with Claude Code