Two consequences of the preview dropping from ~1535 ms to ~142 ms.
The manifest is now scoped to the object being edited. It was 844 KB on a
41-road workspace — 239 handles, 89% of the bytes being `affects` id lists at 46
ids per junction handle — shipped on every preview while the map rendered six.
A segment selection returns 12.2 KB, a 69x reduction, and the cost no longer
multiplies with each handle kind we are about to add. Omitting the selection
keeps the full manifest for the compiler and existing callers, and the tests
assert that scoping is a filter of the full manifest rather than a second
derivation.
The ghost is re-aimed from "estimated geometry" to "what you asked for". Its
guide line existed to mark the origin through a long wait that no longer happens,
so it is gone; what remains is what the preview cannot say — the numeric delta
and whether the drag has hit its clamp. The translucent outline
research/joint-solver.md asked for is deliberately not built: drawing it
accurately means recomputing the road surface in the browser, which the design
forbids, and drawing it crudely would be wrong exactly at transitions, junction
boundaries and clamps. A preview that lies is worse than none.
`degraded` finally has a consumer. EditSession has tracked it since the session
work but nothing read it; a slow solve now dims the ghost in place with a pending
label instead of clearing it and letting the geometry flicker, as design.md
requires.
Selection also fixed a latent hazard: the manifest effect reloads on every
selection change, and it used to call session.load() each time, which would have
discarded unsaved edits the moment the user clicked another road. It now adopts a
document only when the compiled document actually changed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three of this task's defects were cross-layer wiring rather than logic, so they
belong in the spec where the next session will read them, not only in the task's
research notes.
Frontend: a new client spec covering layer ownership (baseline is never written,
preview hides rather than overwrites), why a handle carries only its id, why a
handle's position must derive from the clamped value, the ban on computing inside
a setState updater, and why per-pointermove React state is the wrong owner of
per-frame feedback.
Backend: the left/right convention now states the three places that must agree
and why a sign convention can be wrong on both sides of the wire at once; a table
of the four profile fields the geometry stage actually reads, so nobody builds UI
for interval-scoped editing again before the compiler honours it; and the
save-is-not-applying contract, including that compileFresh must be installed by
every path that sets session.area.
Also records that an identity test cannot catch an ignored editsFile, and that a
regression test is only trustworthy once it has been seen to fail.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three things, kept in one commit because they touch overlapping hunks of the
same two files and this environment has no interactive hunk staging. Splitting
them by file would have drawn boundaries that misrepresent what changed.
1. Step 4 of the map editor. A native OpenLayers PointerInteraction turns a
drag into a clamped constraint value, the ghost source shows it immediately,
and the solver's answer replaces a parallel set of preview layers while the
baseline layers are hidden rather than overwritten. Preview requests debounce
at 80 ms, pointerup flushes without waiting, and a newer request aborts the
one in flight; EditSession decides which answers count. Handle positions come
from the clamped value, so a handle stops at its limit instead of following
the cursor. Three of the four drag capabilities are live: edge offset,
sidewalk width, lane divider.
2. Road edge handles were drawn on the wrong side. offsetLine() offsets
counter-clockwise from the direction of travel and sidewalks use
`heading + (side === 'left' ? -90 : 90)`, so left is `tangent - 90`;
makeRoadHandles() placed the left handle at `tangent + 90`, over the right
kerb. Dragging the visually-left handle moved the right edge. Fixed on both
sides of the wire, with regression tests that name the sides geographically
rather than by axis sign.
3. Roads the junctions geometrically fill are now read-only. The 0.45 cap per
reserve made the existing `unavailable` branch unreachable, so a 14.5 m stub
between two junctions was offered a 1.5 m editable band with no room for the
transitions a road-interval constraint needs. Greying only affects the
manifest: constraints already saved against such a road keep being solved, so
the geometry output is unchanged and the fixture baselines do not move.
Range handles are built and unit-tested but hidden behind
`intervalEditingSupported`: compileGeometry() reads neither profile.interval nor
profile.transitions, so every edit applies to the whole road and the control
would have had no effect. Recorded in research/interval-not-applied.md, which
also blocks one PRD acceptance criterion.
The ol-ext probe stays in the tree as a manual harness; ol-ext is still not a
dependency.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Steps 1-3 of the main map road interval editor.
EditSession keeps the command stack, undo/redo and previewSeq arbitration as
pure logic with no OpenLayers reference, so all of it is unit-tested in node.
Pointer displacement converts to meters through EPSG:4326 and spherical
distance: treating a 3857 delta as meters desyncs the geometry from the cursor
by 1/cos(latitude). Handle drags project onto the axis the manifest declares
and clamp to its range, so the client never writes a coordinate into a road
polygon.
All of it sits behind a directEdit flag that defaults to off. With the flag off
the workbench requests no manifest, creates no extra source and registers no
interaction, so behaviour matches main.
The ol-ext probe passed its three gates but is not adopted for road handles.
Transform translates by the raw pointer delta, so a handle detaches from its
clamped constraint value: a drag reading -24.1 m produced a draft of -5.4 m.
Production needs the handle position derived from the constraint instead, which
means owning the position update, so native OL PointerInteraction will carry
the drag. ol-ext stays out of package.json; the probe is kept as a manual
harness. Reserve handles are unreachable with the current solver, recorded in
research/ rather than worked around.
Also names the dead backend when an API response is empty, instead of
surfacing "Unexpected end of JSON input" from response.json().
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds resolveDirectEditConstraints between compileRoadModel and
compileGeometry, per the parent design's data flow. The stage is an
identity transform until the individual constraint kinds land: it
returns empty road profiles, junction plans and handle manifest, so
compileGeometry's geometry code is untouched and output stays
byte-identical.
Constraint planning is separated from solving up front. Only `exact`
and `recheck` constraints may reach the solver; `disabled`,
`pending`, `conflicted` and `stale` are reported as unapplied with a
reason. SOLVED_KINDS starts empty and grows one entry per kind, so a
partially delivered solver reports what it skipped instead of
publishing half-solved geometry.
diagnostic() moves to src/compile/diagnostics.js so the solver can
share the compiler's diagnostic shape without depending on fs, which
would break the pure-function boundary that lets preview, the full
compile and the CLI export share one implementation.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Planning: parent design.md becomes the single authoritative contract
(constraint model with 6 kinds, handle manifest, coordinate/unit
layering, preview sequencing, storage layout and lazy migration, area
config snapshot, API contract). Work is split into four independently
verifiable child tasks with per-step gates and rollback points.
Test infra: pin vitest 4.1.11, add test:client:unit for client pure
logic, extend prettier globs to root *.ts so vitest.config.ts is checked.
Add .gitignore: the repo had none, so inputs/, outputs/, workbench-data/
and the client build output were untracked rather than ignored.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>