mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-02 01:00:46 +00:00
The hand-off from setWindEstimation into the newly-installed estimator via alreadyClassifiedManeuversAvailable was firing unconditionally whenever the wind estimation transitioned from null to non-null. That is only useful in the DB-load path (ManeuversFromDatabase, where the maneuver detector never invokes newManeuverSpotsDetected because maneuvers came from the persistent cache, not from detection). In the compute path (ManeuversFromSmartFutureCache), detection runs after setWindEstimation triggers triggerManeuverCacheRecalculationForAllCompetitors, freshly built detectors capture the newly installed WindEstimationInteraction, and newManeuverSpotsDetected drives the MST/HMM graph path -- which is the correct way to feed the estimator because it aggregates ALL competitors' spots into the same graph and benefits from their spatial and temporal proximity. Feeding the same maneuvers a second time via the per-competitor hand-off would produce per-competitor slices of wind fixes without that cross-competitor MST aggregation. applyManeuverClassificationsToWindTrack reconciles the estimated wind track down to whatever the current input batch produces -- a per-competitor call would then clobber the correct whole-race track computed by the graph path. Observed as a drop of the ratio-of-matching-fixes in IncrementalMstHmmWindEstimationForTrackedRaceTest line 250. Gating on !maneuverCache.canBeUpdated() correctly selects the DB-load path (canBeUpdated == false for ManeuversFromDatabase) and skips the hand-off for the compute path. The gate is safe because ManeuverCacheDelegate.resume, which switches cacheToUse between the two variants, runs synchronously inside TrackedRaceImpl.setStatus's LOADING-to-post-LOADING transition handler, whereas setWindEstimation is invoked afterwards (either by scheduleWindEstimationInstallation waiting on runWhenPastLoading, or by tests manually sequencing after wind sources are populated).