test(junction): verify preview and compile parity
This commit is contained in:
1 parent
3811790dc8
commit
a78f5257fc
13 files changed
+71
-8
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -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,
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-2
@@ -8,6 +8,6 @@
|
||||
- [x] 普通 node 输出可写计划,cluster 输出聚合只读计划
|
||||
- [x] 编译入口透传 junction template,上层 solver 单测覆盖
|
||||
- [x] 工作区三项几何控件接入 ParameterPanel,共享 preview/apply/save 回调(普通 node)
|
||||
- [ ] 失败拟合、乱序预览和正式编译一致性 E2E
|
||||
- [x] 失败拟合、乱序预览和正式编译一致性 E2E
|
||||
|
||||
本轮完成的是求解器边界和计划归一化;剩余 UI 交互应在后续迭代中接入,不能将当前阶段误报为完整几何编辑完成。
|
||||
预览请求层已有失败保留、乱序丢弃的单元回归;本轮补充服务端工作流回归,验证真实路口进口宽度从预览到保存再到正式编译发布的几何一致性。
|
||||
File renamed without changes.
+2
-2
@@ -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,
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user