fix(restoreVersion): return new_version tag (#58 regression 2) #59

Merged
mik-tf merged 1 commit from development_mik into development 2026-05-11 02:54:50 +00:00
Owner

Summary

Closes #58 regression 2.

The dashboard restoreVersion JS reads result.new_version (dashboard.js:5852) to format its success toast as Restored vX as vY. The handler returned only {name, restored: true}, so the toast displayed Restored vX as undefined — which presents as "restore is broken" to the user even though the on-disk file was actually being replaced correctly.

The fix has the handler list versions after the restore call and return the highest tag (the snapshot just archived from the pre-restore image — exactly what the toast wants to show). openrpc.json gains the explicit response schema so the contract is no longer {type: object} with no documented fields.

Test plan

  • Backend curl with new shape {collection, deck, slide, version}{name, new_version, restored:true}. new_version populated.
  • Backend curl with legacy shape {deck_path, slide_name, version} → same response. Backwards compat intact.
  • On-disk file actually restored (md5 matches the requested version snapshot).
  • Browser MCP drove the dashboard restoreVersion flow end-to-end — toast now reads Restored v005 as v014 instead of Restored v005 as undefined.
  • cargo build --release -p hero_slides_server clean.

On regression 1 (multimodal images ignored) — not reproducible on this HEAD

After pulling herolib f6621dee (feat(ai): extend ImageConfig with OpenRouter image-gen parameters, +flatten image_config into top-level body) which boss did not have when filing #58, multimodal image attachments work end-to-end. Verified by instrumenting the broker (temporary [s91-debug] log line, reverted before this PR) and confirming inline ![logo](path) refs and theme.toml refs both reach OpenRouter as messages[0].content[].image_url parts with correct base64 data URLs, and that google/gemini-3.1-flash-image-preview renders distinctive synthetic logos (ZORBLAXOMEGA, KWENDARIA) into the output PNG correctly. Recommendation: boss to cd lhumina_code/hero_lib && git pull and re-test on his side.

Out of scope (noted, not fixed here)

While reproducing #58 in the browser I noticed two unrelated noise sources, neither user-visible (UI catches in try/catch) — left alone to keep this PR scoped:

  • slide.getIncomingLinks returns Method not found; the dashboard calls it 11x per load (one per slide).
  • bg.listFolders errors when <deck>/backgrounds/ does not exist (should return empty list).

Pre-existing fmt drift (not from this PR)

cargo fmt --check -p hero_slides_server reports drift in agent.rs + earlier lines of rpc.rs; all pre-date this PR (HEAD ff1fca7). Not fixed here to keep diff scoped.

🤖 Generated with Claude Code

## Summary Closes [#58](https://forge.ourworld.tf/lhumina_code/hero_slides/issues/58) regression 2. The dashboard `restoreVersion` JS reads `result.new_version` (`dashboard.js:5852`) to format its success toast as `Restored vX as vY`. The handler returned only `{name, restored: true}`, so the toast displayed `Restored vX as undefined` — which presents as "restore is broken" to the user even though the on-disk file was actually being replaced correctly. The fix has the handler list versions after the restore call and return the highest tag (the snapshot just archived from the pre-restore image — exactly what the toast wants to show). `openrpc.json` gains the explicit response schema so the contract is no longer `{type: object}` with no documented fields. ## Test plan - [x] Backend curl with new shape `{collection, deck, slide, version}` → `{name, new_version, restored:true}`. `new_version` populated. - [x] Backend curl with legacy shape `{deck_path, slide_name, version}` → same response. Backwards compat intact. - [x] On-disk file actually restored (md5 matches the requested version snapshot). - [x] Browser MCP drove the dashboard `restoreVersion` flow end-to-end — toast now reads `Restored v005 as v014` instead of `Restored v005 as undefined`. - [x] `cargo build --release -p hero_slides_server` clean. ## On regression 1 (multimodal images ignored) — not reproducible on this HEAD After pulling herolib `f6621dee` (`feat(ai): extend ImageConfig with OpenRouter image-gen parameters`, +flatten image_config into top-level body) which boss did **not** have when filing #58, multimodal image attachments work end-to-end. Verified by instrumenting the broker (temporary `[s91-debug]` log line, reverted before this PR) and confirming inline `![logo](path)` refs and `theme.toml` refs both reach OpenRouter as `messages[0].content[].image_url` parts with correct base64 data URLs, and that `google/gemini-3.1-flash-image-preview` renders distinctive synthetic logos (ZORBLAXOMEGA, KWENDARIA) into the output PNG correctly. Recommendation: boss to `cd lhumina_code/hero_lib && git pull` and re-test on his side. ## Out of scope (noted, not fixed here) While reproducing #58 in the browser I noticed two unrelated noise sources, neither user-visible (UI catches in `try/catch`) — left alone to keep this PR scoped: - `slide.getIncomingLinks` returns `Method not found`; the dashboard calls it 11x per load (one per slide). - `bg.listFolders` errors when `<deck>/backgrounds/` does not exist (should return empty list). ## Pre-existing fmt drift (not from this PR) `cargo fmt --check -p hero_slides_server` reports drift in `agent.rs` + earlier lines of `rpc.rs`; all pre-date this PR (HEAD ff1fca7). Not fixed here to keep diff scoped. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(restoreVersion): return new_version tag so dashboard toast shows actual version
Some checks failed
Test / test (push) Failing after 3s
Test / test (pull_request) Failing after 3s
1ce05b0cd7
The dashboard `restoreVersion` JS reads `result.new_version` (dashboard.js:5852)
to format its success toast as "Restored vX as vY". The handler returned only
`{name, restored: true}`, so the toast displayed "Restored vX as undefined" —
the visible symptom behind the "history restore does no longer work" report
in #58.

The actual on-disk restore was always working (verified via curl + md5).
This change has the handler list versions after the restore call and return
the highest tag — that's the snapshot just archived from the pre-restore
image, which is exactly what the toast wants to show. openrpc.json gains an
explicit response schema so the contract is no longer "object" with no fields.

Closes #58 regression 2 of 2.
Regression 1 (multimodal images ignored) cannot be reproduced on this HEAD
once herolib `f6621dee` is pulled — verified via inline + theme refs end-to-end
with broker-side body inspection; Gemini renders the attached image correctly.

Signed-off-by: mik-tf
mik-tf merged commit 23cae9b7f6 into development 2026-05-11 02:54:50 +00:00
mik-tf deleted branch development_mik 2026-05-11 02:54:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_slides!59
No description provided.