Repository navigation
fix(zones): keep a row's zones side by side, and build a shaped node's end from its edges (#584) - #587
Merged
Conversation
…s end from its edges (#584) Asked for left to right, two of three Sol hybrid samples hung the AWS cloud under the data center: a top-level wrap came within the target aspect in two bands, the region's wrap inside the cloud in three, and fewer bands won. In a row, a plan within the target that keeps the top-level zones side by side now goes first, the stacked plan its first alternative. Sonnet's first build failed in all three samples on the Oracle database it marked process with no outgoing edge, and in two Kubernetes samples on a RabbitMQ queue marked end that the workers read. A shaped node now takes its end from its edges before validation.
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
Sketchi Playground / Studio PreviewStatus:
|
anandpant
marked this pull request as ready for review
October 31, 2026 04:55
…e, growing its zone for the lane The ERP's line to the VPN gateway ran 13 units under the Oracle database's foot, between it and the data center's outline, which reads as touching it. In zones, the last clearing pass now moves a run alongside a node it neither leaves nor enters out to the reader's corridor gap, where that brings the line within the router's clearance of no node and draws nothing worse; a zone whose outline leaves no lane there grows once every other choice is made, where that routes no worse.
Contributor
Sketchi Eval Harness PreviewStatus:
|
Contributor
Sketchi Excalidraw Workspace PreviewStatus:
|
Contributor
Sketchi Icons PreviewStatus:
|
Contributor
Sketchi Web PreviewStatus:
|
This was referenced Oct 31, 2026
Closed
Closed
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Fixes #584.
What changes
Left-to-right hybrid diagrams keep the cloud beside the data center.
hybrid-cloud-zones-v2asks for left to right. On prod, 2 of 3 Sol samples and 1 of 3 Sonnet samples hung the AWS zone under the data center, and the ERP → VPN line ran down and back left. The judge failed those samples on relationships.layout.direction: "LR"and declares the data center's zones before the cloud's. The zone wrap planner chose the stacked layout itself. That choice was a knife-edge:planZoneWraps). In a row (LR/RL), when the best plan cuts the top level between two zones, a plan within the target aspect that keeps them side by side goes first. The stacked plan becomes its first alternative, so where the side-by-side plan routes worse, the existing selection still falls back to stacking (the 30-node stress case does). Columns (TB/BT) are unchanged: there the cut stands the zones side by side across a wide export, and keeping them in one column draws a taller image with lines climbing back up (checked on the described/stacked/corridor fixtures).hybrid-cloudLR/RL now wraps its region beside the data center (1.67:1 → 1.45:1 PNG). No other zone fixture changes plan in any direction.Sonnet's tool error was ours: a shaped node's end now comes from its edges. All 3 Sonnet v2 hybrid samples first built the Oracle database as
kind: "process", shape: "database"with nothing leaving it, and gotmissing_outgoing_edge. 2 of 3 Kubernetes v2 samples marked RabbitMQendalthough the workers read it, and gotend_has_outgoing. Each retry cost a full turn (25.4k vs 17.9k tokens per hybrid sample).resolveFlowchartNodeKindsalready repairs recoverable kinds before validation. It now also turns a connected shapedprocessthat nothing leaves into anend.endthat passes data on becomes aprocess, where another end remains.Lines in zones keep clear of the nodes they run alongside. With the cloud beside it, the ERP → VPN line squeezed 13 units under the Oracle cylinder's foot, between it and the data center's outline. That reads as touching Oracle (about 12 px at a 2,000 px fit). Prod already drew this skim in every side-by-side hybrid sample.
clearOutlines, last pass). In zones, a run that lies alongside a node it neither leaves nor enters now moves out to the reader's corridor gap: 24 px at a 2,000 px fit,routingCorridorGap, the threshold the reader-scale checks already use for two lines.routingCorridorRun.zonesWithoutAlongsideRoom). Where the zone's outline leaves no lane at the gap, the zone grows once every other choice is made (Arrangement.zoneSlack, the existingGROUP_SLACK). The growth is kept only where it routes no worse and leaves fewer roomless zones.zones.test.ts, no line of any zone fixture or generated sample (15 diagrams, all four directions) runs alongside a node it passes, nearer than the corridor gap, along more than a corner. It fails on 9 hybrid fixtures without the fix.thirty-servicesstress case (past the 24-node limit), anddepth-fourLR, whose 3:1 row the grown zone would only lengthen, so the guard refuses it.No API or UI surface changes beyond the drawn layout.
docs/flowchart-zones.mddocuments both rules.Proof
pnpm ci:local: passed and signed off on the head, 13 affected projects (lint and format, typecheck and build, tests, project graph, diagram-ui Storybook build).diagram-excalidraw:routing-fuzz(full): passed on the final head, 135/135 tests (ROUTING_FUZZ=full, 531 s); the zoned pins, crossings, findings and lines through heads included. No other fuzz target renders a zoned flowchart: frames and state-machine composites are not zoned, so the new rule never applies to them.leftToRightHybridFlowchart(Sol v2 sample 2, as sent), tested LR and RL: cloud beside the data center, ERP → VPN forward, aspect < 2.45.zones.test.ts.Diagram Types/Flowchart/ZonesHybridCloudLeftToRight.ZonesHybridCloudalso shows the change.hybrid-cloudLR), the real Sol sample 69 ms; a zone that needs room takes one more layout.thirty-servicesstress fixture (past the 24-node flowchart limit) now also tries the side-by-side plan before falling back, 633 → 1165 ms LR, so the zone stress work bound inrouting-work.test.tsrises 18M → 24M (measured 23.8M); the zone fixtures measure 2.22M, under their unchanged 2.3M bound.pr-587-sketchi-studio, playground): the firstbuildFlowchartcall of every saved sample was sent to the preview MCP and to prod, then graded with the scenario CLI (--scenario … --input).invalid_flowchart(missing_outgoing_edge); preview accepted, all checks pass.invalid_flowchart(end_has_outgoing); preview accepted, all checks pass.Before / after PNGs
Local (this machine):
/home/anandpant/Development/shpitdev/sketchi/.memory/renderer-584-585/584-pngs/after-r1//home/anandpant/Development/shpitdev/sketchi/.memory/renderer-584-585/584-pngs/before/. Prod-judged and prod-replayed Sol/Sonnet v2 hybrid samples, plus thehybrid-cloudfixture on main./home/anandpant/Development/shpitdev/sketchi/.memory/renderer-584-585/584-pngs/after/. Preview-replayed hybrid (Sol and Sonnet) and Kubernetes first builds, plus local renders of the same specs and fixture.