Skip to content

fix(n64): don't 422 on Controller Pak images with blank note slots#12

Merged
joeblack2k merged 1 commit into
joeblack2k:mainfrom
intarweb:fix/n64-cpk-empty-slot
Jun 15, 2026
Merged

fix(n64): don't 422 on Controller Pak images with blank note slots#12
joeblack2k merged 1 commit into
joeblack2k:mainfrom
intarweb:fix/n64-cpk-empty-slot

Conversation

@terafin

@terafin terafin commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Real-world N64 Controller Pak (.cpk) mempaks (e.g. MiSTer-written) contain blank/uninitialised note slots with empty names. extractLogicalEntries + countN64ControllerPakEntries called fsys.Open(dirEntry.Name()) on every root entry, so fsys.Open("")open : invalid argument and the entire upload was rejected with HTTP 422 (open controller pak entry ""). On a MiSTer SS1 this silently blocked all N64 save-sync (uploaded=0, errors=76/cycle).

Fix: skip empty-named slots in both functions (and make a single unreadable note non-fatal in extract). Valid Controller Paks now sync; blank ones validate cleanly as "no save entries" instead of crashing; count and extract agree.

Test: TestN64ControllerPakEmptySlotDoesNotError uses a real blank mempak fixture that reproduced the 422 (fails before, passes after). Full server suite green.

🤖 Generated with Claude Code

extractLogicalEntries + countN64ControllerPakEntries iterated every
pakfs ReadDirRoot entry and called fsys.Open on its name. Real-world
mempaks (e.g. MiSTer-written .cpk) expose blank/uninitialised note
slots with empty names, so fsys.Open("") returned "open : invalid
argument" and the whole upload was rejected with HTTP 422
("open controller pak entry \"\""). On a MiSTer SS1 this silently
blocked ALL N64 save-sync (uploaded=0, errors=76/cycle).

Skip empty-named slots in both functions (and make a single unreadable
note non-fatal in extract) so valid Controller Paks sync and blank ones
cleanly validate as "no save entries" instead of crashing. Count and
extract now agree.

Regression test uses a real blank mempak fixture that reproduced the 422.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@terafin terafin force-pushed the fix/n64-cpk-empty-slot branch from 6962b0b to 8b37db2 Compare June 14, 2026 03:27
@terafin

terafin commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Just pushed a cleaner version of this PR — earlier it accidentally included 5 fork-infrastructure workflow files (our fork's CI plumbing for HEAD-tracked image publishing) that shouldn't go upstream. Now scoped to just the 3 files that actually fix the empty-slot issue. Sorry for the noise!

@joeblack2k joeblack2k merged commit 7919079 into joeblack2k:main Jun 15, 2026
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.

2 participants