Repository navigation
[Maintainer] Connected duct and pipe editing, ported from #1115 - #1236
Conversation
(cherry picked from commit f4aa29c)
(cherry picked from commit 8feed8e)
main moved to @modelcontextprotocol/client and @modelcontextprotocol/server after #1115 branched, so these tests failed to resolve the removed @modelcontextprotocol/sdk paths.
Horizontal routing kept only ports and run bodies at the leg's start height, while the free end still takes the pipe fall. A sloped waste run therefore could not snap to a collar or run at the height it actually reaches, and the same-height candidates it did offer were then refused by the grade check on commit. Candidates are now compared with the height the route reaches above their plan position, using the adapter's free-end rule, and run bodies are looked up at that height.
A pipe move whose followers would change another run's grade was refused on click with no feedback, and the click was left to propagate. The ghost now turns red with a status notice while the preview would regrade a connected run, and a refused click is consumed. The drag stays live (history paused until placed or cancelled), so Esc or a valid spot ends it as before. The follower preview now returns the patches it shows, so the grade check reuses them instead of resolving the graph twice per frame.
The new pipe grade, offset and resize inspectors, the duct edit inspector, the collar connection buttons, the route preview label and the distribution cursor hint rendered hardcoded English, which the literal guard rejects. They now go through Lingui as whole messages: split fragments are merged, counts use plurals, and numbers use the locale's formatting. The pipe description and the new grade-blocked move notice are included. zh-CN, fr, es and ja get fuzzy drafts awaiting review, so releases keep showing English for these until a reviewer approves them.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34bb7effae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Aymericr
left a comment
There was a problem hiding this comment.
[Tooling] Changes needed at 34bb7ef (static review, tests not rerun). Not an LGTM.
Blocker (confirms Codex P2): in 2D, dragging a pipe endpoint that's connected to an elbow no longer re-aims the elbow. pipe-segment/definition.ts (move-path-point, ~L109) now uses pipeGradePointAffordance → editPipeGrade, which refuses any direction change at a connected end (pipe_connection_angle). grade-affordance.ts L63–65 then swallows that refusal, so the endpoint silently doesn't move (only Alt-detach works). On main, createPathPointMoveAffordance swings the elbow, and the 3D handles in selection.tsx still do, so 2D and 3D now disagree. Fix: keep the elbow re-aim path in the new affordance and apply the same grade check as 3D, show a notice on refusal, and add a 2D test that drags a pipe connected to an elbow.
Should-fix (Bugbot): in vertical routing, after the first click the preview and Target elevation label still show the start height, so a second click or Enter without moving commits a riser to a height that was never shown (distribution-run-tool.tsx ~L1054–1074, L670–682). Set the preview to the target elevation right after the first click.
Hardening (Bugbot): in duct-segment/edit-operation.ts ~L121–138, the ! on planElbowAtPort should be a clean refusal like the pipe offset has, even though the current inputs can't hit the null case.
No Security gate needed (it only edits the scene: no auth, payments or secrets). After the fix, I'll do a full pass on the new head before signing off.
Moving or raising a leg of a closed duct or pipe loop could freeze the editor. Each fitting re-broadcasts its averaged delta through both collars, and a run held at both ends bounces it straight back, so when two legs split a push differently (a sloped leg, or an oblique move) the walk queued every stale push and the queue doubled each round. The resolver now keeps only the newest pending push per joint edge and caps the walk at 64 steps per edge. Open chains, trees and loops the old walk could finish resolve exactly as before; loops it could not finish now settle with every joint welded (a leg moved along its axis carries the loop rigidly). On this branch the grade inspector's "Move elevation" action and the pipe_grade agent tool reach the resolver too, so a sloped vent loop now refuses that edit with the grade notice rather than locking up.
The grade-preserving floor-plan affordance replaced main's generic path-point drag, which swings the elbow at a straight run's far end to follow the drag. Without it, every turned endpoint was refused and nothing was committed. Plan-view endpoint drags now try the elbow re-aim first, with the same grade and connected-collar checks as the 3D handles. A refused frame keeps the last valid preview and shows a localized floor-plan notice. The 3D handles use the same localized message.
After the first click of a vertical route, the cursor and last resolved point still held the start. The ghost and the Target elevation label showed the start height. The next click then committed a riser the preview never showed, and Enter committed the zero-length start, which did nothing. Resolve the vertical target right away so click and Enter both place what the preview shows.
Match the pipe offset: if an elbow cannot be planned at an offset corner, refuse with a structured reason. Previously a non-null assertion turned that case into a TypeError.
drei's Html applies its style to the wrapper around a label. A pointer-events-none class on the label alone still left the wrapper catching events. The move tool's notice follows the moved run and could sit under the cursor, stalling the preview and swallowing clicks. The selection notice covers the run's center arrows. Pass pointer-events: none to Html, as the measurement labels do. Also clear the endpoint drag's notice on release, so it no longer stays over the arrows after a refused drag.
The center-arrow move checked grades only when publishing a frame. A refused frame silently froze the preview while the drag offset kept following the cursor. Release then recomputed from that unseen offset: a plain stretch was dropped without a message, and a move past the offset threshold committed offset fittings that were never shown. Vertical frames kept a valid tint even when the preview was dropped. Each frame is now planned as release would commit it: a vertical offset, a translation offset with its new fittings ghosted, or a plain move. That plan goes through the grade guard. A refused frame keeps the shown frame and explains why, like the endpoint handles, and release commits the frame on screen. Live previews also drop overrides left by earlier frames.
… scene On a detached scene, enumerating the nodes record counts as reading every node, so a grade, offset, resize, connect or duct edit drafted there was refused whenever anything was created or deleted meanwhile. Port connectivity now selects the run and following-fitting kinds, the operations select their level, and the end-cap and auto-offset helpers select the kinds they own. The raw-scene-enumeration rule now covers these modules.
Each description now opens with a sentence that stands alone, states the defaults of scope, alignment, flow, anchor, detach and the duct sizes, and lists the refusal codes its operation can return. The nodes README documents the five tools next to the kitchen ones.
Pipe collars are named (inlet, outlet, branch, or a numbered collar) instead of showing their port id, duct collar sizes use the locale's digits, and the grade label shared by the plan view, the grade inspector and the drawing readout is a catalog message with locale numbers. Drafts for fr, es, ja and zh-CN await review.
Moving, turning and resizing a selected duct fitting read the grid and angle snap modes, as the duct segment handles already do, instead of treating Shift as a snap bypass. The interaction-scope inventory now lists the handles that still use the legacy bypass.
A pipe move that would regrade a connected run turned its ghost red but kept the footprint box in the placeable green. The box now follows the ghost, as the generic move tool's box does for an invalid placement.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bbe4b50. Configure here.
Aymericr
left a comment
There was a problem hiding this comment.
[Tooling] Static peer LGTM at bbe4b50. This is a static review only: I didn't rerun tests, and this doesn't clear the PR to merge or deploy.
Findings from my review at 34bb7ef:
- Blocker, fixed (7e4c964): in
pipe-segment/grade-affordance.ts, the 2D endpoint drag on a run whose far end sits on an elbow re-aims the elbow again, using the same grade checks as the 3D handles. A refused frame now keeps the last valid preview and shows the blocked-grade notice instead of failing silently. New tests inpipe-grade.test.tscover the re-aim and the held refusal. This resolves the Codex P2 ondefinition.ts:107. - Should-fix, fixed for the first-click path (b1a6cb7):
distribution-run-tool.tsx:1076re-resolves the cursor right after the start is set, so the riser at the target elevation shows before the next click or Enter. Bugbot's Medium on:1243is still open: a draw-from-collar start, or a panel change to target elevation with no pointer move, can still leave a stale preview. Non-blocking follow-up. - Hardening, fixed (eccac50):
duct-segment/edit-operation.ts:376now refuses withduct_offset_angleinstead of using the!assertion.refusethrows, so the early return insidemapis safe.
Also since 34bb7ef: the closed-loop hang in resolveConnectivityUpdates is fixed (10aebd9, coalesced edge pushes plus a step budget) and has loop tests, so the PR description's 'avoid moving a loop leg along its own length' warning and its CI note at 34bb7ef are now stale. The arrow move now commits what it previews (run-move.ts, with tests). I found no new P0/P1 in the delta.
Open Bugbot findings I'm treating as non-blocking follow-ups:
- High,
pipe-segment/tool.tsx:504-508: starting from a non-pipe waste/vent collar rewrites the remembered fall and grade from the collar axis. That matches the documented rule that the first section leaves straight along the collar, and a conflicting grade is refused with a message rather than written. Still worth not overwriting the user's grade defaults. - Medium,
tool.tsx:243-251: the snap tolerance (1e-4 m) and grade-commit tolerance (1e-5) don't line up, so the user can see the wrong refusal message. - Medium,
shared/pipe-collar-inspector.tsx:58:routingMode: 'vertical'stays set after drawing from a vertical collar, so the next click makes an empty segment.
Holds from the PR description still apply: no local bun dev testing, no screenshots of the grade-blocked notice, no grade guard on the pipe-fitting move tool, and machine-drafted non-English locales.
CI at this head: ci, quality, cli-smoke and Changed paths succeeded; Cursor Bugbot neutral. No auth, payments or secrets changes.
…#1242) * Share the collar draw handlers with the pipe and duct tools The collar inspectors' "Draw from" handlers move next to the existing continuation starters, so the collar start can be exercised without rendering the inspector. * Pin how a pipe run leaves a fixed collar The first section follows the collar's axis and takes its grade; a chosen grade that cannot meet the collar is refused with the grade message, not the fitting-clearance one, and later sections take the chosen grade. * Leave vertical routing after a riser drawn from a fixed collar Drawing from a collar that points up or down sets Route to Vertical. After the riser reached the target elevation, the next vertical section aimed at the riser's own top, so every click was refused until the route or target changed. A committed riser out of a fixed collar now switches the pipe and duct tools to the plan route; a vertical route chosen from a pipe or duct end is left alone. Reported by Cursor Bugbot on #1236 ("Vertical collar draw blocks next segment"). * Check that a graded section after a collar joins without a bend The level first section and the 2% section after it meet directly; the only fitting is the end cap on the open end. * Keep a chosen vertical route after a riser from a run end The switch to the plan route applies only to risers out of a fixed collar; a vertical route chosen while drawing from a pipe or duct end stays on for the next riser. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>

