Skip to content

fix(gamedata): return 404 for never-refreshed FIO player data - #45

Merged
jplacht merged 1 commit into
mainfrom
fix/storage-empty-playerdata
Sep 26, 2026
Merged

jplacht merged 1 commit into
mainfrom
fix/storage-empty-playerdata

Conversation

@jplacht

@jplacht jplacht commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Users report GET /data/storage/ returning 400:

[{"type": "list_type", "loc": [], "msg": "Input should be a valid list", "input": {}}]

gamedata_refresh_user_fiodata creates the GameFIOPlayerData row via get_or_create before fetching from FIO. If the fetch raises, the row keeps the {} (default=dict) model default in all four JSON fields. GameStorageViewSet.retrieve then validates {} as list[...] 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_error on their GameFIOPlayerData rows holds the actual exception.

Frontend counterpart: PRUNplanner/frontend#471 (construction cart no longer blanks on storage errors).

🤖 Generated with Claude Code

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>
@codacy-production

codacy-production Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 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

View coverage diff in Codacy

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.

@jplacht
jplacht merged commit 8de36d9 into main Sep 26, 2026
6 checks passed
@jplacht
jplacht deleted the fix/storage-empty-playerdata branch September 26, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant