Commit Graph
112 Commits
Author SHA1 Message Date
que01 a37c707188 feat(junction): validate entry ring geometry 2026-09-09 14:09:44 +08:00
que01 2f627df232 refactor(junction): share canonical entry rings 2026-09-09 13:55:52 +08:00
que01 57530016f7 feat(junction): publish transition status in manifest 2026-09-09 12:23:56 +08:00
que01 a22319a149 fix(junction): protect entry surfaces from exclusion regions 2026-09-09 12:01:16 +08:00
que01 6c7d81df35 fix(junction): diagnose unsupported entry transitions 2026-09-09 11:53:53 +08:00
que01 b1fd54f0f8 feat(junction): expose entry transition feasibility 2026-09-09 11:47:05 +08:00
que01 e5d805a369 fix(junction): reject collapsed core boundary edges 2026-09-09 11:44:51 +08:00
que01 0e162d1f43 feat(junction): project sourced islands 2026-09-09 10:54:45 +08:00
que01 cd3a9c9613 fix(junction): trim complex preview lanes 2026-09-09 10:33:24 +08:00
que01 4e7274ec61 fix(junction): bound complex cutback transitions 2026-09-09 10:28:55 +08:00
que01 280b726c6f feat(junction): taper complex carriageway edits 2026-09-09 10:24:57 +08:00
que01 d353b48a0b fix(junction): anchor controls to sourced crossings 2026-09-09 10:21:26 +08:00
que01 a98d170757 fix(junction): align complex crossing handles 2026-09-09 10:20:01 +08:00
que01 48fd432266 feat(junction): place sourced complex crossings 2026-09-09 10:15:33 +08:00
que01 d49cdab40a feat(junction): mark complex crossing evidence 2026-09-09 10:13:25 +08:00
que01 c14b8b09f2 feat(junction): publish sourced traffic islands 2026-09-09 10:05:43 +08:00
que01 3bf2edaf99 fix(junction): reject overlapping exclusion cores 2026-09-09 10:00:32 +08:00
que01 4b8f37a219 feat(junction): preserve known traffic island regions 2026-09-09 09:43:55 +08:00
que01 b6f4dfeb0c fix(junction): omit unsupported corner facilities 2026-09-09 09:23:58 +08:00
que01 f56c0978b0 refactor(junction): keep edit metrics pure 2026-09-09 09:17:52 +08:00
que01 88d8b841e5 feat(junction): close verified complex cores 2026-09-09 09:15:58 +08:00
que01 b4abfdb870 feat(junction): derive complex approach boundary sections 2026-09-08 18:02:24 +08:00
que01 4de971ce68 fix(junction): align complex boundary trims 2026-09-08 17:57:03 +08:00
que01 a12e2ac823 feat(junction): share complex topology build plan 2026-09-08 17:47:35 +08:00
que01 855400fba2 fix(junction): keep complex carriageways connected 2026-09-08 17:16:51 +08:00
que01 53a2cb3450 fix(junction): make complex corner radius responsive 2026-09-08 17:06:05 +08:00
que01 49a44fdf73 feat(junction): edit complex crossing facilities 2026-09-08 15:05:00 +08:00
que01 80f122be46 feat(junction): edit complex cutbacks and corners 2026-09-08 14:30:43 +08:00
que01 c4bcbe8ff9 feat(junction): enable complex carriageway width editing 2026-09-08 12:09:44 +08:00
que01 0a5a229ce3 feat(junction): establish stable complex junction structure 2026-09-08 11:25:57 +08:00
que01 0065c3eaec feat(junction): project advanced facilities and associations 2026-09-07 17:12:29 +08:00
que01 fc7fe81eff feat(junction): expose stage1 structure and standards panel 2026-09-07 14:52:06 +08:00
que01 61cf276745 feat(junction): add structure and standards contract 2026-09-07 14:11:44 +08:00
que01 a359f88edc feat(junction): classify complex junction shapes 2026-09-07 10:52:12 +08:00
que01 f10a5da325 feat(workbench): stabilize junction tools workspace 2026-09-04 09:46:19 +08:00
que01 f6f51fe90b feat(compile): expose effective junction plans 2026-09-03 11:44:26 +08:00
que01 31552a5b6f feat(workbench): drag control markings as elements 2026-09-02 16:04:38 +08:00
que01 c804a373ca feat(workbench): unify lane maneuver edits in v2 2026-09-01 16:46:22 +08:00
que01 0318876e6a fix(compile): validate direct edit constraint ranges 2026-09-01 14:28:24 +08:00
que01 9cb715a592 feat: drag lane turn arrows along their lanes 2026-09-01 10:24:59 +08:00
que01andClaude Opus 5 335c8ea68a feat: override which turn arrow a lane shows
The arrow on a lane came from the OSM turn:lanes tag with no way to change it,
and a lane the tag skipped got no arrow at all. lane-maneuver is a v1 override
that sets it.