What does this PR do?
Ports @sudhir9297's community PR #1115 ("Add connected duct and pipe editing with shared build controls") onto
mainand fixes what kept it from merging. Sudhir's three commits keep their original authorship, and the squash commit3a972b68credits him as co-author. The only change to his commits is that the review screenshots underwiki/assets/pr-1115are left out. They stay linked from #1115, and no document in the repo references them.Merged from head
bbe4b501. Four fixes from the final review were finished after that head and merged in #1237. #1238 and #1240 followed, and #1242 (open) fixes the last Bugbot finding below.From #1115 (Sudhir)
duct_edit,pipe_grade,pipe_resize,pipe_offset,pipe_connect), with one undo step per edit.Maintainer follow-ups
8f230c60):mainmoved to@modelcontextprotocol/clientand@modelcontextprotocol/serverafter Add connected duct and pipe editing with shared build controls #1115 branched. On the merged result, five MEP operation tests failed to resolve the old@modelcontextprotocol/sdkpaths. They now use the split packages.4ffc1f3f): a sloped horizontal route offered snap candidates only at its start height, and the grade check then refused them. It now snaps to collars and runs at the height its fall actually reaches there.48d151ef,bbe4b501): a pipe move whose connected runs could only follow by changing grade was refused on click with no feedback, and the click propagated. History did resume on Esc or unmount, so the drag was never stuck.pipe-segment/move-tool.test.tsxcovers a grade-safe move landing in one undo step with its followers, and a regrading move being refused, re-aimed and cancelled.10aebd9a): moving or raising a leg of a closed duct or pipe loop could freeze the tab inresolveConnectivityUpdates.pipe_gradegrade and elevation edits, run arrow moves, and loops closed by snapping to collars all walk loops.port-connectivity.test.ts,pipe-segment/move-tool.test.tsxandagent-operations/pipe-grade.test.ts.7e4c9649, Codex P2).b1a6cb77, Bugbot High).eccac50e, Bugbot Medium).1c58d203).a7590edf).queryNodes(a54408bd).89cbd84f).3c4ca5bb).34bb7eff,f88c78f0): the new inspector, collar, route-preview and cursor copy uses whole Lingui messages with plurals, and collar sizes and grade labels use the active locale's number format. zh-CN, fr, es and ja get fuzzyReview: requireddrafts, so they show in English until reviewed.Known gaps
ToolOptioncontract, so they stay English until that contract takes messages.This supersedes #1115, with credit to Sudhir. Next owner: Maintainer.
How to test
Checks on the merged head
bbe4b501:ci,quality,cli-smokeandChanged pathspassed.bbe4b501is a static LGTM; it didn't rerun tests.7e4c9649.Screenshots / screen recording
Recorded on the editor dev server (
bun run devinapps/editor) at113206bc, which is this PR's merged tree plus the four commits in #1237.Refused move on a closed loop. In a square pipe loop with one sloped leg, the south leg is moved inward. That would regrade the sloped leg, so the ghost and its footprint box turn red and the notice appears (about 0:11–0:22). Clicks place nothing, and after Esc the loop is unchanged.
Refused loop move: red ghost, red footprint box and the grade notice
pipe-loop-refused-move.mp4
Accepted connected move. An open L of a leg, an elbow and a sloped branch. The leg is dragged sideways with a blue ghost and green joint markers, and the elbow and branch follow and stay joined. A click places the move at 0:35, and one undo at 0:40 restores all three parts.
pipe-open-leg-accepted-move.mp4
Duct offset. A 14 × 8 in duct in an L. "Offset around obstacle" shows the side-elevation sketch, and "Apply offset" (0:29) raises the section with four elbows while both ends stay joined.
duct-offset.mp4
Connected branch resize. With the scope "Connected same-size branch" and a width of 16 in, the form reads "11 existing parts affected · 0 new parts". "Apply resize" (0:27) widens every segment and elbow of the branch in one step. The clip skips scrolling the inspector at 0:23.
duct-branch-resize.mp4
Checklist
bun devbun checkto verify)mainbranchCo-authored-by: sudhir sudhir9297@gmail.com
To show artifacts inline, enable in settings.
Note
Medium Risk
Touches core port-connectivity propagation and heavily used distribution drawing/move paths; regressions could break welded joints, grades, or undo behavior, though coverage was expanded.
Reviewed by Cursor Bugbot for commit bbe4b50. Bugbot is set up for automated code reviews on this repo. Configure here.