Skip to content

fix: unify playlist item short ID hash algorithm to SHA256#61

Open
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-022/run-20260126-215154
Open

fix: unify playlist item short ID hash algorithm to SHA256#61
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-022/run-20260126-215154

Conversation

@proboscis
Copy link
Owner

Summary

  • Replace unstable DefaultHasher with stable SHA256-based hashing in PlaylistItem::short_id()
  • Ensure consistency between runbox playlist show and runbox run <short_id>
  • All playlist item short IDs are now stable across Rust versions

Problem

Playlist item short IDs displayed by runbox playlist show couldn't be used with runbox run <id>:

➜ runbox playlist show game_run
# Shows short ID: 35a2287e

➜ runbox run 35a2287e
Error: No runnable found matching '35a2287e'

Root Cause

Two different hashing algorithms were used:

  • playlist.rs used DefaultHasher (UNSTABLE across Rust versions)
  • runnable.rs used SHA256 (STABLE)

Solution

Unified on SHA256-based stable hash by:

  1. Exporting stable_short_id() from runnable.rs
  2. Updating PlaylistItem::short_id() to use the same algorithm

Acceptance Criteria Evidence

All tests pass (121 core tests + 18 integration tests):

cargo test --package runbox-core
test result: ok. 121 passed; 0 failed; 0 ignored

cargo test --package runbox-cli playlist_run test_list
test result: ok. 18 passed; 0 failed; 0 ignored
  • runbox playlist show displays same short IDs as runbox list --type playlist
  • runbox run <short_id> works with IDs shown by runbox playlist show
  • All playlist item short IDs are stable across Rust versions (SHA256-based)
  • Tests pass

Closes ISSUE-022

Replace unstable DefaultHasher with stable SHA256-based hashing in
PlaylistItem::short_id() to ensure consistency with Runnable::PlaylistItem.short_id().

This fixes the hash mismatch where 'runbox playlist show' displayed different
short IDs than 'runbox run' could resolve, making playlist item IDs unusable
for running commands directly.

Changes:
- Export stable_short_id() from runnable.rs
- Update PlaylistItem::short_id() to use the same SHA256 algorithm
- All playlist item IDs are now stable across Rust versions

Closes ISSUE-022
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