Set provider modes per call site#309
Merged
Merged
Conversation
Use ProviderModeNever for the playerdata endpoint and ProviderModeAlways for the interval updater and milestone finder. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates how GetAndPersistPlayerWithCache is invoked across the codebase by explicitly selecting a ProviderMode per call site, aligning provider usage with each feature’s intended behavior (API handler vs. interval updates vs. milestone computation).
Changes:
- Set the playerdata endpoint to
ProviderModeNeverto avoid querying the external provider. - Set the interval updater and milestone finder to
ProviderModeAlwaysto prefer fresh provider-sourced data. - Update unit tests to assert the new provider modes at those call sites.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/ports/player_data.go | Switch playerdata handler to ProviderModeNever to serve only stored stats. |
| internal/app/milestone.go | Switch milestone pre-refresh to ProviderModeAlways before repository query. |
| internal/app/milestone_test.go | Update assertions to expect ProviderModeAlways. |
| internal/app/get_and_persist.go | Switch interval updater refresh call to ProviderModeAlways. |
| internal/app/get_and_persist_test.go | Update assertions to expect ProviderModeAlways in interval updater tests. |
Comment on lines
+129
to
130
| player, err := getAndPersistPlayerWithCache(ctx, uuid, app.ProviderModeNever) | ||
| if errors.Is(err, domain.ErrPlayerNotFound) { |
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
Sets the provider mode explicitly at each call site of
GetAndPersistPlayerWithCache:internal/ports/player_data.go) →ProviderModeNever— never query the provider; serve stored stats only.internal/app/get_and_persist.go) →ProviderModeAlways— always fetch fresh data for current intervals.internal/app/milestone.go) →ProviderModeAlways— always fetch fresh data before computing achievements.Test assertions for the interval updater and milestone finder are updated to match.
Test plan
go build ./...go test ./internal/app/ ./internal/ports/🤖 Generated with Claude Code