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
solidcore-ops: say which solid test a body failed, and name a broken port invariant (#15035) - #15164
This PR makes the kernel say which test a body failed when it is not a closed solid facing out. solidcore-ops can then carry that test, and a broken kernel invariant, as data instead of a bare NotSolid or Exception. It covers part 2 of #15035 and the Error::Invariant variant.
Part 1 (OffsetRefusal::Other) belongs to @MarkusReichart's #15160 and is not touched here. Part 3 (the Unsoundness entities) is not in this PR either, for two reasons. It rewrites the same offset_refused mapping and OffsetRefusal::Unsound that #15160 is rewriting. And no kernel check on main produces any of its new variants yet: KeptEdgeNotClear arrives with #13585. Part 3 will stack on #15160.
SolidTest, as in the stub on ops refusals: no string catch-all, and say which solid test failed #15035: NotManifold, NotClosedSolids, PointersInvalid, Invalid, LoopOrientationUndecided, VolumeNegative, VolumeUndecided. It is not #[non_exhaustive], so adding a test breaks every exhaustive match downstream.
Three functions name the first test a body fails, using the same tests in the same order as before: outward_solid_failure, outward_touching_solids_failure and valid_and_outward_failure. is_outward_solid, is_outward_touching_solids and is_valid_and_outward now call them (.is_none()), so their results are unchanged. PointersInvalid covers both ways the old combined condition could fail on the pointer side: a bad pointer status, or a pointer report that leaves AssertValid unrun.
LoopOrientationUndecided is in the stub, but no check returns it yet. Nothing in the solid check decides a loop's orientation from its certified area. The variant is documented as reserved.
solidcore-ops
Error::NotSolidBecause(SolidTest), plus a re-export of solidcore_ops::SolidTest. The new Body::check_solid() returns it. The check runs on a copy, so the body is left as it was.
Error::NotSolid stays, and every call that returns it today still does. Moving finish and the other result checks over to NotSolidBecause is the "contract" step. That step would change the expected values in existing tests (tests.rs the_result_contract and two more, offset/tests.rs:315, split/tests.rs:224,320). So it is left for a maintainer to decide, and not done here.
Error::Invariant { operation, reason }: the kernel's SolidError::PortInvariant maps to it instead of Exception. Exception is still what ops' own consistency checks and PreparationRequired give. No SolidCraft code matches solidcore_ops::Error::Exception or its text.
Tests
issue_2972_volume_sign_enclosure.rs::the_solid_test_names_the_test_a_body_fails builds one real case for each test that can fail:
a box passes every test;
a sheet fails NotManifold, or NotClosedSolids under the touching test;
a box with a vertex tolerance 1000 times the body's fails PointersInvalid, and so does a box with every face flipped;
the quarter horn torus of Modeling: unexpected result #1954, with internal_pole_row_through_knot off, fails Invalid (AssertValid reports an internal pole after a clean pointer check);
the box with its material outside fails VolumeNegative;
the quarter shell R 10, t 1e-6 fails VolumeUndecided.
solidcore-ops tests.rs:
check_solid_names_the_test_a_body_fails covers a box, a sheet, a flipped box and an inside-out box, and checks the .smb bytes are unchanged;
a_broken_kernel_invariant_is_named_not_an_exception checks that PortInvariant becomes Invariant and PreparationRequired stays Exception. No input reaches a broken invariant, because each one found is a defect that gets fixed, so the kernel error is built by hand in this test.
No existing test expectation or input was changed.
Gate
Gate case 2: the change is solidcore/ only, but it adds public API that SolidCraft compiles against.
sc-gate.sh --core-only on the final head (rebased on 9ebf0e9): all PASS. That is fmt, clippy, panic-sites, wasm, tests, doctests, solids, binaries, the rig and every goldens unit, with no golden changes.
sc-gate.sh --craft-only --no-tests (checks, clippy, wasm): PASS on the pre-rebase head. The only commit since changes a test argument (&mut k to &k).
Written by Claude Code (Anthropic) on behalf of @brett19.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The topology checks now report specific solid-validation failures. The ops crate adds Body::check_solid() and distinguishes kernel port-invariant errors from preparation-required errors.
The outward-solid checks now report named failure categories. Existing boolean checks use these results, and tests cover the reported categories.
Ops check API and error mapping solidcore/crates/solidcore-ops/src/error.rs, solidcore/crates/solidcore-ops/src/lib.rs, solidcore/crates/solidcore-ops/src/measure.rs, solidcore/crates/solidcore-ops/src/tests.rs
The ops crate exposes SolidTest and adds Body::check_solid(). It maps PortInvariant to Error::Invariant and retains the PreparationRequired mapping to Exception. Tests check failure results, error mappings, and that checked bodies remain unchanged.
This adds a diagnostic API and a new error variant, and keeps the existing boolean checks and the existing NotSolid error unchanged for current callers. No concrete merge-blocking risk was identified.
Security architecture risk: Low · up to 80493
The changes expose more precise failure information without an identified weakening of validation or body isolation. The main remaining uncertainty is compatibility with downstream callers of the expanded public API.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The demonstrated exposure change is a package-level diagnostic contract over caller-supplied geometry. The inspected entrypoints return validation categories and error data; they do not introduce an identity or authority transition. Consumers outside the checked workspace remain unverified.
Trust Boundaries and Controls
observed — The diagnostic refactor preserves the solid acceptance control: invalid pointers or validity results stop evaluation, unsure regions remain errors, and only a certified positive volume passes. Naming a failure does not turn an undecided or invalid body into an accepted solid.
Resilience and Maintainability Implications
inferred — The new operation inherits existing measurement isolation and recovery: validation runs on an independent copy, session access is serialized, and cancellation or panic uses the existing kernel-replacement path. These mechanisms are unchanged from the full PR base; dedicated concurrency and cancellation tests for check_solid were not available in the inspected evidence.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title names the main change: solidcore-ops now reports which solid test a body failed (NotSolidBecause, check_solid) and names a broken kernel port invariant (Error::Invariant). It is specific and…
Description check
The description follows the template's main parts: it explains what the change does and the problem it solves, states the 'Changes a default' line, and gives detailed validation with test cases and ga…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Existing Defaults Unchanged
The check fails only if the PR changes a UX default (default setting or preference, usual command behaviour, UI layout or behaviour, shortcuts), or if the PR is not purely additive. Kernel or geometry…
Full details: Title check
Explanation
The title names the main change: solidcore-ops now reports which solid test a body failed (NotSolidBecause, check_solid) and names a broken kernel port invariant (Error::Invariant). It is specific and matches the changeset, though the issue reference and the dense wording make it somewhat long.
Full details: Description check
Explanation
The description follows the template's main parts: it explains what the change does and the problem it solves, states the 'Changes a default' line, and gives detailed validation with test cases and gate results. It has no screenshot or recording, but the template says changes with no useful observable behavior may omit that evidence, and this kernel/API change qualifies. The Change section does not explain the feature in plain words for a newcomer; it opens with kernel and solidcore-ops terms. The 'Test change:' line is not needed because no existing test expectation was changed, and the description states this. The Integration status section is not filled in, with no upstream commit or PR status recorded beyond the gate note.
Full details: Existing Defaults Unchanged
Explanation
The check fails only if the PR changes a UX default (default setting or preference, usual command behaviour, UI layout or behaviour, shortcuts), or if the PR is not purely additive. Kernel or geometry changes under solidcore/ are not UX defaults and pass. Evidence: - The changed-file inventory (git diff --name-status against the review base) lists six files, all under solidcore/crates/: solidcore-ops/src/{error,lib,measure,tests}.rs, solidcore/src/topology/brep.rs, and solidcore/tests/issue_2972_volume_sign_enclosure.rs. No CLI, configuration, UI, shortcut, or preference files change. - In solidcore-ops/src/error.rs, the changes are additive: a re-export of SolidTest, new variants Error::NotSolidBecause(SolidTest) and Error::Invariant { operation, reason }, and new Display arms. Error::NotSolid and its callers are unchanged, as the PR description states. - One existing mapping changes. SolidError::PortInvariant now maps to Error::Invariant instead of Error::Exception. This affects how a kernel-invariant error is classified in a Rust library error type. It is not a user-facing default, and the PR says no SolidCraft code matches Exception. - The PR description says Changes a default: no. The code changes no UX default, so the consistency condition is met. No UX default is changed, and the solidcore/ kernel changes fall under the explicit pass rule.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The shape in #15160 is settled now: where the kernel states a failure only in words, the variant carries its class (ErrorKind), a defect flag (the kernel's fault, a bug to report, not a refusal) and the phrase, and the enum is #[non_exhaustive]. Please make Invariant { operation, reason: &'static str } follow that pattern: carry the kernel class and defect: true so callers can tell it is a defect without reading the text, and keep #[non_exhaustive] on anything you add. Everything else here reads fine.
…port invariant (tangency-labs#15035)
The kernel's solid test now names the test a body fails (`SolidTest`:
not manifold, not closed solids, pointer check, AssertValid, volume
negative, volume undecided) through `outward_solid_failure`,
`outward_touching_solids_failure` and `valid_and_outward_failure`; the
bool forms read them, with the same tests in the same order.
solidcore-ops carries it as `Error::NotSolidBecause(SolidTest)`, which
the new `Body::check_solid` returns; `Error::NotSolid` stays for every
call that returns it today. A kernel `PortInvariant` is now
`Error::Invariant { operation, reason }` instead of `Exception`, which
ops' own consistency checks and a missing preparation still give.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SdcgEtwSrdwZxqTQp5MfnU
…ked a defect
Error::Invariant now carries the kernel's class (SolidError::kind, PortInvariant) and
defect: true beside the operation and reason, following the class/defect/phrase shape
of OffsetRefusal::Phrase. Invariant, NotSolidBecause and solidcore's SolidTest are
#[non_exhaustive]; SolidTest says itself through a Display of its own, which ops uses.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SdcgEtwSrdwZxqTQp5MfnU
Error::Invariant is now { class: ErrorKind, defect: bool, operation, reason }, the class/defect order of OffsetRefusal::Phrase in solidcore-ops: every kernel offset refusal has a named reason, no text catch-all (#15035) #15160 (not merged, so mirrored by name and type, no dependency on its branch). class is the kernel error's own SolidError::kind() (ErrorKind::PortInvariant), not hard-coded; defect is true.
#[non_exhaustive] on the Invariant and NotSolidBecause variants and on solidcore's SolidTest, everything this PR adds. SolidTest now has its own Display, which ops uses, so ops needs no wildcard text arm.
Display shows the class and the defect marker; a_broken_kernel_invariant_is_named_not_an_exception asserts both fields and the message.
Gate: --core-only and --craft-only --no-tests pass.
Written by Claude Code (Anthropic) on behalf of @brett19.
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
approved-for-ciReviewed: run the full PR CI (build, tests, goldens, Clippy)ready to mergereviewed, every ask addressed; merge once CI is green
2 participants
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.
This PR makes the kernel say which test a body failed when it is not a closed solid facing out. solidcore-ops can then carry that test, and a broken kernel invariant, as data instead of a bare
NotSolidorException. It covers part 2 of #15035 and theError::Invariantvariant.Part 1 (
OffsetRefusal::Other) belongs to @MarkusReichart's #15160 and is not touched here. Part 3 (theUnsoundnessentities) is not in this PR either, for two reasons. It rewrites the sameoffset_refusedmapping andOffsetRefusal::Unsoundthat #15160 is rewriting. And no kernel check on main produces any of its new variants yet:KeptEdgeNotCleararrives with #13585. Part 3 will stack on #15160.Changes a default: no
Kernel (
solidcore/crates/solidcore/src/topology/brep.rs)SolidTest, as in the stub on ops refusals: no string catch-all, and say which solid test failed #15035:NotManifold,NotClosedSolids,PointersInvalid,Invalid,LoopOrientationUndecided,VolumeNegative,VolumeUndecided. It is not#[non_exhaustive], so adding a test breaks every exhaustive match downstream.outward_solid_failure,outward_touching_solids_failureandvalid_and_outward_failure.is_outward_solid,is_outward_touching_solidsandis_valid_and_outwardnow call them (.is_none()), so their results are unchanged.PointersInvalidcovers both ways the old combined condition could fail on the pointer side: a bad pointer status, or a pointer report that leavesAssertValidunrun.LoopOrientationUndecidedis in the stub, but no check returns it yet. Nothing in the solid check decides a loop's orientation from its certified area. The variant is documented as reserved.solidcore-ops
Error::NotSolidBecause(SolidTest), plus a re-export ofsolidcore_ops::SolidTest. The newBody::check_solid()returns it. The check runs on a copy, so the body is left as it was.Error::NotSolidstays, and every call that returns it today still does. Movingfinishand the other result checks over toNotSolidBecauseis the "contract" step. That step would change the expected values in existing tests (tests.rsthe_result_contract and two more,offset/tests.rs:315,split/tests.rs:224,320). So it is left for a maintainer to decide, and not done here.Error::Invariant { operation, reason }: the kernel'sSolidError::PortInvariantmaps to it instead ofException.Exceptionis still what ops' own consistency checks andPreparationRequiredgive. No SolidCraft code matchessolidcore_ops::Error::Exceptionor its text.Tests
issue_2972_volume_sign_enclosure.rs::the_solid_test_names_the_test_a_body_failsbuilds one real case for each test that can fail:NotManifold, orNotClosedSolidsunder the touching test;PointersInvalid, and so does a box with every face flipped;internal_pole_row_through_knotoff, failsInvalid(AssertValid reports an internal pole after a clean pointer check);VolumeNegative;VolumeUndecided.tests.rs:check_solid_names_the_test_a_body_failscovers a box, a sheet, a flipped box and an inside-out box, and checks the.smbbytes are unchanged;a_broken_kernel_invariant_is_named_not_an_exceptionchecks thatPortInvariantbecomesInvariantandPreparationRequiredstaysException. No input reaches a broken invariant, because each one found is a defect that gets fixed, so the kernel error is built by hand in this test.Gate
Gate case 2: the change is
solidcore/only, but it adds public API that SolidCraft compiles against.sc-gate.sh --core-onlyon the final head (rebased on 9ebf0e9): all PASS. That is fmt, clippy, panic-sites, wasm, tests, doctests, solids, binaries, the rig and every goldens unit, with no golden changes.sc-gate.sh --craft-only --no-tests(checks, clippy, wasm): PASS on the pre-rebase head. The only commit since changes a test argument (&mut kto&k).Written by Claude Code (Anthropic) on behalf of @brett19.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SdcgEtwSrdwZxqTQp5MfnU
Summary by CodeRabbit