Skip to content

fix: unify playlist item short ID hashing to SHA256#64

Open
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-039/run-20260126-215357
Open

fix: unify playlist item short ID hashing to SHA256#64
proboscis wants to merge 1 commit intomainfrom
issue/ISSUE-039/run-20260126-215357

Conversation

@proboscis
Copy link
Copy Markdown
Owner

Summary

  • Fixes ISSUE-039: Playlist item short IDs displayed by runbox playlist show now match the IDs used by runbox run <id>

Problem

Two different hashing algorithms were used for playlist item short IDs:

  • playlist.rs: DefaultHasher (unstable across Rust versions)
  • runnable.rs: SHA256 (stable)

This caused runbox run <short_id> to fail with "No runnable found" when using IDs from runbox playlist show.

Changes

  • Export stable_short_id from runnable.rs
  • Update PlaylistItem::short_id() to use the same SHA256-based algorithm as Runnable::PlaylistItem.short_id()
  • Both now use format: playlist_item\0{playlist_id}\0{index}\0{template_id}

Acceptance Criteria Verification

runbox playlist show displays same short IDs as runbox list --type playlist

=== runbox playlist show pl_game_runtimes ===
IDX   SHORT      TEMPLATE        LABEL
0     1bd3a756   game_cli        CLI - Text-based terminal
1     64b65e8c   game_tui        TUI - Rich Textual interface
2     a1067dcd   game_pyg        Pygame - Graphical interface

runbox run <short_id> works with IDs shown by runbox playlist show

=== runbox run 1bd3a756 --dry-run ===
┌───────────────────────────────────────────────────────┐
│ PLAYLIST ITEM: pl_game_runtimes[0] "CLI - Text-based terminal"│
│ Template: tpl_game_cli                                 │
└───────────────────────────────────────────────────────┘
(successfully resolved and would execute)

All tests pass

  • 121 core tests pass
  • 53 CLI playlist tests pass

Closes ISSUE-039

Fixes ISSUE-039: Playlist item short IDs displayed by 'runbox playlist show'
now match the IDs used by 'runbox run <id>'.

The root cause was two different hashing algorithms:
- playlist.rs used DefaultHasher (unstable across Rust versions)
- runnable.rs used SHA256 (stable)

Changes:
- Export stable_short_id from runnable.rs
- Update PlaylistItem::short_id() to use the same SHA256-based algorithm
  as Runnable::PlaylistItem.short_id()
- Both now use the format: 'playlist_item\0' + playlist_id + '\0' + index + '\0' + template_id

Acceptance criteria met:
- 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)
- All tests pass (121 core tests, 53 CLI playlist tests)
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