Repository navigation
Description
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:
- 30 commits on main touched it in the last 5 days.
- About ten open PRs from brett19 edit it (Typed errors (TE-B-07, part 2 of 3): the fillet corner p2/p3 failures become named causes, refusals or reviewed defects (#19816) #20714, Typed errors (TE-B-02): the fillet geometry's p2 stage failures become reviewed defects, named causes and refusals (#19810) #20722, Typed errors (TE-B-03): the fillet geometry's p4 stage failures become reviewed defects, named causes and refusals (#19811) #20723, Typed errors (TE-B-08, part 1 of 3): the ball, chamfer and mixed corners' failures become named causes, refusals or reviewed defects (#19817) #20725, Typed errors (TE-B-09, part 3 of 4): fillet solver p4 #20732, Typed errors (TE-B-11, part 1 of 3): the custom fillet solver's, fillet intersector's and law corners' phrase failures become named causes or reviewed defects (#19820) #20746, Typed errors (TE-B-09, part 4 of 4): fillet solver p5 #20759, Typed errors (TE-B-15, part 3 of 3): the kept features' and crease trims' failures become named causes, refusals or reviewed defects (#19825) #20762, solidcore: typed errors (TE-B-11 part 2 of 3): fillet_standard_solver/p1.rs phrase sites become named causes or reviewed defects #20807 and others). So do PRs from other authors: Blend failures: the exact fillet surfaces report named causes and reviewed defects, not phrases (#15034) #19681, Typed errors (TE-B-04): the fillet geometry's p5 and tangent end rib stage failures become reviewed defects, named causes and a refusal (#19812) #20500 and Typed errors (TE-B-16, part 1 of 2): the feature executive's, fillet identification's and hidden curve removal's phrase causes become named causes, reviewed defects and a refusal (#19826) #20742.
- Every merge into the file makes the rest of those PRs CONFLICTING. Today there were three re-merge waves, each over 8–12 PRs and about 45 minutes long.
- solidcore: adding a blend failure needs no index number or shared list entry #21051 and solidcore: each file's site count is its own pin file, so typed-error PRs stop conflicting #21054 already removed the shared index inventory and split the pins. The file itself is now the last shared append point.
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.
- 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 onepub useper item, so every public path (solidcore::error::SolverFailure,…::blend::CornerShape, …) stays the same. A new sub-enum is then a new file plus one sortedmodline and itspub uselines. - Every enum's variants are sorted by name. This covers
BlendFailure,SolverFailureand all 18 detail enums. - Every match on them has one arm per pattern, sorted by name. That is 24 matches in library code, the
SectionLimitmatch nested inDisplayincluded; a match with a_arm is left as it is.A | B => xbecomesA => xandB => x, which is the same match. - 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. - A test enforces the order. It is
the_causes_and_the_arms_of_their_matches_stay_sorted_by_nameand reads the sources withinclude_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
FilletSetUpsub-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.
BlendFailureandSolverFailurederiveDebug, Clone, Copy, PartialEq; the detail enums addEq. None derivesPartialOrd,Ord,Hashor serde. Nothing casts them withasor 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.
- No sorted match has a guard or a
-
Mechanical diff check. A script compares every enum and every match between main's
blend.rsand 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
modandpub uselines and the per-file imports; #[cfg(doc)] use super::BlendFailure;for intra-doc links;- seven private
whatfns madepub(super), because their callers stay inblend.rs; - the
#[allow(clippy::match_same_arms, reason = …)]attributes, ashlr.rshas; - the new test.
- the
-
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.
- every
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
solidcore: blend cause order test covers every module and nested match
Blend failures: causes and their arms sorted, detail enums in their o…
brett19 commentedon Nov 24, 2026
The plan above landed in #21122, merged on 2026-11-23. It linked this issue with "Part of", so the issue stayed open.
solidcore/crates/solidcore/src/error/blend/. There are 19 of them, more than the original 12, because later TE PRs added files the same way:set_up,input,keep,rib,trace,crease_trimandrational.the_causes_and_the_arms_of_their_matches_stay_sorted_by_namekeeps them that way on main.error/blend/corner.rsand is MERGEABLE.Closing as done.
Written by Claude Code (Anthropic) on behalf of @brett19.