From 9d632e1f5d0b4e13fe03d06ba0fa59d9b01e8eb0 Mon Sep 17 00:00:00 2001 From: seoJing Date: Thu, 11 Jun 2026 14:45:07 +0900 Subject: [PATCH] fix: respect simulation projection tail window --- src/entities/spot/sim-stream-types.ts | 5 +++++ src/features/simulation/model/use-sim-run.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/entities/spot/sim-stream-types.ts b/src/entities/spot/sim-stream-types.ts index c53c016..ea46052 100644 --- a/src/entities/spot/sim-stream-types.ts +++ b/src/entities/spot/sim-stream-types.ts @@ -24,6 +24,11 @@ export type SimMapAnchor = { category?: string; confidence?: number; match_reason?: string; + /** Actual/public POI anchor metadata when provided by contextBuilder. */ + poi_id?: string; + poi_name?: string; + poi_category?: string; + address?: string | null; }; export type SimHotspotSignal = { diff --git a/src/features/simulation/model/use-sim-run.ts b/src/features/simulation/model/use-sim-run.ts index 0afac9c..2f00882 100644 --- a/src/features/simulation/model/use-sim-run.ts +++ b/src/features/simulation/model/use-sim-run.ts @@ -107,9 +107,16 @@ function loopPeriodTicks(manifest: SimManifest): number { } function dataWindowTicks(manifest: SimManifest): number { + const loopPeriod = loopPeriodTicks(manifest); + const declaredMaxProjected = manifest.max_projected_tick; + const tailMaxProjected = + manifest.projection_tail_ticks != null + ? loopPeriod + manifest.projection_tail_ticks - 1 + : null; return Math.max( manifest.total_ticks, - (manifest.max_projected_tick ?? manifest.total_ticks - 1) + 1, + (declaredMaxProjected ?? manifest.total_ticks - 1) + 1, + tailMaxProjected != null ? tailMaxProjected + 1 : 0, ); }