Serve each PKG file as its own FPKGi entry - #3966
Merged
Merged
Conversation
FPKGi installs one package per entry, but the feed served a single entry per rom pointing at the rom download URL, which zips multi-file roms. Each .pkg file now gets its own entry with its own size and download URL, named after its category (or file name) when a rom holds several packages. Adds an optional content_type filter so FPKGi's per-category content URLs can each point at RomM. Fixes #3962 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Greptile SummaryThe PR changes the FPKGi feed from one ROM-level archive entry to one entry per PKG file.
Confidence Score: 2/5This PR is not safe to merge until package identifiers are made unique and unavailable PKG records are excluded from the feed. Multi-package ROMs currently produce entries that FPKGi can collapse under one title ID, while stale file records can produce advertised downloads that fail. Files Needing Attention: backend/endpoints/feeds.py, backend/tests/endpoints/feeds.py Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
backend/endpoints/feeds.py:651
**Duplicate package title identifiers**
When a ROM contains multiple PKG files, every emitted entry derives `title_id` solely from `rom.id`. FPKGi deduplicates aggregate content by this field, causing all but the first base, update, or DLC package for that ROM to disappear and producing incorrect installation status.
### Issue 2 of 2
backend/endpoints/feeds.py:634
**Missing packages remain advertised**
When a PKG has been removed from storage but its record is marked `missing_from_fs`, this extension-only filter still adds it to the feed. FPKGi displays the unavailable package, then installation fails because the generated download URL references a file that no longer exists.
Reviews (1): Last reviewed commit: "List each PKG file as its own FPKGi entr..." | Re-trigger Greptile |
Files marked missing_from_fs were still advertised, so FPKGi listed a package whose download URL no longer resolves. Title ids now come from a CUSA/PPSA id in the rom or package file names when present, falling back to the generated RomM id. It is resolved once per rom so a base game and its updates/DLC stay grouped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Description
The FPKGi feed emitted one entry per rom, keyed by the rom download URL (
/roms/{id}/content/...). That endpoint zips multi-file roms, so a PS4 game stored as a folder (base + update + DLC) was served to FPKGi as a single zip and installation failed on the console. Single-.pkggames worked because the same endpoint serves those directly.The feed now walks each rom's
.pkgfiles and emits one entry per file, keyed by the per-file download URL (/roms/{id}/files/content/...), with that file's ownsize(FPKGi warns that an inaccurate size breaks downloads)."<Game> - Update"/"- DLC"when the file has a scanned category (from adlc/update/… subfolder), otherwise"<Game> - <file name>". Single-package roms keep their plain name, so existing libraries look unchanged.?content_type=query param (game,dlc,update,patch,demo), so each of FPKGi'sCONTENT_URLSslots (games,updates,DLC, …) can point at its own RomM URL. Files without a category folder count asgame. Invalid values return 400, matching the existing pkgi endpoints.missing_from_fsare skipped, so the feed no longer advertises a download that can't resolve.title_idis taken from aCUSA/PPSAid in the rom or package file names when present, falling back to the generatedROMM#####id. It is resolved once per rom, so a base game and its updates/DLC stay grouped the way FPKGi searches and sorts content (and the way real PS4 dumps are numbered).cover_urlis nownullwhen a rom has no cover, instead of a URL pointing at the site root.Behavior note: a rom with no
.pkgfiles (e.g. a zipped package) is no longer listed. It was listed before, but FPKGi cannot install it.No frontend regeneration needed: the feed endpoints return a raw
Response, so nothing FPKGi-related exists infrontend/src/__generated__/.Fixes #3962
Checklist
uv run pytest tests/endpoints/feeds.py→ 13 passed. Addedtest_fpkgi_feed_multi_file_rom(base + update + DLC, a non-pkg file, amissing_from_fspackage, shared title id, thecontent_typefilter, and the 400 case) and extendedtest_fpkgi_feedto assert the per-file name, size and extracted title id.AI assistance
This PR was written primarily by Claude Code (code, tests and description), reviewed by me before opening.
🤖 Generated with Claude Code