Skip to content

v0.1.1: renderer + parser fixes from audit#2

Merged
hushamsaeed merged 1 commit into
mainfrom
v0.1.1-fixes
May 2, 2026
Merged

v0.1.1: renderer + parser fixes from audit#2
hushamsaeed merged 1 commit into
mainfrom
v0.1.1-fixes

Conversation

@hushamsaeed
Copy link
Copy Markdown
Contributor

Found by an autonomous audit; all P0 bugs verified by reproduction before fix.

Renderer

  • Same-row skip-over (P0): same-row edges that pass over an intervening node now route up-and-over. Was drawing straight through the intervening box.
  • Self-loop edges (P0): no longer rendered as zero-length paths (M cx cy L cx cy). Surface as warnings instead.
  • Marker id collisions (P0): <marker id> and CSS class names now use a per-render ps-<hash> namespace so two SVGs on one page don't collide.
  • Multi-edges + cyclic edges (P1): stack via perpendicular offset, no more pixel-overlap.
  • Cite suppression (P1): no signature on a no-node canvas.
  • IBM Plex Mono dropped from FONT_MONO fallback.

Parser

  • New warnings[] field surfaces undefined-node edges + self-loops to library consumers (was CLI-only).
  • Edges carry source line number.

Layout

  • Removed 1600px hard canvas cap. 13-node layer was clipping nodes off-canvas.

CLI

  • -o/--out validates a value follows. plinth-sketch foo.sketch -o used to silently swallow the flag.
  • Warnings vs errors distinguished in stderr.

Tests

  • 29 tests pass (was 23). New: undefined-node warnings, self-loop warnings, byte-stable rendering, distinct namespaces, cite suppression.

Test plan

  • npm test passes (29 / 29)
  • Same-row skip-over: 4-segment up-and-over path verified
  • Self-loop: warning emitted, no path rendered
  • 13-node layer: viewBox grows to 2380 (was clipped at 1600)
  • -o no-value: exits 2 with clear error
  • Examples re-render byte-stably

🤖 Generated with Claude Code

Found by an autonomous audit. All P0 bugs verified by reproduction.

Renderer:
- Same-row edges that skip over an intervening node now route up-and-over
  (was drawing a straight line through the intervening box). Detection is
  layer-aware: only same-layer co-rowed nodes count as "intervening."
- Self-loop edges (a -> a) are no longer rendered as zero-length paths;
  surfaced as warnings instead.
- Marker ids and CSS class names use a per-render namespace (ps-<hash>)
  derived from the DSL so two SVGs embedded on the same HTML page no
  longer collide on <marker id> or scoped CSS selectors.
- Multi-edges between the same pair stack visually via perpendicular
  offset; cyclic edges (a->b + b->a) similarly stack via stable direction.
- Cite/signature suppressed when there are no nodes drawn (was rendering
  an empty signed canvas).
- IBM Plex Mono dropped from FONT_MONO fallback.

Parser:
- New warnings[] field surfaces undefined-node edges and self-loops
  (was only computed in the CLI).
- Edges now carry their source line number.

Layout:
- Removed the hard 1600px canvas cap. 13-node layers were clipping nodes
  off-canvas. Canvas now grows to honour NODE_MIN_W regardless of count.

CLI:
- -o / --out now validate that a value follows.
- Warnings vs errors distinguished in stderr output.

Tests:
- 29 tests pass on Node 25.6 (was 23).

Examples re-rendered with the new namespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hushamsaeed hushamsaeed merged commit fd7147f into main May 2, 2026
3 checks passed
@hushamsaeed hushamsaeed deleted the v0.1.1-fixes branch May 2, 2026 09:15
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.

1 participant