An adversarial review found a real regression: removing the greedy overflow re-check left walk_region's has_note skip with no safety net. When a note-less leading measure precedes a soft (or automatic) break at a barline, walk_region skips the break — the closing system has no content — but the DP, which treated that barline as a forced segment boundary, optimized each side independently and could not foresee the skip. The following optimizer-filled measures then absorb the furniture measure and silently overflow into a MULTI-measure overfull system (forbidden by the module's own contract). The review verified the rest of the DP sound (reachability can't yield a giant overfull system, determinism holds). Fix: restore the greedy overflow check as a fallback net — walk_region also breaks before a measure that would overflow the content width (chunk_hi[i] - current_lo > width_limit, guarded by has_note). In the common content-full case the DP's break fires first, so the net never triggers and the geometry is the optimizer's (zero golden churn). Regression: a_content_less_measure_before_a_soft_break_never_overflows (a wide note-less M0 + a soft break + narrow-then-wide measures; verified to fail without the net: "system 0 spans 5 measures at width 60 > 42"). 945 tests, clippy 0, docs -D warnings, zero golden churn, conformance 8/8. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| DECISIONS.md | ||
| README.md | ||
README.md
epiphany-engrave
Agent I's engraving constraint solver (spec Chapter 9): turns a
ConstrainedLayoutIR into a ResolvedLayoutIR with real geometry. It is the
production-side replacement for epiphany-layout-ir's interface-only
StubSolver; the two live in separate crates so the spec's core/product boundary
stays sharp.
Status: Minimal tier, with casting-off
Engraverruns a deterministic horizontal spacing pass (the first axis of the two-pass spring layout): each spring slot is placed left-to-right by a collision-aware advance derived from real glyph bearings.- A casting-off pass (Phase 3's layout track) then breaks the spaced line
into systems at measure boundaries (greedy first-fit against a
PageGeometry— default A4 portrait at an 8 mm staff), stacks systems vertically at the vertical-band model's inter-system gap, assigns pages by content height, and populates the realResolvedPage/ResolvedSystemtree. Every position is baked into a single y-up world frame (pages stacked vertically), so the SVG renderer and hit-testing consume the flat glyph/stroke lists unchanged. - The IR's declared constraints are evaluated — geometric families against
the pre-casting spaced frame, break constraints against the final break
structure (hard breaks are always honoured; a pathological soft break is
skipped and recorded as an
IrOverridedecision). Chosen breaks are recorded asEngravingDecisions withSynthesisKind::EngravedBreaktargets, attributed to the user override that requested them when one did. - It reports
SolverTier::Minimal: hard constraints (break family included) satisfied, no optimality claim — the quality-metric vector stays the honest all-worst placeholder until the Quality Metric Catalog lands.
Deferred: the vertical soft-spring solve, per-system justification/stretch,
optimal break search, widow/orphan control, and casting-off caching. See
DECISIONS.md.
use epiphany_engrave::Engraver;
use epiphany_layout_ir::{ConstraintSolver, SolverConfig};
let report = Engraver::default().solve(&constrained_ir, &SolverConfig::default());
assert!(report.satisfied_hard_constraints);
let resolved = report.layout; // real pages/systems; hand to epiphany-render-svg