Skip to content

solidcore: split error/blend.rs so typed-errors PRs stop conflicting #21121

Done

Description

@brett19

Problem

solidcore/crates/solidcore/src/error/blend.rs is 3,885 lines long. It is the one file every typed-errors blend PR (#19799, the TE-B tickets) has to edit, and it now blocks those PRs from merging. Today's numbers:

Why every pair collides

To add a cause, a PR edits these places:

Edit Where it lands
The new variant The end of pub enum BlendFailure (79 variants) or pub enum SolverFailure (41).
One arm in each match comparison_status, class, replaces_upstream_status, Display, and SolverFailure's class, comparison_status and Display. Many existing arms are A | B | C => … groups, so a PR edits a shared group line or appends at the end.
A row in the module-doc tables The cause→class table and the status table.
Sometimes a new sub-enum Directly after the previous one (BandInput, LawCornerSearch, …).
A test At the end of the tests module.

Git conflicts when two branches insert at the same point. Every one of these edits lands at the same few points, so any two PRs collide, and they collide once per match.

What we are doing

This is a pure restructure, with no change in behaviour.

  1. Sub-enums move into their own files. The 12 groups that detail a cause move verbatim into private modules under error/blend/: band, cliff, corner, crossing, ease, law_corner, no_room, overflow, removal, section, solver, weld. They are re-exported with one pub use per item, so every public path (solidcore::error::SolverFailure, …::blend::CornerShape, …) stays the same. A new sub-enum is then a new file plus one sorted mod line and its pub use lines.
  2. Every enum's variants are sorted by name. This covers BlendFailure, SolverFailure and all 18 detail enums.
  3. Every match on them has one arm per pattern, sorted by name. That is 24 matches in library code, the SectionLimit match nested in Display included; a match with a _ arm is left as it is. A | B => x becomes A => x and B => x, which is the same match.
  4. The module-doc tables go. Their facts move into each variant's own doc. 14 variants did not yet state their class or status, and the tables themselves had gaps (CliffInputMissing, ClosedCliffWouldNotSplit). Each of those docs gains the one missing line.
  5. A test enforces the order. It is the_causes_and_the_arms_of_their_matches_stay_sorted_by_name and reads the sources with include_str!. It checks that every enum's variants and every such match's arms are in byte order, with no | groups. A PR that appends at the end fails the test locally and is told which pair is out of order.

The tests stay inline in blend.rs, in their current order. One of them asserts that Failure::origin() is in error/blend.rs, and open PRs already place new tests next to related ones rather than at the end.

What it buys, measured on today's open branches

I placed each open TE branch's new BlendFailure / SolverFailure variants into main's sorted lists.

  • Today: every pair of the 34 non-stacked pairs conflicts.
  • After the restructure: 18 of the 34 pairs touch disjoint lines.
  • Most of the rest are duplicates. The branches add the same causes independently, with different docs. That is 21 of their 76 new variants, plus the FilletSetUp sub-enum added separately in five branches.
  • Once those shared causes land first, in one small PR, 29 of the 34 pairs are disjoint.
  • The 5 pairs left have names that fall next to each other (Join* / KeptFeatureNotBuilt, Corner*, …). Each leaves a trivial "keep both, both sorted" conflict, not today's interleaved hunks in every match.

A layout cannot remove those last collisions. Anything that could would mean splitting BlendFailure by area, which changes public API and is out of scope.

Behaviour unchanged, and how that is checked

  • No derive depends on order. BlendFailure and SolverFailure derive Debug, Clone, Copy, PartialEq; the detail enums add Eq. None derives PartialOrd, Ord, Hash or serde. Nothing casts them with as or reads discriminants. So declaration order cannot change anything.

  • Reordered arms are equivalent.

    • No sorted match has a guard or a _ arm. The one match with _, SolidError::blend_failure, is left as it is.
    • Arms for different variants are disjoint.
    • Arms for the same variant keep their relative order. These are the nested WeldNotBuilt(WeldGap::…) Display arms, sorted with a stable sort.
  • Mechanical diff check. A script compares every enum and every match between main's blend.rs and the new files. Each enum's variants (code, docs excluded) must be the same multiset, and each match's normalised (pattern, body) pairs must be the same multiset. All 20 enums and 24 matches are identical.

  • Everything outside those bodies is unchanged. The only additions are:

    • the mod and pub use lines and the per-file imports;
    • #[cfg(doc)] use super::BlendFailure; for intra-doc links;
    • seven private what fns made pub(super), because their callers stay in blend.rs;
    • the #[allow(clippy::match_same_arms, reason = …)] attributes, as hlr.rs has;
    • the new test.
  • Only these docs change: the 14 added doc lines, the removed tables and the module-doc layout paragraph.

  • The tests pass unchanged. These pass with no test edited:

    • every error:: test;
    • the phrase pins (the_phrase_scan_lists_exactly_the_phrase_variants, phrase_sites, the_*_phrase_cause_sites_only_shrink);
    • the stage pin (the_unreviewed_stage_failure_sites_only_shrink);
    • the bare-status ratchet.

    The new files build no phrase or stage causes, so they need no pins.

Migration for open PRs

Each open PR that edits blend.rs conflicts with this change once. The re-apply is mechanical: the exact recipe is in the PR. I suggest landing it first, then the shared-causes PR (FilletSetUp, FilletSetUpInvalid, SolverEdgeUseMissing, FilletGeomWithout*, RailNotBSpline, MateFaceSurfaceNotBSpline, BaseSurfaceNotBSpline), so each TE PR is re-merged against both at once.

If you see a case this misses, or a better layout, please say so here. I'm going ahead with this one.

Written by Claude Code (Anthropic) on behalf of @brett19.

Activity

  1. added
    needs-triage
    on Nov 23, 2026
  2. brett19 commented on Nov 24, 2026

    @brett19
    CollaboratorAuthor

    The plan above landed in #21122, merged on 2026-11-23. It linked this issue with "Part of", so the issue stayed open.

    Closing as done.

    Written by Claude Code (Anthropic) on behalf of @brett19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions