Skip to content

Typed errors (TE-B-11, part 3 of 3): the standard fillet solver's p2 phrase failures become named causes or reviewed defects (#19820) - #21265

Merged
bherbruck merged 3 commits into
tangency-labs:mainfrom
brett19:te-b11-p3
Nov 23, 2026

Conversation

@brett19

@brett19 brett19 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Part of #19820 (TE-B-11 of the typed-errors index #19799, programme #13790), part 3 of 3. Parts 1 (#20746) and 2 (#20807) are merged.

This part converts the 28 counted phrase-cause sites in solidcore/crates/solidcore/src/blend/fillet_standard_solver/p2.rs. Each was read and handled under section 6 of solidcore/docs/failure-codes-and-reproduction.md, and the file's pin src/error/pins/phrase/solidcore/src/blend/fillet_standard_solver/p2.rs.pin (28) is deleted. A site becomes one of:

  • a cause the fillet solver already names in BlendFailure::Solver(SolverFailure): JacobianNotLoaded, NoSingleCurveFoot, OffsetNormalVanishes, OffsetNormalsParallel, FilletGeomWithoutRail and RailEdgeUseCount. One new variant is added: IntersectionPointBeforeCurve { parameter }.
  • a cause in BlendFailure::Trace(TraceFailure): BaseDerivativeZero and NoSingleSurfaceFoot, as in part 2. One new variant is added: JointWeightNotPositive { joined, piece }.
  • a missing link a caller hands in, named in BlendFailure::FilletSetUpInvalid(FilletSetUp): the existing SolverExecutive, plus two new variants, ReferenceCurve and SolverOriginalCurve. All three are InvalidInput, status SM_ERR_NULL_POINTER.
  • a BlendFailure::Defect with a why, or
  • deleted as unreachable (rule 11).

Every site keeps its status. No result changes: every converted site returns an error on exactly the same condition as before.

Before any variant was added, it was checked against main and the open blend TE PRs (#20759, #20443, #21264, #20475, #20500, #21263, #21266, #20742); none adds one with the same meaning. New variants are in sorted position in every enum and match.

The ticket's three error::ignored control-flow sites (p2.rs 1538, 1588, 1672) are left alone, as the ticket asks.

Per-site outcomes

Lines are main's (a5b69d1).

p2.rs line Old phrase Outcome Class / status Evidence
218 a stage the solver calls failed (as_sm_err) SolverFailure::JacobianNotLoaded, .caused_by(e) Failed / SM_ERR rule 5/6: the wrapper's only caller (953) maps load_jacobian's error. It now passes the cause through, as fillet_solver/p1.rs's as_sm_err does. The pass-through arms are unchanged.
621 + 631 does not drop onto the other edge once NoSingleCurveFoot { count } NotFound / SM_ERR the same single-solution curve drop as part 2's p1.rs 1559. Merged into let [sol] = ..; the second check was unreachable (rule 11).
680, 683 the second surface has no u / v derivative Defect (FIRST_PARTIALS, part 2's constant, now pub(super)) StageFailed / SM_ERR Surface::evaluate(uv, 1, 1) returns the first partials (same reading as part 2's 1640/1645)
712 + 718 does not drop onto the other rail's surface once NoSingleSurfaceFoot { count } NotFound / SM_ERR as part 2's 1657; merged into let [s] = ..
753 the same phrase, inside if sols.len() == 1 deleted (rule 11) — repeats the check that just passed; now if let [s] = ..
1255 the offset surface normal is zero OffsetNormalVanishes { side: rail, u, v } Degenerate / SM_ERR the variant's text is this condition: both the partials' cross product and the evaluated normal vanish
1734 blend_missing: the reference curve FilletSetUpInvalid(FilletSetUp::ReferenceCurve) (new) InvalidInput / SM_ERR_NULL_POINTER re_calc_fillet_geom is pub, and ref_curve: Option<&Curve> is the caller's argument (rule 2/9)
1761 blend_missing: the fillet geometry's rail SolverFailure::FilletGeomWithoutRail { fillet_geom, side } InvalidInput / SM_ERR_NULL_POINTER TE-B ruling's canonical shape; pseudo: &mut FilletBrep is the caller's
1764 the rail does not have two edge uses SolverFailure::RailEdgeUseCount { fillet_geom, side, count } InvalidInput / SM_ERR the caller's pseudo-B-rep, as RailEdgeUseCount's other sites
1799 + 1807 does not drop onto the reference curve once NoSingleCurveFoot { count } NotFound / SM_ERR merged into let [solution] = ..; the second check was unreachable
1870 blend_missing: the solver's original curve FilletSetUpInvalid(FilletSetUp::SolverOriginalCurve) (new) InvalidInput / SM_ERR_NULL_POINTER CurveBasedFs::original is a pub field, with the pub setter set_original_curve(Option<Curve>)
1903 an intersection point has a negative curve parameter SolverFailure::IntersectionPointBeforeCurve { parameter } (new) OutsideDomain / SM_ERR the traced point lies before the start of the curve; the cause carries its parameter
1993 an offset surface has a zero derivative TraceFailure::BaseDerivativeZero Degenerate / SM_ERR the same check on the offset surfaces' partials as part 2's p1.rs 915 (rule 12); the variant's doc and text are widened to cover both solvers
2128 the point solve has fewer solutions than it counted deleted (rule 11) — inside if sols.len() == 2; now if let [sol0, sol1] = .., with the same reads in the same order
2157 + 2165 the point does not drop onto the solver's curve once NoSingleCurveFoot { count } NotFound / SM_ERR merged into let [sol] = ..
2248 does not drop onto the second surface once, inside if sols.len() == 1 deleted (rule 11) — now if let [s] = ..
2667 a weight at the joint's ends is not positive TraceFailure::JointWeightNotPositive { joined, piece } (new) Unsupported / SM_ERR a weight test on geometry, like ZoneWeightNotPositive and the corner's FaceWeightNotPositive (both Unsupported); it carries both weights
2771 a piece's definition is not a procedural blend Defect (PIECE_IS_PROCEDURAL_BLEND) StageFailed / SM_ERR see the Defect table
2809 the law corner has no pieces Defect (PIECES_JOINED) StageFailed / SM_ERR see the Defect table
3031 the law curve's knots and multiplicities differ in number Defect (KNOT_MULTIPLICITIES) StageFailed / SM_ERR see the Defect table
3045 the law curve lacks a control point deleted (rule 11) — kk was i or lc - 1 - i for i < lc = control_points.len(), so the lookup always succeeded. The loop now walks the enumerated control points, reversed where db is not positive: the same order and the same weights.
3836 blend_missing: the executive's pseudo-B-rep FilletSetUpInvalid(FilletSetUp::SolverExecutive) InvalidInput / SM_ERR_NULL_POINTER calc_fillet_geom is the pub entry point for a solver outside an executive (its doc says so); the existing variant names exactly this
3878 the offset normals at the guesses are parallel SolverFailure::OffsetNormalsParallel Degenerate / SM_ERR the same condition as the variant's existing site (fillet_solver/p4.rs). Its doc and text are widened from "at the tangent intersection point" to "where the curve is to start", which covers both sites.

Count: 28 counted sites. 20 are converted and 8 are deleted as unreachable: 631, 718, 1807 and 2165 are folded into their let [..] patterns, and 753, 2128, 2248 and 3045 are removed. None is left.

Defect table

Every Defect added in p2.rs. For each one, the pub entry points were traced to check whether a caller can build the state that reaches it.

Site Why no caller can reach it Pub entry points checked
680, 683 (FIRST_PARTIALS) Surface::evaluate(uv, 1, 1) returns the first partials; a shorter matrix would be an evaluator fault. This is part 2's reading for the same lines in p1.rs. ConstantRadiusFs's load_initial_values (through constant_radius_load_initial_values)
2771 (PIECE_IS_PROCEDURAL_BLEND) defined comes only from the private piece_definitions. That function pushes only the Some results of definition_surface, which returns GnSectionFsg::build_given_ball's Some, always Surface::from(ProceduralBlend::create(..)) (fillet_section/section.rs 1957). CircularCrossSectionFsg::piecewise_surface, definition_surface
2809 (PIECES_JOINED) ends is [rail1 start, corners.., rail1 end], so it has at least two entries and at least one window. Each window either returns an error or sets joined. piecewise_surface (caller's curves and corners)
3031 (KNOT_MULTIPLICITIES) law_curve.canonical() takes its knots and multiplicities from one BSplineCurve::knots(None) call, which returns them as pairs. law_in_parameter (caller's LawBall)

Testing

Run on the main box:

  • cargo fmt --check;
  • core clippy (-D warnings) and SolidCraft clippy;
  • check_panic_sites.py;
  • the wasm check;
  • the error:: and blend::fillet_standard_solver lib tests;
  • goldens --test fuzz_corpus.

Results on head feb38dd: fmt, core clippy, SolidCraft clippy, panic sites and both wasm checks all pass.

  • Lib tests (error::, including the pins, and blend::fillet_standard_solver): 184 passed.
  • fuzz_corpus: 1 passed.

No fuzz-corpus or goldens file quotes a removed phrase, the old OffsetNormalsParallel text or the old BaseDerivativeZero text, so no rows were re-recorded.

Review: one independent adversarial review. It found no blocking issues and three it asked to fix, all fixed in feb38dd:

  • BaseDerivativeZero's doc and text are widened so they cover the standard solvers' offset surfaces as well (p1.rs 915/1257 and p2.rs 1993 raise it);
  • IntersectionPointBeforeCurve's doc now says why it is a refusal;
  • two tests now reach converted sites directly: scale_to_joint with a zero joint weight, and a reversed rational law through law_in_parameter, which locks in the rewritten loop.

Test change: three assertions in p2::tests named the old phrase errors and now name the typed causes for the same conditions:

  • the parallel guesses → SolverFailure::OffsetNormalsParallel, still SM_ERR;
  • the missing executive → FilletSetUp::SolverExecutive, still SM_ERR_NULL_POINTER;
  • the missing reference curve → FilletSetUp::ReferenceCurve, still SM_ERR_NULL_POINTER.

Each keeps its inputs and still asserts an error. Four tests are added:

  • a_failed_jacobian_load_keeps_its_cause: the wrapper's chained cause;
  • p2_causes_keep_their_status_and_class: every cause used here, with its class and status, and the defect whys;
  • a_joint_weight_that_is_not_positive_is_named;
  • a_reversed_rational_law_reverses_its_points_and_weights.

Changes a default: no

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved blend and fillet error messages for missing curve references, solver failures, out-of-range intersection points, and unsupported surface or weight conditions.
    • Corrected handling of reversed rational laws so their control points and weights stay aligned.
    • Added clearer reporting when a solve produces no result or multiple results.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The standard fillet solver now reports structured failures for several setup, tracing, and solve conditions. It also handles result counts more explicitly and reverses rational-law control points and weights together. New and updated tests cover these changes.

Changes: Standard Fillet Solver

Layer / File(s) Summary
Structured failure definitions
solidcore/crates/solidcore/src/error/blend/set_up.rs, solidcore/crates/solidcore/src/error/blend/solver.rs, solidcore/crates/solidcore/src/error/blend/trace.rs
Setup and tracing failure enums gain variants. Solver failures gain a variant for points before a curve. Related classifications and diagnostic messages are updated.
Solver failure handling and law reversal
solidcore/crates/solidcore/src/blend/fillet_standard_solver/p1.rs, solidcore/crates/solidcore/src/blend/fillet_standard_solver/p2.rs
The solver uses structured failures at several setup, tracing, and solve sites. Curve and surface result handling checks result counts. Reversed parameter mapping traverses control points and weights in reverse order.
Solver validation
solidcore/crates/solidcore/src/blend/fillet_standard_solver/p2.rs, solidcore/crates/solidcore/src/error/pins/phrase/solidcore/src/blend/fillet_standard_solver/p2.rs.pin
Tests check failure classifications, retained error causes, joint-weight handling, and reversed rational laws. A pin file is deleted.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: Minimal · up to feb38

This change gives the standard fillet solver more specific, structured failure reporting without changing when errors occur. It also reverses rational-law control points and weights together, and adds tests for both. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names a typed-errors refactor of the standard fillet solver's p2 phrase failures, which matches the changeset's main purpose. It is long (133 characters, 21 words) and includes a ticket refe…
Description check Passed The description follows the repository template closely. It has a Change section that explains the work, with the problem and resulting behavior (each phrase failure becomes a named cause, reviewed de…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Existing Defaults Unchanged Passed The check covers UX defaults only: default settings or preferences, command behaviour in normal use, UI layout or behaviour, and shortcuts. It also states that kernel or geometry results under solidco…
Full details: Title check

Explanation

The title names a typed-errors refactor of the standard fillet solver's p2 phrase failures, which matches the changeset's main purpose. It is long (133 characters, 21 words) and includes a ticket reference and a 'part 3 of 3' label. The core change is still clearly stated, so the title is related to the main change, though it is wordier than ideal.

Full details: Description check

Explanation

The description follows the repository template closely. It has a Change section that explains the work, with the problem and resulting behavior (each phrase failure becomes a named cause, reviewed defect, or deleted unreachable site). It includes the required 'Changes a default: no' line and a 'Test change' line explaining why three existing test assertions changed. It has a Validation section listing commands and results. The Screenshots section is missing. The change is a kernel error-classification refactor with no observable UI or CAD output change, so the template allows omitting screenshots. The Integration status section is also missing, and the template asks for it. The Change section also assumes readers know project-specific terms (TE-B-11, rule numbers, pins), which the template says to avoid. These gaps are non-critical.

Resolution

Consider adding a short Integration status note (upstream commit and PR status checked, and whether main was merged in before handoff). Consider briefly defining project-specific terms such as TE-B-11, the pin file, and the numbered rules for readers new to the project. A screenshot section is not needed here because the change has no observable behavior.

Full details: Existing Defaults Unchanged

Explanation

The check covers UX defaults only: default settings or preferences, command behaviour in normal use, UI layout or behaviour, and shortcuts. It also states that kernel or geometry results under solidcore/ are not changed defaults. The changed-file inventory (git diff --name-status over the review range) contains six paths, all under solidcore/: - blend/fillet_standard_solver/p1.rs: a private constant becomes pub(super). Its value is unchanged. - blend/fillet_standard_solver/p2.rs: failure sites are mapped to typed causes or defects. The PR description states that each converted site returns an error under the same condition and with the same status as before. - error/blend/set_up.rs, error/blend/solver.rs, error/blend/trace.rs: new enum variants and display text in the kernel error types. - A phrase pin file is deleted. No file outside solidcore/ changes. No settings, preferences, UI, command, or shortcut default changes. The description's Changes a default: no agrees with the diff. The new error variants change diagnostic classification, not a UX default, and the check excludes that category. The check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a5b69d1 and feb38dd.

Files selected for processing: 6

  • solidcore/crates/solidcore/src/blend/fillet_standard_solver/p1.rs
  • solidcore/crates/solidcore/src/blend/fillet_standard_solver/p2.rs
  • solidcore/crates/solidcore/src/error/blend/set_up.rs
  • solidcore/crates/solidcore/src/error/blend/solver.rs
  • solidcore/crates/solidcore/src/error/blend/trace.rs
  • solidcore/crates/solidcore/src/error/pins/phrase/solidcore/src/blend/fillet_standard_solver/p2.rs.pin
Files with no reviewable changes: 1

  • solidcore/crates/solidcore/src/error/pins/phrase/solidcore/src/blend/fillet_standard_solver/p2.rs.pin

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

brett19 and others added 2 commits November 23, 2026 18:23
Converts the 28 counted phrase-cause sites in fillet_standard_solver/p2.rs
to named causes or reviewed defects, and deletes the file's phrase pin.
Unreachable repeats of a just-passed check are folded into slice
patterns. New variants: FilletSetUp::ReferenceCurve and
SolverOriginalCurve (InvalidInput, SM_ERR_NULL_POINTER),
SolverFailure::IntersectionPointBeforeCurve and
TraceFailure::JointWeightNotPositive. Every site keeps its status and
fails on the same condition as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BaseDerivativeZero's doc and text now cover the standard solvers' offset
surfaces as well as the custom solver's base surfaces, since p1.rs and
p2.rs raise it for both. IntersectionPointBeforeCurve's doc says why it
is a refusal. Two tests reach converted sites directly: scale_to_joint
with a zero joint weight names JointWeightNotPositive, and a reversed
rational law reverses its control points and weights, which locks in the
rewritten law_in_parameter loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brett19
brett19 marked this pull request as ready for review November 23, 2026 17:58
@brett19
brett19 requested a review from a team as a code owner November 23, 2026 17:58
@brett19
brett19 requested review from jyviko and removed request for a team November 23, 2026 17:58
@brett19 brett19 added the approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) label Nov 23, 2026
@bherbruck bherbruck added owner-approved Owner reviewed a sensitive-path change (kernel, CI, build scripts, deps); only the owner adds this ready to merge reviewed, every ask addressed; merge once CI is green labels Nov 23, 2026
@bherbruck
bherbruck added this pull request to the merge queue Nov 23, 2026
Merged via the queue into tangency-labs:main with commit 333b3fe Nov 23, 2026
191 of 226 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) owner-approved Owner reviewed a sensitive-path change (kernel, CI, build scripts, deps); only the owner adds this ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants