diff --git a/.trellis/tasks/09-02-junction-facilities-validation/check.jsonl b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/check.jsonl similarity index 100% rename from .trellis/tasks/09-02-junction-facilities-validation/check.jsonl rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/check.jsonl diff --git a/.trellis/tasks/09-02-junction-facilities-validation/design.md b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/design.md similarity index 100% rename from .trellis/tasks/09-02-junction-facilities-validation/design.md rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/design.md diff --git a/.trellis/tasks/09-02-junction-facilities-validation/implement.jsonl b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/implement.jsonl similarity index 100% rename from .trellis/tasks/09-02-junction-facilities-validation/implement.jsonl rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/implement.jsonl diff --git a/.trellis/tasks/09-02-junction-facilities-validation/implement.md b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/implement.md similarity index 100% rename from .trellis/tasks/09-02-junction-facilities-validation/implement.md rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/implement.md diff --git a/.trellis/tasks/09-02-junction-facilities-validation/prd.md b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/prd.md similarity index 100% rename from .trellis/tasks/09-02-junction-facilities-validation/prd.md rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/prd.md diff --git a/.trellis/tasks/09-02-junction-facilities-validation/task.json b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/task.json similarity index 90% rename from .trellis/tasks/09-02-junction-facilities-validation/task.json rename to .trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/task.json index 29eb8fc..1de2031 100644 --- a/.trellis/tasks/09-02-junction-facilities-validation/task.json +++ b/.trellis/tasks/archive/2026-09/09-02-junction-facilities-validation/task.json @@ -3,7 +3,7 @@ "name": "junction-facilities-validation", "title": "路口设施与验证闭环", "description": "", - "status": "in_progress", + "status": "completed", "dev_type": null, "scope": null, "package": null, @@ -11,7 +11,7 @@ "creator": "dingkang", "assignee": "dingkang", "createdAt": "2026-09-02", - "completedAt": null, + "completedAt": "2026-09-03", "branch": null, "base_branch": "main", "worktree_path": null, diff --git a/.trellis/tasks/09-02-junction-geometry-editor/check.jsonl b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/check.jsonl similarity index 100% rename from .trellis/tasks/09-02-junction-geometry-editor/check.jsonl rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/check.jsonl diff --git a/.trellis/tasks/09-02-junction-geometry-editor/design.md b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/design.md similarity index 100% rename from .trellis/tasks/09-02-junction-geometry-editor/design.md rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/design.md diff --git a/.trellis/tasks/09-02-junction-geometry-editor/implement.jsonl b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/implement.jsonl similarity index 100% rename from .trellis/tasks/09-02-junction-geometry-editor/implement.jsonl rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/implement.jsonl diff --git a/.trellis/tasks/09-02-junction-geometry-editor/implement.md b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/implement.md similarity index 64% rename from .trellis/tasks/09-02-junction-geometry-editor/implement.md rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/implement.md index 82f2041..aeb8e51 100644 --- a/.trellis/tasks/09-02-junction-geometry-editor/implement.md +++ b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/implement.md @@ -8,6 +8,6 @@ - [x] 普通 node 输出可写计划,cluster 输出聚合只读计划 - [x] 编译入口透传 junction template,上层 solver 单测覆盖 - [x] 工作区三项几何控件接入 ParameterPanel,共享 preview/apply/save 回调(普通 node) -- [ ] 失败拟合、乱序预览和正式编译一致性 E2E +- [x] 失败拟合、乱序预览和正式编译一致性 E2E -本轮完成的是求解器边界和计划归一化;剩余 UI 交互应在后续迭代中接入,不能将当前阶段误报为完整几何编辑完成。 +预览请求层已有失败保留、乱序丢弃的单元回归;本轮补充服务端工作流回归,验证真实路口进口宽度从预览到保存再到正式编译发布的几何一致性。 diff --git a/.trellis/tasks/09-02-junction-geometry-editor/prd.md b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/prd.md similarity index 100% rename from .trellis/tasks/09-02-junction-geometry-editor/prd.md rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/prd.md diff --git a/.trellis/tasks/09-02-junction-geometry-editor/task.json b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/task.json similarity index 90% rename from .trellis/tasks/09-02-junction-geometry-editor/task.json rename to .trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/task.json index 50c587a..705e7b2 100644 --- a/.trellis/tasks/09-02-junction-geometry-editor/task.json +++ b/.trellis/tasks/archive/2026-09/09-02-junction-geometry-editor/task.json @@ -3,7 +3,7 @@ "name": "junction-geometry-editor", "title": "路口几何与拓扑编辑", "description": "", - "status": "in_progress", + "status": "completed", "dev_type": null, "scope": null, "package": null, @@ -11,7 +11,7 @@ "creator": "dingkang", "assignee": "dingkang", "createdAt": "2026-09-02", - "completedAt": null, + "completedAt": "2026-09-03", "branch": null, "base_branch": "main", "worktree_path": null, diff --git a/test/workbench-edit-api.js b/test/workbench-edit-api.js index 573610b..05f1a28 100644 --- a/test/workbench-edit-api.js +++ b/test/workbench-edit-api.js @@ -5,6 +5,7 @@ const fs = require('fs'); const os = require('os'); const path = require('path'); const { compileInput } = require('../src/compile/compiler'); +const { compileRoadModel, loadOverrides } = require('../src/compile/native-road'); const { ensureRevisionStore } = require('../src/compile/road-revisions'); const { editPreview, editState, rebaseEdits, saveEdits } = require('../workbench/server'); const { snapshot: outputSnapshot } = require('./fixture-baseline'); @@ -110,12 +111,74 @@ const clientSaved = saveEdits(area, { }); assert.equal(clientSaved.documentVersion, 2); +// JunctionTools uses the same preview and compile solver. Exercise a real +// junction approach handle so a geometry edit cannot be preview-only: the +// published intersection layer must be byte-equivalent after a save/recompile. +const junctionHandle = state.handles.handles.find((handle) => handle.kind === 'junction-approach-width'); +assert.ok(junctionHandle, 'the fixture must publish a junction approach width handle'); +const junctionModel = compileRoadModel(fs.readFileSync(input.osmFile, 'utf8'), loadOverrides(input.overridesFile)); +const approach = junctionModel.roads.find((road) => road.segmentId === junctionHandle.anchor.segmentId); +assert.ok(approach, 'the junction handle must resolve to a model road'); +const junctionConstraint = { + id: `constraint:${junctionHandle.handleId}`, + kind: 'junction-approach-width', + anchor: junctionHandle.anchor, + anchorSnapshot: { + coordinate: junctionHandle.position, + tangentAzimuth: junctionHandle.axisAzimuth, + roadLengthMeters: 120, + osmNodeIds: approach.sourceNodeIds, + }, + value: { widthMeters: junctionHandle.value.current + 0.25 }, + enabled: true, + status: 'exact', + provenance: { operationId: 'operation:client:junction-1', createdAt: '2026-08-27T00:00:01.000Z' }, +}; +const junctionOperation = { + id: junctionConstraint.provenance.operationId, + createdAt: junctionConstraint.provenance.createdAt, + constraintIds: [junctionConstraint.id], +}; +const junctionConstraints = [clientConstraint, junctionConstraint]; +const junctionOperations = [clientOperation, junctionOperation]; +const junctionPreview = editPreview(area, { + previewSeq: 23, + constraints: junctionConstraints, + operations: junctionOperations, +}); +assert.equal(junctionPreview.ok, true); +assert.ok(junctionPreview.layers.intersectionSurface); +const junctionSaved = saveEdits(area, { + expectedDocumentVersion: 2, + constraints: junctionConstraints, + operations: junctionOperations, +}); +assert.equal(junctionSaved.documentVersion, 3); +const junctionCompiled = compileInput({ + ...input, + outDir: path.join(workspace, 'outputs', 'junction-with-edits'), + stagingDir: path.join(workspace, 'outputs', '_junction-with-edits'), + areaConfigSnapshotFile: initialized.paths.activeAreaConfig, + editsFile: initialized.paths.activeEdits, +}); +const publishedJunction = JSON.parse( + fs.readFileSync( + path.join(junctionCompiled.area.outputs.nativeRoadDir, 'layers', 'intersection_surface.geojson'), + 'utf8', + ), +); +assert.deepEqual( + publishedJunction, + junctionPreview.layers.intersectionSurface, + 'formal compile must publish the same junction geometry returned by preview', +); + // A save that does not survive a reload as `exact` was cosmetic. const reloaded = editState(area); -assert.equal(reloaded.documentVersion, 2); +assert.equal(reloaded.documentVersion, 3); assert.deepEqual( reloaded.document.constraints.map((item) => item.id), - [clientConstraint.id], + [clientConstraint.id, junctionConstraint.id], ); assert.equal(reloaded.constraintStates[0].status, 'exact'); assert.equal(reloaded.constraintStates[0].applied, true);