Skip to content

test(layout): hold automatic drawing quality in a small corpus - #565

Merged
Alpha9463 merged 2 commits into
mainfrom
feat/550-improve-auto-drawing-quality
Oct 1, 2026
Merged

Alpha9463 merged 2 commits into
mainfrom
feat/550-improve-auto-drawing-quality

Conversation

@Alpha9463

@Alpha9463 Alpha9463 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a small behavioural regression corpus for automatic drawings. Eight scenarios must meet the hard geometry and routing invariants, draw the same sheet when routed and rendered again, and stay within crossing and extent budgets. Engine changes are deferred to #564.

Related Issues

Closes #550
Refs: #547, #564

Changes

  • Add tests/test_layout_workflows.py with one test per scenario:
    • simple chain
    • free pump between two pixel-pinned flags
    • biodiesel as authored, with the S-103 pin removed (mixed pixel pins), and fully automatic
    • 11_ethanol_pid, 20_molecular_sieve_dryer and 21_alumina_refinery with placement pins stripped
  • Fail on any validation error, fallback route, overlap, route through a unit, blocked exit, diagonal route, or pixel pin drawn more than half a pixel off.
  • Check that a second route() leaves the drawing fingerprint unchanged and that rendering twice gives the same SVG.
  • Check crossings, width and height against separate per-scenario budgets: the figures measured at 3e88e38, with 1% allowance on extent. [Epic]: Lay out equipment by its nozzles and set pipe furniture on routed pipe #564 tightens them.

No source, gallery or golden file changes.

How to Test

  1. Run the corpus and the neighbouring layout tests:

    python3 -m pytest -q tests/test_layout_workflows.py tests/test_layout.py tests/test_routing_quality.py
  2. Run the complete suite and static checks:

    python3 -m pytest -q
    python3 -m ruff check .
    python3 -m ruff format --check tests
    python3 -m mypy pandid
    python3 -m pyright pandid
  3. Run the full corpus report:

    python3 scripts/layout_quality.py --worst 10

Evidence

Scenario Crossings budget Extent budget (px)
Simple chain 0 656 × 87
Pixel anchors 0 736 × 67
Biodiesel as authored 7 1981 × 1254
Biodiesel, S-103 pin removed 7 1981 × 1254
Biodiesel automatic 20 1998 × 942
11_ethanol_pid, pins stripped 8 2588 × 1992
20_molecular_sieve_dryer, pins stripped 32 1828 × 1822
21_alumina_refinery, pins stripped 69 3044 × 2147
  • Focused tests: 105 passed.
  • Full suite: 11481 passed, 188 skipped. The new file adds about 24 s, 12 s of it the ethanol P&ID.
  • Ruff, test formatting, mypy and git diff --check are clean. Pyright reports 0 errors for pandid and the new file, plus the existing __all__ warning.
  • Corpus report: no validation error, unit overlap or route through a unit on either corpus.
  • A broken budget or invariant fails with the scenario, the measure and both values, for example biodiesel automatic: 20 crossings, budget 19.

Checklist

  • Base branch is main and the branch is mergeable
  • Commit subjects follow Conventional Commits; tracked work links its issue
  • Self-reviewed the full diff on the Files changed tab
  • Relevant local checks pass; all CI jobs pass before merge
  • Documentation and examples updated if behaviour changed
  • Before/after drawings included if rendered output changed
  • Blocking review feedback resolved, if review was requested

Check hard invariants, repeat-run stability and per-scenario crossing and
extent budgets on eight automatic and mixed-pin scenarios. Budgets hold the
figures measured at 3e88e38 until #564 tightens them. Two strict expected
failures record the column and R-103 placement faults.

Refs: #550
The two strict xfail tests read as failing tests in the suite. Both faults
are recorded in #564, which will add them as ordinary tests with its fix.

Refs: #550
@Alpha9463 Alpha9463 self-assigned this Oct 1, 2026
@Alpha9463
Alpha9463 merged commit 180a2cf into main Oct 1, 2026
7 checks passed
@Alpha9463
Alpha9463 deleted the feat/550-improve-auto-drawing-quality branch October 1, 2026 01:04
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.

Improve automatic drawing quality with a small behavioural regression corpus

1 participant