fix(api): correct mismatched inject array in ActivityPipelineService factory#13
Open
ironhardi wants to merge 1 commit into
Open
Conversation
…factory The useFactory inject array had 5 entries (including PrismaService) but the factory function only accepts 4 parameters (gap, weather, normalization, trainingMatch). NestJS resolves inject positionally, so every processor instance was shifted by one slot and TrainingMatchProcessor was silently dropped entirely. As a result, ActivityPipelineService.run() iterated over the wrong instances (PrismaService, GapProcessor, WeatherProcessor, NormalizationProcessor), none of which have a .run() method, so every processor threw "processor.run is not a function" on every activity import (all providers, not just one) and was silently swallowed by the catch block. Weather enrichment, GAP pace, speed normalization, and automatic training/competition matching never ran for any activity. Removing PrismaService (not an actual dependency of this factory) from the inject array restores the correct positional mapping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useFactoryforActivityPipelineServiceinapps/api/src/modules/core/core.module.tshad 5 entries in itsinjectarray (PrismaService, GapProcessor, WeatherProcessor, NormalizationProcessor, TrainingMatchProcessor) but the factory function only accepts 4 parameters (gap, weather, normalization, trainingMatch).injectpositionally, so every processor instance was shifted by one slot:gapactually received thePrismaServiceinstance,weatherreceivedGapProcessor,normalizationreceivedWeatherProcessor, andtrainingMatchreceivedNormalizationProcessor.TrainingMatchProcessorwas resolved but silently dropped entirely.ActivityPipelineService.run()iterates over these (wrong) instances and calls.run(ctx)on each; none of them are actualActivityProcessors, so every call threwprocessor.run is not a function. The error is caught and only logged, so this failed silently for every imported activity, across all providers (Strava, Garmin, Polar, Suunto) — not an isolated case.Fix
Remove
PrismaServicefrom theinjectarray — it isn't an actual dependency of this factory, only the four processors are.Test plan
GapProcessor,WeatherProcessor,NormalizationProcessor,TrainingMatchProcessor) now run successfully, where before all four failed withprocessor.run is not a functionGET /event/:eventId/weatherandGET /event/:eventId/normalizationreturn populated data after the fix