fix: clip complex junction lane separators

This commit is contained in:
que01 committed 2026-09-29 09:23:26 +08:00
1 parent 05614d1a69
commit 1842eb7d8c
8 files changed
+222 -3

No files matched your search

@@ -0,0 +1,2 @@
{"file":".trellis/tasks/09-23-complex-junction-interior-line/prd.md","reason":"Acceptance criteria cover the white-line screenshot regression and ordinary-marking compatibility."}
{"file":".trellis/tasks/09-23-complex-junction-interior-line/design.md","reason":"Provides the data-flow and compatibility checks for review."}
@@ -0,0 +1,41 @@
# Design
## Boundary
The compiler must publish complex-junction white road markings only on the
approach side of the first generated crosswalk or stop line. The central
junction pavement and zebra crossing remain free of those markings.
## Data Flow
1. Complex junction templates produce approach lane preview lines and control
polygons (`crosswalks` and `stopLines`).
2. `compileComplexLaneSeparators` derives white lane-separator geometry from
preview lanes. This is the layer shown by the screenshot.
3. `compileCenterLines` derives center-line marking geometry from the trimmed
bidirectional approach line.
4. Both paths use `trimLineBeforeFirstControl`; complex lines must first be
oriented from the exterior toward the cluster center, then restored to their
published direction.
## Implementation Shape
Reuse the existing center-aware `trimLaneOutsideControls` behavior (or extract
its orientation step into a small shared helper) for complex preview and center
lines. For complex lane separators, also trim against the stable published
approach/core boundary so a control polygon that ends short of the core cannot
leave an interior tail. Ordinary roads keep the existing behavior. All cutoffs
remain driven by published geometry, with no cluster-specific coordinates.
## Compatibility
- Preserve feature identities, styles, source road IDs, and signal layers.
- Do not change connector or lane-solving coordinates; only published marking
geometry is clipped.
- Ordinary-junction trimming remains unchanged.
## Risks
If the first control polygon is malformed or absent, the existing full-line
fallback remains in place. Tests must cover both line orientations so a future
OSM way direction cannot reintroduce the bug.
@@ -0,0 +1,2 @@
{"file":".trellis/tasks/09-23-complex-junction-interior-line/design.md","reason":"Defines the center-aware clipping contract for complex white markings."}
{"file":".trellis/tasks/09-23-complex-junction-interior-line/implement.md","reason":"Lists the ordered implementation and validation work."}
@@ -0,0 +1,27 @@
# Implementation Plan
1. Add a focused geometry regression for the `8005332807` complex cluster that
identifies white marking features and asserts their published geometry does
not overlap generated crosswalk/stop-line controls or the interior side of
the approach boundary.
2. Update complex center-line and preview lane-separator trimming to orient by
cluster center before applying the first-control cutoff.
3. Add an opposite-direction synthetic/control assertion proving ordinary
junction markings retain their current behavior.
4. Run focused junction marking tests, then the full test suite and diff checks.
## Validation
- `node test/junction-corridor-markings.js`
- `node test/junction-marking-containment.js`
- `node test/junction-layer-seams.js`
- `npm test`
- `git diff --check`
## Risky Files
- `src/compile/native-road.js`
- `test/junction-corridor-markings.js` or the closest existing geometry test
Do not update fixture baselines unless the final behavior change is reviewed
and explicitly intended.
@@ -0,0 +1,64 @@
# Fix Complex Junction Interior Line for cluster-8005332807
## Goal
Prevent a white lane marking from crossing the zebra crossing and extending into
the interior of a complex junction. The visible result must match the user's
screenshot for `cluster-8005332807` and must not regress ordinary-junction
markings.
## Confirmed Facts
- The reported line is white in the workbench screenshot, so it is a road
marking layer rather than the dark/magenta signal or connector overlays.
- The affected geometry is in the complex-junction cluster containing node
`8005332807`; the screenshot shows the marking continuing inward past a
zebra crossing toward the central pavement region.
- Complex lane separators are generated separately from ordinary road
separators in `src/compile/native-road.js` and are expected to stop at
complex-junction controls and boundaries.
- `trimLineBeforeFirstControl` assumes its input starts at the exterior and
proceeds toward the junction. Complex preview/center lines can be supplied
in the opposite direction, so the current code can preserve the interior
segment instead of the approach segment.
- The screenshot's white line is specifically published as
`native-road-complex-lane-separator/v1` by `compileComplexLaneSeparators`,
not as a signal or center-line overlay. That path clips against controls but
does not independently enforce the complex core boundary.
- Existing worktree changes are unrelated user work and must be preserved.
## Requirements
- R1. In a complex-junction view, the affected white lane marking must stop
before it crosses the zebra crossing or enters the configured junction
interior region.
- R2. The fix must be derived from the actual complex-junction geometry,
crossing controls, or their stable published boundary, not from a
cluster-specific coordinate or screenshot-only special case.
- R3. Lane markings outside the affected complex-junction segment, including
ordinary-junction markings, must remain unchanged.
- R4. Add a regression covering `cluster-8005332807` and a control case proving
ordinary-junction marking generation remains unchanged.
## Technical Decision
Orient complex marking lines by distance from the cluster center before
applying the existing first-control trim, then enforce the published complex
approach/core boundary before restoring their original direction. This keeps
the fix geometry-driven and leaves ordinary road trimming untouched.
## Acceptance Criteria
- [ ] The reported white marking no longer crosses the zebra crossing or
enters the complex-junction interior in the workbench image.
- [ ] No affected white marking segment published for the complex cluster lies
inside its configured crossing/interior boundary; geometry remains finite
and stable.
- [ ] Existing signal, marking, and complex-junction behavior remains intact,
including the affected real OSM fixture.
## Scope Boundary
- In scope: complex-junction white lane-marking geometry and its regression.
- Out of scope: traffic-signal phase logic, OSM source editing, free signal
creation/deletion, vehicle simulation, and unrelated road or island geometry.
@@ -0,0 +1,26 @@
{
"id": "complex-junction-interior-line",
"name": "complex-junction-interior-line",
"title": "Fix complex junction interior line for cluster-8005332807",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "dingkang",
"assignee": "dingkang",
"createdAt": "2026-09-23",
"completedAt": null,
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}