Repository navigation
feat: improve sketch order with checked joint placement - #134
Merged
Merged
Conversation
ViktorMikhalkin
marked this pull request as ready for review
November 30, 2026 22:10
This was referenced Nov 30, 2026
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.
What changes for users
Preferred sketch pins retain more of the author's order and move boxes closer to their intended positions. ELK and dagre compare the existing final drawing with one certified placement over both axes. They select the joint proposal only when raw and refined hard defects and crossings, within-rank order and rank order do not worsen, with at least one improvement. When those counts tie, lower pin distance or fewer bends can decide. Natural drawings also keep their existing bend ceiling.
The selected drawing keeps its reserved label geometry. Exact pins, hand geometry, the map format and the public API retain their contracts. Joint selection loads only for preferred sketches.
Why
Separate axis optima can disagree after routing. The joint problem combines required lanes, pins and forward-arrow gaps with sketch rank groups and order within and between ranks. Coordinates fixed by both bounds are removed before optimisation and counted. The optimiser balances pin distance and weighted arrow straightness, then checks one primal/dual and complementary-slackness certificate against the routed placement. It routes the proposal once.
A certificate does not prove drawing quality. Independent measurements compare the actual existing and joint drawings after the width pass, with the existing drawing as fallback. Each evidence report records the selected variant, reason, decisive measurements and fixed/free counts. Contradiction diagnostics include both proposals and suppress equivalent cycle rotations while preserving the first witness's order.
Evidence
npm run verify: 165 files and 1,410 tests pass, including the new public selection and score-guard tests. All dependency, schema, API, complexity, packaging and build checks pass.npm run format:checkandnpm run sizepass after adding the separate joint-selection budget. All 11 budgets pass. Existing limits are unchanged. Reported first downloads: component 32.79 → 32.98 kB gzip; layout 24.22 → 24.43 kB; player unchanged. The new standalone on-demand entry is 32,233 B with a 33,199 B limit, including shared code.npx playwright test --project=chromium: all 176 tests pass. The related sketch and element-loading run also passes all 12 tests. Firefox and WebKit remain CI checks, as required for this browser-independent change.Scores below are before → after. Within-rank agreement is out of 114 pairs; rank agreement is out of 1,559. Distance is the mean translated distance per pinned box. Other figures are collection totals.
The narrow dagre bend increase is allowed by its guarded order and defect improvements. CI now runs all four scorers and protects these measured levels; the original natural ELK guards remain unchanged. No quality-checker threshold, band or complexity exception changes.
Reproduce the score reports with:
Not done
Changelog
BEGIN_COMMIT_OVERRIDE
feat: improve sketch order with checked joint placement
END_COMMIT_OVERRIDE