From db904d3194a6b22832802f877aa944236f462159 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 9 Sep 2026 11:08:16 +0800 Subject: [PATCH] chore(junction): type facility provenance --- workbench/client/src/junction/structure.test.ts | 11 +++++++++++ workbench/client/src/types/state.ts | 2 ++ 2 files changed, 13 insertions(+) diff --git a/workbench/client/src/junction/structure.test.ts b/workbench/client/src/junction/structure.test.ts index 2d5570a..a335e5b 100644 --- a/workbench/client/src/junction/structure.test.ts +++ b/workbench/client/src/junction/structure.test.ts @@ -22,6 +22,10 @@ const structure: JunctionStructure = { corners: [{ key: 'corner:a', label: '角部 A', fromArmKey: 'arm:a', toArmKey: 'arm:b' }], facilities: [{ key: 'crossing:a', label: '过街 A', kind: 'crossing' }], }; +structure.facilities[0].provenance = { + facilityEvidence: 'source-crossing-node', + crossingNodeIds: ['crossing-node-a'], +}; const feature = (object: string, junction = 'cluster:a', arm?: string): GeoFeature => ({ type: 'Feature', properties: { junction_key: junction, object_key: object, arm_key: arm }, @@ -98,6 +102,13 @@ describe('authoritative junction structures', () => { expect(junctionObjectFeatures(state, structure, 'deleted')).toEqual([]); }); + it('keeps facility evidence available to scoped structure consumers', () => { + expect(structure.facilities[0].provenance).toEqual({ + facilityEvidence: 'source-crossing-node', + crossingNodeIds: ['crossing-node-a'], + }); + }); + it('scopes the canvas and preview using cluster ownership, retaining core features without node IDs', () => { const descriptor = junctionDescriptors(state).find((item) => item.ref.type === 'cluster')!; expect(descriptor.status).toBe('readonly'); diff --git a/workbench/client/src/types/state.ts b/workbench/client/src/types/state.ts index 526fba0..e7d258a 100644 --- a/workbench/client/src/types/state.ts +++ b/workbench/client/src/types/state.ts @@ -96,6 +96,8 @@ export interface JunctionProvenance { carriagewayKeys?: string[]; armKeys?: string[]; featureIds?: string[]; + facilityEvidence?: 'source-crossing-node' | 'inferred-road-envelope' | 'source-osm-region' | string; + crossingNodeIds?: string[]; } export interface JunctionSource extends JunctionProvenance { nodeIds: string[];