Skip to content

v3 Designer: validation line numbers + Phase 7 test hardening (v0.12)#78

Merged
mbreiser merged 1 commit into
mainfrom
phase7/test-hardening-and-line-numbers
May 29, 2026
Merged

v3 Designer: validation line numbers + Phase 7 test hardening (v0.12)#78
mbreiser merged 1 commit into
mainfrom
phase7/test-hardening-and-line-numbers

Conversation

@mbreiser
Copy link
Copy Markdown
Contributor

Two quick follow-ups after the Phase 5/6 merge (#77), both browser-verified.

Validation error line numbers

collectBlockingErrors now reports source line numbers for anchor errors — e.g. Duplicate anchor name: "&dup" declared 2 times (lines 5, 6). It re-parses _doc.toString() (the exact text export will write) with a YAML.LineCounter and maps each node's range[0] to a line, so positions stay accurate even after edits.

Honest scope:

  • Structural errors (from validateReferences, e.g. duplicate condition names) stay line-less — they're model-based and have no CST node handle.
  • Dangling-alias errors are line-less by nature: a dangling alias makes the doc non-serializable (toString() throws "Unresolved alias"), so the re-parse can't run. The check falls back to a range-less scan and still reports the error — just without a line. (Such a doc can't be exported anyway.)

Also fixed a cosmetic double-bullet in the modal list (callers prefix , so the <li> disc marker is now suppressed).

Phase 7 test hardening (Suite 31, 21 checks)

  • Comment preservation at strategic positions: head, section, inline-trailing, between-list-items — all survive round-trip; comment count stable across a second pass.
  • Anchor edge cases: two distinct anchors with the same value round-trip independently (not flagged as duplicates); binding one field leaves an unrelated anchor's references intact.
  • Randomized blocks: randomize: true survives; explicit randomize: false is not dropped; repetitions preserved.
  • Line-number coverage for the validator (duplicate-anchor lines present; dangling-alias graceful fallback).

Testing

  • npm test → 467/467 (arena 10, v2 137, v3 467 — 21 new in Suite 31).
  • Browser-verified (preview MCP, no console errors): the validation modal renders (lines 5, 6) and a single clean bullet (screenshots in session).

Footer bumped to v0.12.

🤖 Generated with Claude Code

- collectBlockingErrors now reports source line numbers for anchor errors
  (e.g. 'Duplicate anchor name: "&dup" declared 2 times (lines 5, 6)'). It
  re-parses _doc.toString() with a YAML.LineCounter and maps node.range[0] to
  a line. Structural validateReferences errors stay line-less (model-based);
  dangling-alias errors are line-less by nature (a dangling alias makes the
  doc non-serializable, so the re-parse falls back gracefully and still
  reports the error). New _linesSuffix helper formats "(line N)" / "(lines N, M)".
- Fixed a double-bullet in the confirm-modal list (callers prefix "• ", so
  the <li> disc marker is now suppressed via list-style: none).
- Suite 31 (21 checks): comment preservation at strategic positions
  (head/section/inline/between), anchor edge cases (two anchors same value,
  binding isolation), randomized-block semantics (randomize true/false
  round-trip), and validation line-number coverage. Full suite 467/467.
- Footer bumped v0.11 -> v0.12.

Browser-verified: the validation modal renders line numbers and a single
clean bullet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mbreiser mbreiser merged commit 7b9e72e into main May 29, 2026
3 checks passed
@mbreiser mbreiser deleted the phase7/test-hardening-and-line-numbers branch May 29, 2026 04:13
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