fix(gamedata): return 404 for never-refreshed FIO player data - #45
Conversation
GameFIOPlayerData is created via get_or_create before the FIO fetch. When
that fetch fails, storage/site/warehouse/ship data keep the {} model
default and the storage endpoint returned a 400 list_type validation
error. Treat it as no storage data available.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation (-1.00%) Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (291ad19) Report Missing Report Missing Report Missing Head commit (e8fc124) 3116 (+0) 2808 (+0) 90.12% (+0.00%) 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 (#45) 1 1 100.00% 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%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
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.
Problem
Users report
GET /data/storage/returning 400:gamedata_refresh_user_fiodatacreates theGameFIOPlayerDatarow viaget_or_createbefore fetching from FIO. If the fetch raises, the row keeps the{}(default=dict) model default in all four JSON fields.GameStorageViewSet.retrievethen validates{}aslist[...]and returns 400.Fix
Treat an unpopulated row the same as a missing one: 404
No storage data available.Real schema mismatches in stored lists still return 400.The existing test asserted the 400 for a default factory row; it now expects 404, plus a separate case with malformed list data for the 400 path.
Follow-up
Affected users' refreshes are failing upstream;
automation_erroron theirGameFIOPlayerDatarows holds the actual exception.Frontend counterpart: PRUNplanner/frontend#471 (construction cart no longer blanks on storage errors).
🤖 Generated with Claude Code