v1 rather than a v2 constraint, because "which arrow" is a discrete attribute of
a lane with no station to anchor to, while every v2 anchor is positional. The
existing road override already covers OSM-derived values this way — laneCount,
width, sidewalks — and this is the same kind of thing. Arrow *placement* is the
positional half and stays out; it also still has an open question about whether
a group is a lane or a single arrow.

Three behaviours, each measured against compiled output: an override replaces
the tag's maneuver, it adds arrows to a lane the tag never marked, and '' removes
one the tag asked for. The empty string is therefore distinguished from "no
override" rather than falling through to the tag. An empty override set leaves
the arrows byte-identical and the fixtures untouched.

Validation lists the accepted maneuvers and rejects anything else, including
correctly-spelled components in the wrong order. It cannot be left to
normalizeManeuver(), which returns unrecognised input unchanged — a typo would
otherwise reach the template lookup and silently produce no arrow.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 18:00:53 +08:00
que01andClaude Opus 5 f3924caa5c feat: make crosswalk size a constraint the geometry stage reads
Every zebra was six stripes at 3m by 0.45m on a 0.9m pitch, all literals. Depth
and stripe count are now a constraint, junction-crosswalk-size, and the loop
reads them.

The span across the road stays derived rather than stored: it is count times
pitch, and pitch is fixed because stripe and gap widths are standardised while
the road they cross is not. Widening a crossing means adding stripes, which is
what a real one does, and it is why the span quantises in 0.9m steps.

That also fixes a span pinned at 4.95m regardless of the street. Measured, every
crossing sat on a 6.50m carriageway and covered under four fifths of it. The
default now follows the segment width — both directions, since a crossing spans
the carriageway — giving eight stripes and 6.74m, reaching the kerb rather than
stopping short. Fixture baselines move for exactly two entries on the one area
with crossings; the area without them is untouched.

No handle is published yet. design.md requires proving compileGeometry() consumes
a parameter before any grip is drawn — the rule left over from profile.interval
shipping a handle that did nothing — so the grips come next, on a value already
known to work.

Adding the kind made the client's exhaustive scalar switch fail to compile, which
is the check working: size is a pair and has no dragged-scalar form, so that case
now says so and throws rather than writing half a value.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 17:10:45 +08:00
que01andClaude Opus 5 479ffd00ed fix: publish the crosswalk inset ceiling that actually moves the zebra
Every junction-crosswalk-inset handle advertised max 8. Sweeping the real
response across eight groups, the ceiling ran 1.0 to 4.5 and varied per
approach, so 44-88% of the declared range moved nothing and returned no
diagnostic. Two approaches had a ceiling at or below the 1.5 default, meaning
dragging outward there did nothing at all — which is what made direct editing
look broken rather than limited.

crossingJunctionInset() stops responding once the inset reaches the cutback, and
sooner still when the crossing sits beyond the 4m cap, giving
cutback - max(0, junctionDistance - 4). Predicted ceilings matched all eight
measurements within the 0.5m sweep step, and the published max now matches them
8/8 where it used to be a flat 8.

The distance needs to know which crossing an approach serves, which lived only
inside compileControlMarkings(). crossing-approach.js now holds that rule at road
level, which is model-only and so usable from the solver. Behaviour is
unchanged: every lane of a road shares its junction distance, so the compiler's
(road, lane) ordering already grouped by road — fixtures confirm the geometry is
byte-identical.

Both directional roads of a segment can meet at one junction serving different
crossings; taking the first match published one road's ceiling on the other's
handle. The road that ends at this node wins, which is the same rule the client
uses to find the handle and the same one crossingJunctionInset() applies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 15:00:08 +08:00
que01 11f4d748a7 fix: expose and apply control marking handles 2026-08-28 17:45:03 +08:00
que01andClaude Opus 5 7c45c21f8c feat: drag crosswalk and stop-line offsets on the map
Handles for the two control-marking kinds, completing what step 1 made solvable.
They drag along the approach tangent and reuse the whole existing chain — hit
test, projection, clamp, ghost, debounce, arbitration, preview, save, undo —
without changes to any of it. That reuse is the point of having modelled edits as
kind + anchor + axis + value.

