Skip to content

fix(sgcr): pack ports (no dangling arrows on dense nodes) + strict on-edge P8#208

Merged
ivanmkc merged 1 commit into
masterfrom
fix/sgcr-port-packing
Jun 23, 2026
Merged

fix(sgcr): pack ports (no dangling arrows on dense nodes) + strict on-edge P8#208
ivanmkc merged 1 commit into
masterfrom
fix/sgcr-port-packing

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jun 23, 2026

Copy link
Copy Markdown
Owner

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:

  • Mode-aware packing — octilinear packs ports at a small DENSE_STEP (distinct → track-safe P4) so high-degree nodes stay compact (many arrows can meet ~one spot); orthogonal unchanged (byte-identical layout, still inflates for axis-aligned stubs).
  • Card fills its cell so ports always land on the visible node edge.
  • Strict P8 — endpoint must lie exactly ON the node perimeter (±1px); flags both off-node (dangling) and inside-node.
  • P5b relaxed — multiple arrows sharing a point is allowed (P5a, arrow-on-wrong-node, kept).

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).

…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 ivanmkc merged commit 213f224 into master Jun 23, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants