Files
ARCADIA-Studio/harness/experiments/wrapped-label-20261001/change-summary.md
T

109 lines
6.3 KiB
Markdown

# E/F measured-label experiment implementation handoff
Local uncommitted implementation against `6ea7518e7be5b5f17d5fbc5d667da8b388058af4`.
No compiler, GUI, Gitea, commit or push run by this worker. Root owns all gates.
`rustfmt --edition 2024 --config skip_children=true` completed for the six
explicitly owned/authorized Rust files. This establishes formatting only.
## Changed implementation
- New private `crates/oa-desktop/src/diagram/label_layout_experiment.rs` contains
read-once external E/F/Baseline profile, one-target identity guards, measured
typography cache, shared Layout, fixed placements, collision guards, Canvas
line records, explicit SVG line export and five focused tests.
- `diagram.rs`: Scene stores the shared Layout, profile and font-system version;
both ordinary and work-preview scenes apply it before geometry consumers.
Existing cache additionally keys profile/font version. Drawing and SVG consume
the same ordered line positions. Derived target label bounds feed existing hit
and route-drag start code. The private adapter applies to already-routed data.
- Parent-authorized thin calls: `app.rs` Fit, `diagram_usage.rs` whole/edge bounds,
and `diagram/work_drag.rs` dirty-input shield. No second routing call introduced.
- `diagram/attachment_tests.rs`: existing manual Scene literal gains default fields.
- Parent supplied the pinned `harness/experiments/wrapped-label-20261001/fixture/eight-card.json`;
it is referenced with include_bytes, not rewritten by this worker.
No changes to core, schema, source formats, canonical label.text/Name, Project,
port/card/path state, or B's cue. The fixture and diagram are identified exactly;
other labels return untouched. Baseline returns the complete routed value unchanged.
Automatic guard failure leaves baseline rather than painting an invalid narrower
shape over an old hitbox. Nested/collapsed scenes are excluded from this witness.
## Measurement and scope
Pinned Iced 0.14 graphics Paragraph is accessible through
`iced::advanced::graphics::text::Paragraph`; the same implementation is used by
Canvas Text. Each fixed line is shaped at font 13 with absolute line height 16,
Basic ASCII shaping and no wrap. Width comes from Paragraph min_width; baseline
and resolved face family come from actual cosmic-text runs. A single face per
line is required; mixed fallback or unsupported metrics reject the trial.
Cached measurements are keyed by profile and Iced font-system version; ordinary
hover, selection and camera changes reuse the entire Scene. No character-count
width heuristic is used.
SVG writes explicit per-line x and shaped baseline y with the resolved family,
not browser wrapping or generic sans-serif. It does not embed the font: native
export rendering and font availability on another machine remain a validation
boundary, not proven glyph parity. Tests compare generated text/geometry records,
not raster output or browser appearance.
Automatic E permits exactly one straight own segment crossing both padded sides;
all foreign strokes, cards and labels (including association-end labels) are
excluded. Automatic F clears all strokes. Guards use measured boxes, card margin
12, other-label margin 4 and stroke margin 3. Fixed F's own-is-closer width margin
is explicitly asserted by its fixture test rather than accepted as a general
placement scoring rule.
Authored target labels keep the externally selected line shape and honor actual
fraction/offset. They deliberately retain that shape when a user moves into a
collision, reporting Layout.clear=false; silently unwrapping/resetting would
violate the trial boundary. Conservative whole-scene bounds retain prior bounds
and include moved authored boxes. No ordinary save/reopen formatting contract,
general typesetter, placement winner, or production policy is claimed.
## Parent gates
Suggested targeted test selector:
```powershell
cargo test --locked -p oa-desktop label_layout_experiment -- --test-threads=1 --nocapture
```
Five tests cover full unchanged baseline and all 12 point arrays/other labels,
actual measured dimensions and guard result, matching Canvas/SVG/picking/focus
geometry records, foreign-stroke/card rejection without mutation, authored
fraction/offset/shape retention during real route-preview construction, and
actual Scene/measurement cache reuse plus profile/revision invalidation.
The first test prints measured line/family/bounds records for parent capture.
Compilation, strict lint, fixture guard feasibility on this font installation,
native rendering, actual edit lifecycle, performance, independent fresh-reader
trial, and integration/publication remain pending. Preserve first failures and
revise at the responsible layer; no successful test/native outcome is asserted.
## Captured failure and responsible preview-baseline correction
Parent observed initial source `d8ccd6ed49adac799c02a3c52cb9e431214a4963`
fail compilation because the test EdgeRoute literal omitted its attachment fields.
The first compiler log remains `.local/wrapped-label-tests-first.log`.
At regression source `ebb6a9980b11c4d4df2f7e413c6b135a337f6f6d`, parent observed
five tests passing and the added different-edge preview regression failing:
guard rejection cleared Layout, but target geometry retained wrapped E bounds
(119.174805 x 40) instead of core one-line bounds (233 x 24). Parent's measured
F was 89.18213 x 56; both used Segoe UI. These are parent-reported executed
results, not worker-executed gates. Failed transition log is retained at
`.local/wrapped-label-regression-first.log`.
Correction, now local and frozen for parent compilation: Scene retains a
`core_routed` Arc before the experiment modifies derived presentation. Both
ordinary and allocation-work-preview constructors store that raw Arc; Baseline
shares it with `routed` without copying. `begin_route_with_profile` captures
`core_routed`, so core preview freezes raw one-line labels and a refused wrapper
leaves a complete valid fallback. No guards, measured dimensions, route/path
scoring or failing-regression assertions were changed. The existing authored
preview test setup now uses the same raw baseline contract; existing cache test
also checks Baseline's Arc identity. The one manual Scene literal was updated.
No additional compiler/native execution by this worker. Explicit-file rustfmt
and git diff --check passed. Parent rerun of all six tests and broader gates is
pending at this correction checkpoint.