Skip to content

fix: route mode=queue&name=priority/rename/purge sub-commands - #79

Closed
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/72-queue-subcommand-routing
Closed

fix: route mode=queue&name=priority/rename/purge sub-commands#79
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/72-queue-subcommand-routing

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Collaborator

Summary

Fixes #72: real SABnzbd has no top-level mode=priority or mode=rename. Those (and purge, change_complete_action, sort, delete_nzf) are sub-commands of mode=queue, dispatched via the name parameter through _api_queue_table:

# sabnzbd/api.py:1133-1143 (5.1.x)
_api_queue_table = {
    "delete": (_api_queue_delete, 2),
    "delete_nzf": (_api_queue_delete_nzf, 2),
    "rename": (_api_queue_rename, 2),
    "change_complete_action": (_api_queue_change_complete_action, 2),
    "purge": (_api_queue_purge, 2),
    "pause": (_api_queue_pause, 2),
    "resume": (_api_queue_resume, 2),
    "priority": (_api_queue_priority, 2),
    "sort": (_api_queue_sort, 2),
}

handle_queue only recognized name ∈ {"delete", "pause", "resume"} — any other sub-command (in particular priority and rename, the ones a real client actually calls to change a job's priority or rename it) silently fell through to a plain queue listing instead of performing the action. Meanwhile rustnzb had invented top-level mode=priority/mode=rename that don't exist in the real protocol, so no compliant client would ever call them.

Fix

Add name=priority, name=rename, name=purge, and name=change_complete_action routing to handle_queue, matching the real value/value2 contract (value = nzo_id(s), value2 = new priority/name). sort and delete_nzf are left as a follow-up — RustNZB's queue manager has no equivalent capability yet (custom sort criteria / per-file removal within an NZB). The existing top-level mode=priority/mode=rename aliases are left in place as a harmless compatibility bonus.

Test plan

  • cargo test -p nzb-web — added queue_priority_subcommand_changes_job_priority and queue_rename_subcommand_renames_job, which drive the real mode=queue&name=priority|rename request through dispatch_mode and assert the queue manager's job state actually changed.
  • cargo clippy -p nzb-web --all-targets — clean.
  • Full nzb-web test suite passes.

🤖 Generated with Claude Code

Real SABnzbd has no top-level mode=priority or mode=rename -- those
are sub-commands of mode=queue, dispatched via the name parameter
(_api_queue_table: delete, rename, priority, purge, pause, resume,
change_complete_action, ...). handle_queue only recognized
delete/pause/resume, so a compliant client's real priority-change or
rename request silently fell through to a plain queue listing.

Adds routing for name=priority, name=rename, name=purge, and a
change_complete_action no-op, alongside the existing (non-standard
but harmless) top-level mode=priority/mode=rename aliases.
@thedancingdeveloper

Copy link
Copy Markdown
Collaborator Author

Superseded — this change landed via #84, which stacked all of #71-#77's fixes together and was squash-merged to save on redundant CI runs. Closing without merging to avoid re-applying the same diff.

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.

SABnzbd compat: real priority/rename/purge/sort queue sub-commands are unreachable

1 participant