fix: keep SGS hall fallback metadata preview-only

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
lyf
2026-06-30 01:12:59 +08:00
parent c06d309e08
commit 4a8284a29d
2 changed files with 25 additions and 23 deletions

View File

@@ -1,10 +1,10 @@
# Task 2 Report # Task 2 Report
Status: DONE_WITH_CONCERNS Status: DONE
Files changed: Files changed:
- `src/data/adapters/sgsSdkGuideAdapter.ts` - `src/data/adapters/sgsSdkGuideAdapter.ts`
- `src/domain/museum.ts` - `.superpowers/sdd/task-2-report.md`
Commands run: Commands run:
- `node scripts/check-sgs-hall-poi-adapter.mjs` - `node scripts/check-sgs-hall-poi-adapter.mjs`
@@ -12,16 +12,12 @@ Commands run:
- `pnpm type-check` - `pnpm type-check`
- Output summary: `vue-tsc --noEmit` completed successfully. - Output summary: `vue-tsc --noEmit` completed successfully.
Commits created: Commit:
- `08a6bcb` in implementer worktree: `feat: expand SGS hall POI adaptation` - Pending in current worktree at report update time.
- Main workspace integrated manually because cherry-pick was blocked by existing local changes to the same files.
Self-review notes: Notes:
- Adapter now includes public exhibition-space whitelist and keyword checks. - POI-level `sourcePlaceId` now remains unset for space-center fallback halls; entrance-specific `sourcePlaceId`/`routeNodeId` stay on `entrances` until a route-capable entrance upgrades the POI.
- `toMuseumHallPoisFromSgs` now supports entrance anchors, space-center fallback, standalone space fallback, and diagnostics helper. - Space-center fallback halls now use matched-space floor metadata; route-capable entrance upgrades replace POI floor metadata with entrance floor metadata and set `sourceConfidence` to `backend-sgs-sdk-hall-entrance`.
- Main integration preserves stronger Task 1 semantics approved by user: `backend-sgs-sdk-hall-entrance` requires both entrance coordinates and route node, and later real entrance anchors can upgrade a space-center POI.
- `src/domain/museum.ts` already had/keeps typed hall fields (`MuseumPoiKind`, `MuseumPoiEntrance`, hall/source fields, preview fields) required by adapter output.
Concerns: Concerns:
- Manual integration was required because the main workspace already had overlapping uncommitted changes in adapter/domain files. - The targeted smoke script is a lightweight regression harness, not a full test runner.
- Task 3 will add repository diagnostics consumption of `createSgsHallPoiDiagnostics`.

View File

