fix(gamedata): planets refetched in one cached batch instead of one request per planet - #64
Merged
Merged
Conversation
…equest per planet Findings: F5 - planets/multiple served from the per-planet PLANET cache entries it shares with GET /data/planet/<id>/ (new CacheManager.respond_many) - missing planets built in one queryset and cached per planet; unknown ids omitted, never cached - ETag over the member ETags, If-None-Match -> 304, Cache-Control public max-age=60 - at most 200 ids per request (400 otherwise) - removed the unused GamePlanetSearchService.search_by_planet_natural_id Spec: specs/2026-09-30-be-05-batched-planet-fetch.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 21 |
| Duplication | 0 |
🟢 Coverage 97.87% diff coverage · +0.01% coverage variation
Metric Results Coverage variation ✅ +0.01% coverage variation (-1.00%) Diff coverage ✅ 97.87% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (927be54) 4600 4391 95.46% Head commit (a82aafe) 4633 (+33) 4423 (+32) 95.47% (+0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#64) 47 46 97.87% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
What and why
When planets expired, the frontend refetched every planet with its own
GET /data/planet/<id>/at once (bursts of up to 117 requests per client in production), andPOST /data/planets/multiple/was not cached. This servesplanets/multiplefrom the same per-planet cache entries as the detail endpoint, so the frontend can refetch expired planets in one request.Changes
planets/multipleserved from the per-planetPLANETcache entries it shares withGET /data/planet/<id>/(newCacheManager.respond_many)If-None-Match→ 304,Cache-Control: public, max-age=60GamePlanetSearchService.search_by_planet_natural_idDeviation: misses skip the per-key stampede lock (they're built in one prefetching query, so the lock would only serialise encoding).
How it was verified
QA: PASS in one round (code review against all 6 acceptance criteria, full walk in the running app).
uv run ruff check,ruff format --check,ty check,pytest: passpublic, max-age=60, 304 on repeat, 400 on 201 ids; the plan editor still loads its planetDeploy order
Deploy backend first; it is backward compatible (same response shape, the current frontend sends far fewer than 200 ids). Paired frontend PR: PRUNplanner/frontend#534
🤖 Generated with Claude Code