Skip to content

fix(library): take a folder library's platform from the folder under the root - #325

Open
BlizzHacker wants to merge 1 commit into
mainfrom
fix/folder-library-nested-files
Open

BlizzHacker wants to merge 1 commit into
mainfrom
fix/folder-library-nested-files

Conversation

@BlizzHacker

@BlizzHacker BlizzHacker commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #324: friends (and the Games page) saw hash titles under platforms called 00000000, 0000000C and so on.

The folder library made a game of every ROM-extension file anywhere under the root and took the platform from the folder directly above the file. A Switch release folder that bundles an emulator NAND holds hundreds of .nca content files named by content id in Contents/registered/<8 hex digits>/, and each became a "game".

  • Platform is now the first folder under the root, however deep the file sits. snes/USA/Game.smc is snes, switch/Game/update/Game.nsp is switch, and RomM's roms/<platform> layout still reads as <platform>.
  • Walk skips hidden folders (which also hides ROMarr's own .romarr-collection-spool, which showed up on a friend's shelf as a platform) and the NAND content stores Contents/registered and Contents/placehld. A folder named registered anywhere else is still read.
  • .nca stays a Switch extension, because extracted games use it.

Not in this PR (still open on #324)

  • One platform under two names (3ds and Nintendo 3DS) when a folder library and a RomM library are both shared.
  • Friend shelves are capped at 5,000 rows.
  • Treating a game folder as one game (instead of one game per file) would be the more general fix, but it changes counts and imports broadly.

Test plan

  • New tests/test_folder_library_nested.py (6 tests): deep files keep the top platform, RomM roms/ layout, root-level file, Switch NAND files skipped, hidden folders skipped, a user registered folder still read. 3 of them failed before the fix.
  • Folder, NAS-read, change-check and sidecar tests pass.
  • Full suite: see the comment below for the run on the final commit. The two hub tests that fail here also fail on unmodified main in this environment (ROM Hub version in the test venv).
  • After deploy to romarr.moveweight.com: rescan and confirm no hash rows on the friend shelf.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Platform names are now detected consistently for games in nested folders, while files directly in the library root remain unassigned.
    • Hidden folders and system content under Contents are excluded from library results. A user folder named registered remains included.
  • Documentation
    • Clarified that a game’s platform is based on its folder beneath the library root.

…the root

A folder library made a game of every file with a ROM extension anywhere
under the root and named its platform after the folder directly above it.
A Switch release that bundles an emulator NAND therefore produced one
"game" per .nca content file, titled by its content id, under platforms
called 00000000, 00000001 ... on the Games page and on every friend's
shelf. ROMarr's own hidden .romarr-collection-spool folder showed up as a
platform as well.

- The platform is the first folder under the root, however deep the file
  (snes/USA/Game.smc is snes; switch/Game/update/x.nsp is switch). RomM's
  roms/<platform> layout still reads as <platform>.
- The walk skips hidden folders and the NAND content stores
  Contents/registered and Contents/placehld. A user folder that happens
  to be called "registered" elsewhere is still read.

Fixes #324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BlizzHacker

Copy link
Copy Markdown
Owner Author

Full suite on 250ae64 (dev server, Python 3.11 venv): 5849 passed, 36 skipped, 2 failed. The 2 failures (test_arcade_punks::test_hub_search_only_filters_plugins, test_hub_acquisition::test_fetch_uses_the_brokers_operator_grant) fail identically on unmodified main 2460cfe in the same venv.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

FolderLibrary now derives a game’s platform from the first folder beneath the library root, skipping an initial roms folder. It also excludes hidden directories and registered or placehld directories under Contents.

Changes: Folder library indexing

Layer / File(s) Summary
Directory filtering
romarr/libraries.py, tests/test_folder_library_nested.py
Traversal excludes hidden directories and registered or placehld directories under Contents. Tests check Switch NAND content and confirm that a visible registered folder remains included.
Platform assignment
romarr/libraries.py, tests/test_folder_library_nested.py
Platform names come from the first folder beneath the library root, except when that folder is roms. Root-level files receive an empty platform. The games documentation describes this platform rule.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 250ae

This change stops Switch NAND content IDs from appearing as game titles and stops 8-digit folders from appearing as platforms in folder libraries. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: a folder library's platform now comes from the folder under the library root. The raw summary confirms this change in romarr/libraries.py, and the PR objectives say it…
Linked Issues check Passed Directly linked issue #324 has two coding requirements in its Expected section. (1) Platform from the first folder under the library root, at any depth: the raw summary says FolderLibrary now derives …
Out of Scope Changes check Passed The reported changes map to #324. FolderLibrary platform selection, the hidden-folder and NAND-store skips, and the games documentation update implement the linked requirements. The test file suppor…
Full details: Title check

Explanation

The title names the main change: a folder library's platform now comes from the folder under the library root. The raw summary confirms this change in romarr/libraries.py, and the PR objectives say it fixes the platform selection for nested files (issue #324). The title does not mention the hidden-folder and NAND skipping, but it is not required to cover every detail.

Full details: Linked Issues check

Explanation

Directly linked issue #324 has two coding requirements in its Expected section. (1) Platform from the first folder under the library root, at any depth: the raw summary says FolderLibrary now derives platform from the first folder beneath the root, skipping a leading roms folder, and the PR tests cover deep files keeping the top platform. (2) Files inside a game's folder tree must not become separate games, either by treating the folder as one game or by skipping those paths: the PR takes the skip option, excluding Contents/registered and Contents/placehld (the NAND content stores that produced the hash titles) and hidden folders. The .romarr-collection-spool entry from the Related section is covered by the hidden-folder skip. The Related items (duplicate platform names, 5,000-row cap) are not in the Expected section and the PR explicitly defers them; they are not required here. Automated tests are included (tests/test_folder_library_nested.py, 6 tests, 3 reported failing before the fix). Limitation: the libraries.py diff and FolderLibrary source could not be read at head (diff unavailable; file read truncated before FolderLibrary), so this verdict rests on the PR summary and raw change summary, not direct source reading.

Full details: Out of Scope Changes check

Explanation

The reported changes map to #324. FolderLibrary platform selection, the hidden-folder and NAND-store skips, and the games documentation update implement the linked requirements. The test file supports them. Keeping .nca as a Switch extension is a deliberate non-regression, since extracted games use that extension; it is not new scope. The PR body states that duplicate platform names, the 5,000-row cap and the one-game-per-folder redesign are not included, so no unrelated change is present in the reported diff. Limitation: source hunks in romarr/libraries.py were not directly readable, so this relies on the summary's description of the changes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2460cfe and 250ae64.

Files selected for processing: 2

  • romarr/libraries.py
  • tests/test_folder_library_nested.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

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.

Folder library indexes files inside a game's own folders, so Games and friends' shelves show hash titles and 8-digit "platforms"

1 participant