[PR #1383] [MERGED] Fix legacy persona avatar crop parsing #5052

Closed
opened 2026-10-22 04:12:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1383
Author: @cha1latte
Created: 5/27/2026
Status: ✅ Merged
Merged: 5/27/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/refactor-issue-1364-persona-avatar-crop


📝 Commits (2)

  • fc3fb5e Fix legacy persona avatar crop parsing
  • c3d22aa Address legacy crop review feedback

📊 Changes

9 files changed (+147 additions, -72 deletions)

View changed files

📝 src/engine/contracts/types/persona.ts (+11 -1)
📝 src/features/catalog/characters/components/CharacterAvatarImage.tsx (+8 -20)
📝 src/features/catalog/personas/components/PersonaEditor.tsx (+18 -27)
📝 src/features/modes/game/components/GameNarration.tsx (+3 -3)
📝 src/features/modes/game/components/GameSurface.tsx (+2 -2)
📝 src/features/runtime/visuals/types.ts (+3 -3)
📝 src/shared/components/ui/AvatarCropWidget.tsx (+15 -13)
➕ src/shared/lib/avatar-crop.test.ts (+41 -0)
📝 src/shared/lib/utils.ts (+46 -3)

📄 Description

Linked issue

Closes #1364

Why this change

  • Refactor dropped support for legacy persona avatar crop values shaped as zoom/offsetX/offsetY/fullImage, so imported legacy personas could lose their saved avatar framing.

What changed

  • Added legacy avatar crop parsing and rendering support to the shared crop helpers.
  • Widened persona/avatar render data types so legacy crop values can flow to existing render surfaces.
  • Updated the persona editor and crop widget to preserve legacy crop rendering while emitting the current crop shape after user edits.
  • Added unit coverage for current crop parsing, legacy crop parsing, legacy crop styling, and malformed legacy rows.

Refactor impact

Primary owner:

  • catalog personas / shared UI

Impact areas reviewed:

  • Persona contract and editor hydration.
  • Shared avatar crop parser/style helper.
  • Chat/game/avatar visual data flow types that render persona crops.

Boundary notes:

  • No storage schema, dependency, version, remote-runtime, or prompt-pipeline changes.
  • Legacy rows are preserved at read/render time; this PR does not eagerly migrate saved rows.

Pressure points touched:

  • Persona editor avatar crop hydration.
  • Shared AvatarCropWidget.
  • GameSurface and GameNarration avatar info typing.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex reproduced the regression with node scratch\issue-1364-avatar-crop-proof.mjs before the fix.
  • Codex verified the original repro now passes with node scratch\issue-1364-avatar-crop-proof.mjs.
  • Codex ran pnpm exec vitest run src\shared\lib\avatar-crop.test.ts; 1 test file / 4 tests passed.
  • Codex ran pnpm check; architecture, TypeScript, Rust cargo check, and docs checks passed.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json; proof gate passed.
  • No manual browser/Tauri import was run. A human may still manually import a legacy persona with zoom/offset crop data to visually confirm framing in the app before ticking manual UI boxes.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • No screenshot evidence. This fix is covered by parser/style unit coverage, the scratch compatibility harness, TypeScript flow validation, and baseline checks.

Summary by CodeRabbit

  • New Features

    • Added backwards-compatible support for legacy avatar crop formats during persona imports, enabling seamless import of personas created with earlier versions.
  • Tests

    • Added comprehensive avatar crop JSON compatibility test suite covering parsing and styling scenarios.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1383 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-1364-persona-avatar-crop` --- ### 📝 Commits (2) - [`fc3fb5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc3fb5e0bc63cad370ae06507d530552bbd927ec) Fix legacy persona avatar crop parsing - [`c3d22aa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c3d22aafa934c92880e4891cbac79a90d6582ce6) Address legacy crop review feedback ### 📊 Changes **9 files changed** (+147 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/types/persona.ts` (+11 -1) 📝 `src/features/catalog/characters/components/CharacterAvatarImage.tsx` (+8 -20) 📝 `src/features/catalog/personas/components/PersonaEditor.tsx` (+18 -27) 📝 `src/features/modes/game/components/GameNarration.tsx` (+3 -3) 📝 `src/features/modes/game/components/GameSurface.tsx` (+2 -2) 📝 `src/features/runtime/visuals/types.ts` (+3 -3) 📝 `src/shared/components/ui/AvatarCropWidget.tsx` (+15 -13) ➕ `src/shared/lib/avatar-crop.test.ts` (+41 -0) 📝 `src/shared/lib/utils.ts` (+46 -3) </details> ### 📄 Description ## Linked issue Closes #1364 ## Why this change - Refactor dropped support for legacy persona avatar crop values shaped as `zoom`/`offsetX`/`offsetY`/`fullImage`, so imported legacy personas could lose their saved avatar framing. ## What changed - Added legacy avatar crop parsing and rendering support to the shared crop helpers. - Widened persona/avatar render data types so legacy crop values can flow to existing render surfaces. - Updated the persona editor and crop widget to preserve legacy crop rendering while emitting the current crop shape after user edits. - Added unit coverage for current crop parsing, legacy crop parsing, legacy crop styling, and malformed legacy rows. ## Refactor impact Primary owner: - catalog personas / shared UI Impact areas reviewed: - Persona contract and editor hydration. - Shared avatar crop parser/style helper. - Chat/game/avatar visual data flow types that render persona crops. Boundary notes: - No storage schema, dependency, version, remote-runtime, or prompt-pipeline changes. - Legacy rows are preserved at read/render time; this PR does not eagerly migrate saved rows. Pressure points touched: - Persona editor avatar crop hydration. - Shared `AvatarCropWidget`. - GameSurface and GameNarration avatar info typing. ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex reproduced the regression with `node scratch\issue-1364-avatar-crop-proof.mjs` before the fix. - Codex verified the original repro now passes with `node scratch\issue-1364-avatar-crop-proof.mjs`. - Codex ran `pnpm exec vitest run src\shared\lib\avatar-crop.test.ts`; 1 test file / 4 tests passed. - Codex ran `pnpm check`; architecture, TypeScript, Rust `cargo check`, and docs checks passed. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`; proof gate passed. - No manual browser/Tauri import was run. A human may still manually import a legacy persona with `zoom`/offset crop data to visually confirm framing in the app before ticking manual UI boxes. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - No screenshot evidence. This fix is covered by parser/style unit coverage, the scratch compatibility harness, TypeScript flow validation, and baseline checks. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added backwards-compatible support for legacy avatar crop formats during persona imports, enabling seamless import of personas created with earlier versions. * **Tests** * Added comprehensive avatar crop JSON compatibility test suite covering parsing and styling scenarios. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1383?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:48 +07:00
Sign in to join this conversation.
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
Pasta-Devs/Marinara-Engine#5052
No description provided.