Skip to content

fix(class): set every class label clearly on its own line - #588

Merged
anandpant merged 1 commit into
mainfrom
fix/issue-585
Oct 31, 2026
Merged

anandpant merged 1 commit into
mainfrom
fix/issue-585

Conversation

@anandpant

@anandpant anandpant commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #585.

What: In class diagrams, every multiplicity, role and relationship name now sits clearly on its own line. A label only takes a spot where every other line is at least 1.5× as far away as its own line, and at least 8 units further. Rendering only: no API, prompt or token change.

Why: In the real-voice side-by-side on prod fb45399, the judge failed visual clarity on Sol's observer-pattern-class-v2 (2 of 3: "attach / detach" sat between two opposing dependency routes) and Sonnet's library-system-class-v2 (1 of 3: a "0..*" sat nearer the neighbouring inheritance line than its own).

How:

  • Placement (class-diagram.ts): an end label tries the end's first run (two labels on opposite sides, then together on one side), then the end's half of the line. A name tries all of its spots before settling for one that is merely free.
  • Layout fallback (class-layout.ts, labelRoom option): if a label still finds no such spot, the placements run again with more label room: wider port gaps, boxes that grow to hold them, and corridors kept clear of a side-by-side line's labels. The retry is kept only if it draws no more crossings, detours or hugging runs, and at most one extra routing finding per label it fixes. Models whose labels already read clearly render exactly as before.

Proof:

  • class-fuzz: new label attribution invariant. The full 240-model run had 96 misattributed labels on main and has none now; seeds 1, 2, 3, 77 and 1000 also pass in full. One pinned routing model moved from 2/1 to 0/2 (two crossings traded for one endpoint jog) and is re-pinned.
  • Renderer test: checks attribution on every class fixture. It fails on main (library-model role 5 units from a neighbour) and passes here.
  • New fixture and story: classStressFixtures.opposingDependencies and the Class / OpposingDependencies Storybook story reproduce the observer build. The existing LargeModel story was also ambiguous on main and is fixed.
  • Real eval specs: all 48 class samples from both evals have no ambiguous label, with unchanged scene sizes.
  • Preview replay (pr-588-sketchi-studio): all 24 v2 class builds were accepted, all are attributable, and scenario-CLI grades are identical to the evals'.
  • Local gate: pnpm ci:local passed and is signed off. Full diagram-excalidraw:class-fuzz passes. No other fuzz target touches class rendering.

Before/after PNGs (/home/anandpant/Development/shpitdev/sketchi/.memory/renderer-584-585/585/):

  • before-prod/: the judged production PNGs (gh9p, gcax, n7n7)
  • before-main-local/ and after-local/: all 48 class samples rendered locally from the saved specs on main and on this branch, with report.jsonl attribution reports
  • after-preview/: the 24 v2 builds from the PR preview, with preview-grades.txt and preview-attribution.txt
  • fuzz/: fuzz models 3 and 75 after the label-room fallback

Multiplicities, roles and relationship names now only take a spot that is
clearly nearer their own line than any other: every other line stands half
again as far off and at least 8 units further. End labels try the end's first
run, then the end's half of the line; names try every spot before settling for
a merely free one. When a label still finds no such spot, the placements run
again keeping room for labels (wider port gaps, boxes growing to hold them,
and corridors standing clear of a side-by-side line's labels), and one takes
over only if it draws no more crossings, detours or hugging runs and no more
findings than the labels it clears.

The class fuzz gains a label attribution invariant (96 misattributed labels
across the 240-model full run on main, none now), the renderer test checks it
on every class fixture, and a new stress fixture and story reproduce the
observer pattern's opposing named dependencies.

Fixes #585

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the preview Deploy PR previews for the affected apps label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Playground / Studio Preview

Status: deleted

@anandpant
anandpant marked this pull request as ready for review October 31, 2026 05:03
@anandpant
anandpant merged commit 6ac1c11 into main Oct 31, 2026
7 checks passed
@anandpant
anandpant deleted the fix/issue-585 branch October 31, 2026 05:05
@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Icons Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Eval Harness Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Excalidraw Workspace Preview

Status: deleted

@github-actions

Copy link
Copy Markdown
Contributor

Sketchi Web Preview

Status: deleted

anandpant added a commit that referenced this pull request Oct 31, 2026
Sol's library build lost two of five samples on data accuracy, and three on
the class-drawn check, after #588: Member to Reservation runs straight up in
one run, the "reservations" role found no spot clearly its own line's at
Reservation, and walked down that run until it stood just above Member.

A multiplicity or role now only takes a spot beside its own end: its middle
within 110 units of the end's tip (the class-drawn check's reach) and the
line's other tip half again as far off as its own, and 8 units further. That
also keeps a self-loop's labels out from between its two runs. With no spot
both beside its end and clearly its own line's, it stays beside its end, and
the placements run again keeping room for labels; one that reads at most 5%
longer than the placement it replaces may now take over.

The class fuzz gains the end invariant: main misplaced 17 end labels across
the 240-model full run and 74 across eight more seeds, none now. On those
eight seeds, 8 labels whose room would cost crossings now stand at their end
but nearer a neighboring line (81 findings on main, 12 now). Across the
100 saved class builds from the evals, three scenes change, each only in that
one end's labels, and each now passes the class-drawn check. The renderer
test checks every class fixture, and a new fixture and story carry Sol's
build.

Fixes #589

This branch was successfully deployed

1 active deployment
staging — b2c1f2dd Deployed Oct 31, 2026 by anandpant via cleanup-preview (web) #1098
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Deploy PR previews for the affected apps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Class diagrams: dependency and multiplicity labels attributable to the wrong route

1 participant