Skip to content

refactor(sloppak): route the rigs loader through the shared path helper#1041

Open
gionnibgud wants to merge 1 commit into
mainfrom
refactor/rigs-loader-uses-path-helper
Open

refactor(sloppak): route the rigs loader through the shared path helper#1041
gionnibgud wants to merge 1 commit into
mainfrom
refactor/rigs-loader-uses-path-helper

Conversation

@gionnibgud

@gionnibgud gionnibgud commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Follow-up promised in #1040. _load_rigs_file is currently the only loader in lib/sloppak.py still open-coding the manifest-path containment guard — its seven siblings go through _resolve_pack_path.

#1039 (the dedup) and #1040 (the rig reader) were each correct against the base they were written on, and merged in the right order. #1040 just went in without the rebase that would have joined them, leaving the eighth call site behind. Two lines in place of ten.

Verification

  • Full suite 2796 passed / 4 skipped, unchanged.
  • Rendered log output identical — triggered a traversal through the new path and confirmed sloppak: rigs path '../outside.json' escapes source_dir — skipped, byte-for-byte what the inline copy emitted.
  • Existing coverage carries it: test_sloppak_rigs_load.py::test_load_song_rejects_traversing_rigs_path already exercises this exact path.

No behaviour change, no new validation.

feedpak surface

  • This PR does not change how the app reads/writes feedpaks (manifest keys, pack files, folder layout)

Checklist

  • CHANGELOG.md [Unreleased] updated — n/a, internal refactor with no user-visible change
  • Tests added/updated for new behaviour — n/a, no new behaviour; existing traversal test is the check
  • Commits are DCO signed off (git commit -s)

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of rig manifest paths.
    • Invalid or missing rig files are now safely ignored, preventing loading errors and disabling rigs when necessary.
    • Path validation is applied consistently for packaged and archive-based content.

#1039 collapsed seven copies of the manifest-path containment guard into
`_resolve_pack_path`, and #1040 added an eighth loader carrying its own
copy. Both were correct against the base they were written on and both
merged in the right order, but #1040 went in without the rebase that
would have joined them — so `_load_rigs_file` is now the one loader in
this file still open-coding the guard.

Route it through the helper like its seven siblings. Same behaviour,
same rendered log message ("sloppak: rigs path %r escapes source_dir —
skipped"), verified by triggering a traversal against the new path.
Full suite unchanged at 2796 passed / 4 skipped.

This is the follow-up promised in #1040's description.

Signed-off-by: gionnibgud <gionnibgud@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a97ee3fa-b629-461d-ad11-56654c16838d

📥 Commits

Reviewing files that changed from the base of the PR and between eef58c8 and ae6534b.

📒 Files selected for processing (1)
  • lib/sloppak.py

📝 Walkthrough

Walkthrough

_load_rigs_file() now uses _resolve_pack_path() for manifest-declared rigs paths and disables rigs loading when resolution fails or the resolved file is absent.

Changes

Rigs path resolution

Layer / File(s) Summary
Apply shared rigs path resolution
lib/sloppak.py
_load_rigs_file() replaces inline path validation with _resolve_pack_path() and returns None for unresolved or missing rigs files.

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

Possibly related PRs

Suggested reviewers: byrongamatos, chrisbewithyou

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: routing the rigs loader through the shared path helper.
Description check ✅ Passed The description matches the template well, covering What, feedpak surface, verification, and checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/rigs-loader-uses-path-helper

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

Comment @coderabbitai help to get the list of available commands.

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