diff --git a/.trellis/spec/backend/direct-edit-api.md b/.trellis/spec/backend/direct-edit-api.md index f0c1e13..2b3f445 100644 --- a/.trellis/spec/backend/direct-edit-api.md +++ b/.trellis/spec/backend/direct-edit-api.md @@ -334,6 +334,10 @@ then `structureFromTopology(topology, shape, center, features)`. Projection is object. A selected editable cluster publishes its external carriageway, corner, and stop-line handles. It publishes `cluster-crossing-inset` only for an arm with a matching OSM crossing node. +- A selected cluster that cannot project an authoritative `junctionStructure` + returns an empty scoped handle list from both edit state and preview. The API + must not advertise controls for an object the workbench cannot identify or + render as an editable structure. - A cluster carriageway anchor contains `clusterId`, stable `carriagewayKey`, `sourceNodeIds`, and `sourceRoadIds`. Replay matches all source identity; a missing or changed source is stale with `anchor-missing`. diff --git a/.trellis/tasks/09-08-junction-reference-fidelity/implement.md b/.trellis/tasks/09-08-junction-reference-fidelity/implement.md index b54128d..501999e 100644 --- a/.trellis/tasks/09-08-junction-reference-fidelity/implement.md +++ b/.trellis/tasks/09-08-junction-reference-fidelity/implement.md @@ -92,6 +92,8 @@ complex-junction.js / native-road.js:构建与全部消费者;direct-edit-so 浏览器回归现逐项编辑接入位置、方向和左右边界,验证请求被应用且目标道路面实际变化,并逐项撤销;随后继续验证过渡长度保存、正式重编译和刷新重放。该证据覆盖当前真实工作台 fixture,第二类结构的浏览器闭环仍需在最终 A4 矩阵中补齐。 +第二真实候选审计发现一个两内部节点 cluster 会产生 solver 手柄但无法投影 `junctionStructure`。工作台状态与预览现统一隐藏此类无权威结构的手柄,并有 API 回归;该候选不再被错误计作第二类浏览器验收。A4 的第二类证据将使用具有完整结构投影的独立 3/4 臂 fixture。 + 本轮同时修复成功闭合且接缝合格的核心仍被误报为 `complex-junction-core-closure-unsupported` 的条件分支。npm test、191 项客户端单测、类型检查、生产构建、11 项 E2E、format:check 与 git diff --check 通过。区域邻接和排除区共同决定的更大向外边界仍留给区域级求解,不用固定范围冒充完整可行域。 本轮质量门:npm test 通过;npm run test:client 通过;npm run test:client:unit 15 文件/188 测试通过;npm run test:e2e(包含 production build)11 测试通过,包含保存后重置与放弃恢复;npm run format:check 与 git diff --check 通过。构建仍有既有 bundle 大小提示。遵循用户“整体任务完成再提交”,本轮未提交、未归档父任务。 diff --git a/test/workbench-edit-api.js b/test/workbench-edit-api.js index e09562e..bcc458a 100644 --- a/test/workbench-edit-api.js +++ b/test/workbench-edit-api.js @@ -598,7 +598,7 @@ assert.notDeepEqual( 'a cluster corner constraint must change its compiled corner geometry', ); const browsing = browseState(complexArea); -const unavailableStructureState = browseState({ +const unavailableStructureArea = { ...complexArea, nativeRoad: { ...complexArea.nativeRoad, @@ -610,8 +610,18 @@ const unavailableStructureState = browseState({ ], }, }, -}); +}; +const unavailableStructureState = browseState(unavailableStructureArea); assert.equal(unavailableStructureState.junctionStructures['cluster:not-compiled'], undefined); +const unavailableEditState = editState(unavailableStructureArea, selectionFrom({ cluster: 'not-compiled' })); +assert.equal(unavailableEditState.junctionStructure, null); +assert.deepEqual(unavailableEditState.handles.handles, []); +const unavailablePreview = editPreview(unavailableStructureArea, { + document: emptyDocument, + selection: { cluster: 'not-compiled' }, +}); +assert.equal(unavailablePreview.junctionStructure, null); +assert.deepEqual(unavailablePreview.handles.handles, []); assert.ok(browsing.standardsDiagnostics.length, 'browse state retains structure diagnostics'); assert.equal(new Set(browsing.standardsDiagnostics.map((item) => item.id)).size, browsing.standardsDiagnostics.length); assert.ok( diff --git a/workbench/server.js b/workbench/server.js index fadea65..c150263 100644 --- a/workbench/server.js +++ b/workbench/server.js @@ -411,6 +411,8 @@ function editState(area, selection = null) { }, trafficSignals: readJson(area.outputs.nativeTrafficSignals), }); + const handles = + selection?.type === 'cluster' && !junctionStructure ? { ...resolution.handles, handles: [] } : resolution.handles; return { active: true, areaId: area.id, @@ -419,7 +421,7 @@ function editState(area, selection = null) { document: directEdits, constraintStates: resolution.constraintStates, diagnostics: resolution.diagnostics, - handles: resolution.handles, + handles, junctionStructure, standardsProfile: { id: 'cn-urban-default', label: '中国城市道路(项目默认)' }, standardsDiagnostics: standardsDiagnostics(junctionStructure), @@ -466,6 +468,8 @@ function editPreview(area, body = {}) { }, trafficSignals: readJson(area.outputs.nativeTrafficSignals), }); + const handles = + selection?.type === 'cluster' && !junctionStructure ? { ...resolution.handles, handles: [] } : resolution.handles; const degraded = Date.now() - startedAt > 300; return { ok: true, @@ -475,7 +479,7 @@ function editPreview(area, body = {}) { documentVersion: activeEdits.documentVersion, constraintStates: resolution.constraintStates, diagnostics, - handles: resolution.handles, + handles, junctionStructure, standardsProfile: { id: 'cn-urban-default', label: '中国城市道路(项目默认)' }, standardsDiagnostics: standardsDiagnostics(junctionStructure),