Ownership: design.md gives junction reserve interiors to JunctionTools, but that
rule is about junction *shape* — width, cutback, corner. Placement of the zebra
and the stop line is offered nowhere else, so the main map takes it. A segment
selection therefore returns its cross-section handles plus the control markings
at its ends, and shape kinds stay out so the two editors never offer the same
edit. The test that asserted "road kinds only" now states this rule instead.

The default placements move to the solver, which owns the editable bounds and is
the module a test keeps free of fs/path; native-road.js imports them rather than
the reverse, so the IO-free property survives.

Deliberately not done: the handle-target generalisation this task's PRD listed as
step 2. These kinds persist exactly like the existing junction constraints, so
there is no second write target to abstract over yet. Building the discriminator
now would be designing for one hypothetical case; the signal pose work will
provide the real second case.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 16:58:31 +08:00
que01andClaude Opus 5 c7425f5ed4 feat: make crosswalk and stop-line offsets solvable
Step 1 of the control-marking task, and deliberately server-only: no handle is
drawn yet. This project already shipped a range handle for `profile.interval`,
which compileGeometry ignores, so the control dragged and changed nothing. The
consumer comes first now.

Two kinds join the taxonomy — `junction-crosswalk-inset` and
`junction-stop-line-offset`, both on the existing `junction-approach` anchor. The
solver writes them onto the approach entry, `applyDirectJunctionPlans` carries
them onto the compiled approach, and `compileControlMarkings` reads them in place
of the module constants it used for every junction. They move markings without
reshaping the junction, so unlike width and cutback they deliberately do not
trigger a boundary recompute.

`applyJunctionConstraint` becomes an explicit switch. Its trailing `else` had
meant every kind that was not approach-width fell through to the cutback
validator, so a new kind would have been silently validated and written as a
cutback. The same non-exhaustive shape in the test fixture's `valueFor` is fixed
the same way, and now throws for an unnamed kind rather than answering with a
corner radius.

design.md's taxonomy is updated with it — a test asserts the two cannot drift,
which is what caught the omission.

Measured on a 41-road workspace with 8 crossings: both constraints change their
marking geometry, neither drags the other, and out-of-range blocks instead of
clamping. That measurement is not in the suite: the synthetic junction resolves
`junction_inset_m` to 0 because its crossing never binds to a plan, and the
committed OSM fixture has no crossings at all. The tests assert the wiring the
handles will depend on — values reaching the approach entry, distinct branches,
blocking diagnostics — and the gap is recorded in the test itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 15:01:36 +08:00
que01andClaude Opus 5 5292c00926 feat: scope the handle manifest and re-aim the ghost
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>
2026-08-28 12:26:15 +08:00
que01andClaude Opus 5 d893e406d6 perf: stop recomputing control bounds in overlap tests
compileGeometry took 1575 ms on a 41-road area and grew superlinearly — 6x the
time for 2x the roads — while feature count grew linearly. Profiling put 84% of
it in three adjacent lines: `bounds` alone was 821 ms, `ringsOverlap` 258 ms, and
the intermediate arrays cost another 163 ms of GC.

The callers walk every lane in 0.25 m steps and test each step's rectangle
against every control feature, which is millions of calls on a small area. Each
one recomputed the control's bounding box from scratch through four
`Math.min(...ring.map(...))` spreads, allocating four arrays per call for a box
that never changes.

Control rings are the same array objects for the whole compile, so their bounds
are now computed once into a WeakMap, candidate bounds are taken in a single
allocation-free pass, and the cheap rejection moved up into `ringsOverlapControl`
so the exact test only runs for boxes that actually touch.

1575 ms -> 104 ms, and the per-road cost is flat instead of rising, so this now
extends to city-scale areas rather than degrading quadratically. Output is
unchanged, which the fixture baselines prove.

Found because a preview felt slow to drag. The measurement mattered more than the
reading did: the nested `model.roads.find()` calls that looked like the culprit
were not, and building the scoped-compile architecture first would have left this
untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 11:41:39 +08:00
que01andClaude Opus 5 92297270f1 feat: drag road handles with ghost and server preview
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>
2026-08-27 17:38:34 +08:00
que01 735ce69d26 feat: classify direct edit replay states 2026-08-27 12:43:35 +08:00