Skip to content

Pipes: an edit elsewhere in the design no longer builds every later pipe again (#27046) - #27052

Open
MarkusReichart wants to merge 3 commits into
tangency-labs:mainfrom
MarkusReichart:fix/27046-pipe-reads
Open

MarkusReichart wants to merge 3 commits into
tangency-labs:mainfrom
MarkusReichart:fix/27046-pipe-reads

Conversation

@MarkusReichart

@MarkusReichart MarkusReichart commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Change

SolidCraft keeps a cache of each feature's result. After an edit, it builds again only the features whose inputs changed and takes the rest from the cache. A pipe (a tube along a path, as used for cables and tubing) was never taken from that cache. So any edit built again every pipe after it in the timeline, even a pipe in a part the edit doesn't touch (#27046).

The cause: Feature::reads in crates/doc/src/eval.rs says what a feature reads, and it had no arm for a pipe. Without an arm, a feature counts as reading everything.

This PR adds a Pipe arm, as the Extrude arm already does:

  • A pipe along curves of a sketch of its own part reads that sketch and the bodies it cuts or joins. A pipe that makes a new body reads no body.
  • Its path is mapped into the part's frame, as an extrude's profile is. The part's placement is already in the pipe's cache key (placement_digest).
  • A pipe along a body's edges (path_body) still reads everything, as before.

The pipe's result doesn't change. Only the number of features built again after an edit changes. The issue reports 4.66 s against 0.00 s for deleting the first of 40 such parts. The arm follows the patch in the issue.

#23780 (open) gives pipes target_features, bodies picked by the feature that made them. Whichever of the two lands second must make this Pipe arm read those bodies too, as the Extrude arm will need.

Fixes #27046

Changes a default: no

Validation

New test a_pipe_keeps_its_result_when_a_feature_before_it_changes in crates/doc/src/eval_cost_tests.rs. A block and a pipe sit in two parts. The pipe's part is placed away from the origin. The pipe is 4 mm with a 1 mm wall, along a line, an arc and a line. The test checks how many features each edit builds again (last_recomputed), and that the bodies equal a fresh evaluation each time (name, volume, face names):

  • The block gets longer: 1 feature built again (the block).
  • The block is suppressed: 0 features built again.
  • The pipe's path gets longer: 2 features built again (the sketch and the pipe), and the pipe's volume grows.

Results, in WSL (Linux x86_64) with the ci profile:

  • At the test commit 640bc62, without the fix: the new test fails. cargo nextest run -p solidcraft-doc --cargo-profile ci --lib -E 'test(a_pipe_keeps_its_result_when_a_feature_before_it_changes)' stops at "only the block" with 2 features built again (the block and the pipe), expected 1.
  • At the head 937756d, with the fix: the new test passes.
  • At the head 937756d: cargo fmt --all -- --check, the repository checks (cargo xtask assets, icons, licences, layers, ui-containers, lists, i18n, mesh-decisions, app-geometry, skills), cargo clippy --workspace --all-targets --profile ci --locked -- -D warnings and cargo xtask wasm pass.
  • At the head 937756d: cargo nextest run -p solidcraft-doc --cargo-profile ci --profile ci runs 2488 tests, and all 2488 pass.

Not run: the tests of the crates that depend on solidcraft-doc, left to CI. The wall-clock time was not measured here; the times above are the issue's.

Screenshots of the behavior (when observable)

None: nothing changes on screen, only the time an edit takes.

Integration status

Branched from main at 2cd08d8. Checked against main at ba80a25: the branch merges without conflicts, and main has changed nothing in Feature::reads since 2cd08d8.

Co-written and tested with Claude Code (AI)

Summary by CodeRabbit

  • Bug Fixes
    • Pipe results now stay consistent when connected components change: affected results update, while unrelated edits do not trigger unnecessary changes. Suppressed edits leave unaffected results unchanged.
    • Extending a pipe’s path now updates the path and its resulting output.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Feature::reads now tracks the path sketch and operated bodies for pipes with path_body: None. A regression test checks cache recomputation after edits and compares cached pipe results with fresh evaluations.

Changes: Pipe cache-read tracking

Layer / File(s) Summary
Pipe read tracking and regression coverage
crates/doc/src/eval.rs, crates/doc/src/eval_cost_tests.rs
Feature::reads returns dependencies on the path sketch and operated bodies for pipes with path_body: None. The regression test checks recomputation after unrelated edits and a path extension, and compares cached results with fresh evaluations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 93775

This change only narrows which features are rebuilt after an edit for pipes that follow a sketch in their own part. No concrete defect was found, so it is low risk to merge. Tests for crates that depend on solidcraft-doc were left to CI.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the main change: pipes no longer rebuild every later pipe after an unrelated edit. It matches the PR's Feature::reads Pipe arm and the linked issue #27046. It is specific and concise, …
Description check Passed The description covers the change, the cause, the fix, validation, screenshots, and integration status. It explains the problem and resulting behavior in plain terms, and it links the issue. The templ…
Linked Issues check Passed [#27046] The whole-PR diff of crates/doc/src/eval.rs adds a FeatureKind::Pipe { path_sketch, path_body: None, .. } arm to Feature::reads. The arm returns the bodies from `operated(self, feature_…
Out of Scope Changes check Passed The whole-PR changes touch two files: crates/doc/src/eval.rs (the new Pipe arm and its doc comment) and crates/doc/src/eval_cost_tests.rs (the regression test). Both directly serve #27046. The PR …
Existing Defaults Unchanged Passed The check asks whether the PR changes a UX default that users already rely on. The PR changes only two files: crates/doc/src/eval.rs and crates/doc/src/eval_cost_tests.rs. None of the changed file…
Full details: Title check

Explanation

The title names the main change: pipes no longer rebuild every later pipe after an unrelated edit. It matches the PR's Feature::reads Pipe arm and the linked issue #27046. It is specific and concise, and it has no vague terms.

Full details: Description check

Explanation

The description covers the change, the cause, the fix, validation, screenshots, and integration status. It explains the problem and resulting behavior in plain terms, and it links the issue. The template's 'Changes a default' line is present and set to 'no', with a sound justification as a performance fix. The description does not use the template's required wording of the Test change line, but the PR adds tests and does not change existing test expectations, so none is required. The Change section uses internal names such as Feature::reads, which is acceptable for a developer audience. The description is mostly complete, so it passes.

Full details: Linked Issues check

Explanation

[#27046] The whole-PR diff of crates/doc/src/eval.rs adds a FeatureKind::Pipe { path_sketch, path_body: None, .. } arm to Feature::reads. The arm returns the bodies from operated(self, feature_op(self)) and the path sketch via sketch(path_sketch). Pipes with path_body: Some(..) fall through to the existing None result, so they still read everything. The doc comment is updated to list pipes among features with known reads. The summary reports a new regression test, a_pipe_keeps_its_result_when_a_feature_before_it_changes, in crates/doc/src/eval_cost_tests.rs. It checks rebuild counts for an unrelated edit, a suppression, and a path-sketch edit, and compares results with fresh evaluations. The PR description reports that this test fails at the test commit without the fix and passes at head 937756d2ea, and that 2,488 solidcraft-doc tests pass. I did not re-run these tests. I did not read the test file directly, so the test behaviour rests on the reported results and the summary. The issue's objectives are covered by the code change and the described test.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes touch two files: crates/doc/src/eval.rs (the new Pipe arm and its doc comment) and crates/doc/src/eval_cost_tests.rs (the regression test). Both directly serve #27046. The PR description's note on #23780 (target_features for pipes) describes future work. This PR does not implement it, so it adds no out-of-scope change. No unrelated file or behaviour change appears in the reviewed evidence.

Full details: Existing Defaults Unchanged

Explanation

The check asks whether the PR changes a UX default that users already rely on. The PR changes only two files: crates/doc/src/eval.rs and crates/doc/src/eval_cost_tests.rs. None of the changed file paths touch settings, preferences, shortcuts, UI layout, or configuration. The code change in eval.rs adds a FeatureKind::Pipe { path_sketch, path_body: None, .. } arm to Feature::reads. This is internal cache-read tracking. It decides which features the incremental evaluator rebuilds after an edit. The PR description states that the pipe's result does not change; only the number of rebuilt features changes. Under the check's scope, kernel or geometry behaviour is not a changed default, and this change falls in that category. The description's Changes a default: no is consistent with the diff, so the fail-on-mismatch condition does not apply. Evidence reviewed: the name-status inventory (2 modified files), the eval.rs patch (a doc comment update and one new match arm), and a filename search for setting, preference, default, shortcut, keymap, UI, and config terms, which returned no matches.

Finishing Touches

Generate unit tests (beta)

  • 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 0ebc356 and 937756d.

Files selected for processing: 2

  • crates/doc/src/eval.rs
  • crates/doc/src/eval_cost_tests.rs

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

MarkusReichart and others added 2 commits December 6, 2026 03:48
…t changes (tangency-labs#27046)

The test fails: Feature::reads has no arm for a pipe, so the pipe is
built again after every change before it.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…get bodies (tangency-labs#27046)

Feature::reads had no arm for a pipe, so every pipe was built again
after any change before it, even a change in another part. A pipe along
curves of a sketch of its own component now reads that sketch and the
bodies it cuts or joins (a new body reads none), as the Extrude arm
does. Its path's placement is in its key already (placement_digest).
A pipe along a body's edges still reads everything.

The arm follows the patch in the issue.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@MarkusReichart
MarkusReichart marked this pull request as ready for review December 6, 2026 04:39
@tangency-repo-manager tangency-repo-manager Bot added the approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) label Dec 6, 2026

This branch has not been deployed

No deployments
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipe: every pipe is built again after any change before it, even one in another part

1 participant