@@ -393,6 +393,7 @@ const createHallEntrance = (
) => { ) => {
const floorId = stringifyId(place.floorId) || fallbackFloorId const floorId = stringifyId(place.floorId) || fallbackFloorId
const placeId = stringifyId(place.id || place.nodeId) const placeId = stringifyId(place.id || place.nodeId)
const routeNodeId = stringifyId(place.nodeId) || undefined
return { return {
id: placeId ? `hall-entrance-${placeId}` : `hall-entrance-${floorId}-${normalizedHallName(place.name)}`, id: placeId ? `hall-entrance-${placeId}` : `hall-entrance-${floorId}-${normalizedHallName(place.name)}`,
@@ -400,9 +401,9 @@ const createHallEntrance = (
floorId, floorId,
floorLabel: floorLabelForSgs(floorId, floors, place.floorCode, place.floorName), floorLabel: floorLabelForSgs(floorId, floors, place.floorCode, place.floorName),
positionGltf: normalizePlacePosition(place), positionGltf: normalizePlacePosition(place),
sourceObjectName: stringifyId(place.nodeId) || undefined, sourceObjectName: routeNodeId || undefined,
sourcePlaceId: placeId || undefined, sourcePlaceId: routeNodeId ? placeId || undefined : undefined,
routeNodeId: stringifyId(place.nodeId) || undefined routeNodeId
} }
} }
@@ -469,7 +470,13 @@ export const toMuseumHallPoisFromSgs = (
const entrance = createHallEntrance(place, floors, fallbackFloorId) const entrance = createHallEntrance(place, floors, fallbackFloorId)
const entranceHasRouteAnchor = Boolean(entrance.positionGltf && entrance.routeNodeId) const entranceHasRouteAnchor = Boolean(entrance.positionGltf && entrance.routeNodeId)
const fallbackPosition = matchedSpace ? normalizeSpaceCenter(matchedSpace) : undefined const fallbackPosition = matchedSpace ? normalizeSpaceCenter(matchedSpace) : undefined
const floorId = entrance.floorId || stringifyId(matchedSpace?.floorId) || fallbackFloorId const fallbackFloorIdForPoi = stringifyId(matchedSpace?.floorId) || entrance.floorId || fallbackFloorId
const fallbackFloorLabel = floorLabelForSgs(
fallbackFloorIdForPoi,
floors,
matchedSpace?.floorCode,
matchedSpace?.floorName || matchedSpace?.name
)
const hallId = stringifyId(matchedSpace?.id) || undefined const hallId = stringifyId(matchedSpace?.id) || undefined
const poiId = createHallPoiId(matchedSpace, place, index) const poiId = createHallPoiId(matchedSpace, place, index)
const hallName = normalizedText(matchedSpace?.name) || placeHallName(place) || entrance.name const hallName = normalizedText(matchedSpace?.name) || placeHallName(place) || entrance.name
@@ -482,7 +489,7 @@ export const toMuseumHallPoisFromSgs = (
] ]
if (entranceHasRouteAnchor) { if (entranceHasRouteAnchor) {
existing.positionGltf = entrance.positionGltf existing.positionGltf = entrance.positionGltf
existing.floorId = floorId existing.floorId = entrance.floorId
existing.floorLabel = entrance.floorLabel existing.floorLabel = entrance.floorLabel
existing.sourceObjectName = entrance.sourceObjectName existing.sourceObjectName = entrance.sourceObjectName
existing.sourcePlaceId = entrance.sourcePlaceId existing.sourcePlaceId = entrance.sourcePlaceId
@@ -492,10 +499,9 @@ export const toMuseumHallPoisFromSgs = (
if (!existing.positionGltf && fallbackPosition) { if (!existing.positionGltf && fallbackPosition) {
existing.positionGltf = fallbackPosition existing.positionGltf = fallbackPosition
existing.floorId = floorId existing.floorId = fallbackFloorIdForPoi
existing.floorLabel = entrance.floorLabel existing.floorLabel = fallbackFloorLabel
existing.sourceObjectName = matchedSpace?.sourceNodeName || undefined existing.sourceObjectName = matchedSpace?.sourceNodeName || undefined
existing.sourcePlaceId = entrance.sourcePlaceId
existing.sourceConfidence = 'backend-sgs-sdk-space-center' existing.sourceConfidence = 'backend-sgs-sdk-space-center'
} }
return return
@@ -507,8 +513,8 @@ export const toMuseumHallPoisFromSgs = (
halls.set(poiId, { halls.set(poiId, {
id: poiId, id: poiId,
name: hallName, name: hallName,
floorId, floorId: entranceHasRouteAnchor ? entrance.floorId : fallbackFloorIdForPoi,
floorLabel: entrance.floorLabel, floorLabel: entranceHasRouteAnchor ? entrance.floorLabel : fallbackFloorLabel,
primaryCategory: hallCategory, primaryCategory: hallCategory,
categories: [ categories: [
hallCategory, hallCategory,
@@ -527,7 +533,7 @@ export const toMuseumHallPoisFromSgs = (
hallId, hallId,
hallName, hallName,
spaceId: hallId, spaceId: hallId,
sourcePlaceId: entrance.sourcePlaceId, sourcePlaceId: entranceHasRouteAnchor ? entrance.sourcePlaceId : undefined,
sourceSpaceId: hallId, sourceSpaceId: hallId,
entrances: [entrance] entrances: [entrance]
}) })