fix(sgcr): pack ports (no dangling arrows on dense nodes) + strict on-edge P8#208
Merged
Conversation
…n-edge P8
Reported on a dense octilinear graph: arrows attached off the visible node.
Cause — a high-degree node's cell was INFLATED to spread its ports PORT_STEP
apart, but the rendered card stayed small, so ports landed in the wrapper's
empty padding above/below the card → arrows 'dangling in air'.
Fixes:
- Mode-aware port packing. Octilinear: ports pack at a small DENSE_STEP (just
distinct enough that any un-straightened channel runs don't collide, P4) so a
typical high-degree node (e.g. a neural-net layer) needs no inflation and
stays compact; many arrows may meet ~one spot. Orthogonal: unchanged
(inflate to keep axis-aligned stubs PORT_STEP apart), byte-identical layout.
- The rendered card now FILLS its cell (flow-nodes), so ports always land on
the visible node edge — never in padding.
- P8 is now STRICT: an endpoint must lie ON the node perimeter (within 1px),
flagged if it floats OUTSIDE ('dangling') or sits INSIDE the node body.
- P5b (arrowhead non-stacking) relaxed: multiple arrows sharing a point is
allowed (the reason ports no longer need to spread). P5a (arrow-on-wrong-node)
kept.
Verified: stress fuzz 16,000 layouts zero violations (incl. strict P8); red
test confirms P8 flags both inside-node and off-node; vitest 26/26; neural-net
demo nodes back to compact (h33, was h68) and clean.
ivanmkc
added a commit
that referenced
this pull request
Jun 23, 2026
…-axis card fill; label clearance (#210) Reported issues on sgcr-demos: - 06-compiler: the 'optimize' self-loop rendered INSIDE a ballooned (140x163) node. Root: #208's card-fills-cell made the measured re-pass read back the loop-reserve-inflated cell as content size, so each pass re-added LOOP_W (36→62→…→163), and the loop (routed in that reserve) ended up under the card. Fix: the DRAWN node rect now EXCLUDES the loop reserve () — the loop attaches on the face and bulges into the reserve BESIDE the card — which also makes the measured re-pass stable (no re-adding). Loop inner vertical now sits at the drawn far edge, not the port bound. - Card fills only the CROSS axis (width TB/BT, height LR/RL), not the along axis, so ports still land on the card edge while multi-line content (e.g. authz '+ challenge') can never be clipped by a forced height. - Edge labels now nudge along their node-free track to keep a 6px clearance from other edges/labels (the 'consent' label was 1.8px from a back-edge → 5.8px). Verified: stress fuzz 10,060 layouts zero violations (P1–P10, determinism, order-invariance); vitest 26/26; compiler loop 0/4 points inside node (compact 150x46). Co-authored-by: Ivan Cheung <ivanmkc@google.com>
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.
Reported: on a dense octilinear graph (neural net) arrows attached off the visible node. Cause: the node cell was inflated to spread ports PORT_STEP apart, but the rendered card stayed small → ports landed in the wrapper's empty padding ("dangling in air").
Fixes:
Verified: stress fuzz 16,000 layouts zero violations (incl. strict P8); red-test confirms P8 catches inside & off; vitest 26/26; neural-net nodes compact again (h33, was h68).