Skip to content

feat(state): persist assigned tile graphics - #210

Merged
thewrz merged 1 commit into
mainfrom
feat/issue-206
Jul 23, 2026
Merged

feat(state): persist assigned tile graphics#210
thewrz merged 1 commit into
mainfrom
feat/issue-206

Conversation

@thewrz

@thewrz thewrz commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Why

Per-sound tile graphics need a safe persistence boundary before file selection, copying, or rendering can be built. Existing sound metadata must migrate without losing customizations, and invalid paths must never cause HonkHonk to overwrite unreadable state.

What

Adds a validated application-owned graphic filename to per-sound metadata, advances the persisted envelope to v2 with explicit v1 and legacy migration, and preserves default-entry pruning. Invalid graphic references and unsupported versions load read-protected. This remains state-only: no chooser, copying, decoding, thumbnails, or rendering.

Testing

  • Focused sound metadata tests pass
  • Full cargo test passes (686 tests)
  • cargo clippy -- -D warnings passes
  • cargo fmt --all -- --check passes
  • CI green

🤖 Co-authored by Codex. Closes #206.

Summary by CodeRabbit

  • New Features

    • Added support for assigning, updating, and clearing a graphic for each sound.
    • Added validation to prevent unsafe or invalid graphic filenames.
    • Added compatibility for loading existing metadata while preserving assigned graphics.
  • Bug Fixes

    • Saving sound metadata now preserves previously stored settings, including favorites.
  • Data & Reliability

    • Improved metadata persistence, migration, validation, and protection against overwriting invalid or unsupported data.

Add a validated application-owned graphic filename to per-sound metadata, migrate existing stores to the v2 envelope, and protect invalid or unsupported data from overwrite. Preserve default-entry pruning and existing graphic assignments when editing other metadata.

Co-Authored-By: Codex <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds validated per-sound graphic references, store APIs, v1-to-v2 metadata migration, read-protected persistence behavior, application field preservation, and comprehensive tests for validation, pruning, round trips, and compatibility.

Changes

Assigned graphic persistence

Layer / File(s) Summary
Graphic metadata contract and store APIs
docs/superpowers/specs/..., src/state/sound_meta.rs, src/state/mod.rs, src/app/mod.rs, src/state/sound_meta/tests.rs
Adds GraphicAssetRef validation, SoundMeta.assigned_graphic, assignment accessors, default pruning, public exports, field-preserving save updates, and tests for metadata behavior.
Versioned persistence and migration
src/state/sound_meta/persistence.rs, src/state/sound_meta/tests.rs, docs/superpowers/specs/...
Migrates version 1 data into the current model, handles current envelopes, and tests round trips, legacy shapes, unsupported versions, invalid references, and overwrite protection.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SoundMetaStore
  participant PersistenceDecoder
  participant GraphicAssetRef
  SoundMetaStore->>PersistenceDecoder: load versioned metadata
  PersistenceDecoder->>GraphicAssetRef: validate persisted filename
  GraphicAssetRef-->>PersistenceDecoder: validated reference or error
  PersistenceDecoder-->>SoundMetaStore: migrated or current metadata
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the linked issue scope with a validated graphic reference, backward-compatible migration, pruning, and tests.
Out of Scope Changes check ✅ Passed The changes stay within state persistence and supporting tests with no unrelated feature work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: persisting assigned tile graphics in state.

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

@thewrz

thewrz commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thewrz
thewrz marked this pull request as ready for review July 23, 2026 20:20
@thewrz
thewrz merged commit 640595c into main Jul 23, 2026
11 of 12 checks passed
@thewrz
thewrz deleted the feat/issue-206 branch July 23, 2026 20:20
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.

feat(state): persist assigned tile graphic references

1 participant