[PR #7843] [MERGED] fix(avatars): repair sprite cutouts and chat layout controls #7964

Closed
opened 2026-10-24 04:09:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7843
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/avatar-3d-placement


📝 Commits (10+)

  • eb567a0 chore: start 2D avatar variant edge investigation (#7840)
  • 70d5eb1 Merge branch 'staging' into fix/avatar-variant-white-edges
  • fa7d3b1 test(avatars): reproduce uploaded VRM layout controls
  • d2fb780 fix(avatars): preserve source colour at generated variant edges (#7840)
  • 9109df2 fix(avatars): expose saved avatar layout controls in chats
  • cc371a3 Merge 2D avatar cutout repair into avatar fixes
  • bf0c5b9 fix(avatars): preserve queued Game layout edits
  • 416b56d Merge branch 'staging' into fix/avatar-3d-placement
  • 295e0ae fix(avatars): isolate arrangement from Game navigation
  • a49944e Merge commit '416b56d933' into fix/avatar-3d-placement

📊 Changes

9 files changed (+703 additions, -57 deletions)

View changed files

📝 docs/agents/avatars.md (+3 -1)
➕ e2e/avatar-placement.e2e.ts (+252 -0)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+9 -0)
📝 packages/client/src/components/game/GameSurface.tsx (+83 -1)
📝 packages/client/src/features/avatars/stage/AvatarStage.tsx (+115 -49)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/server/src/services/avatars/generation/generation-context.ts (+6 -6)
📝 scripts/regressions/avatar-backgrounds.regression.ts (+71 -0)
➕ scripts/regressions/avatar-placement.regression.ts (+160 -0)

📄 Description

Linked issue

Closes #7840.
Closes #7842.

Why this change

Generated 2D blink/talk pictures can acquire a pale hair fringe or bottom stripe absent from the original sprite. Uploaded VRMs also lack usable move/resize controls in avatar-only Roleplay chats, and Game does not connect avatar placement controls.

What changed

  • Preserve the source sprite's colour and alpha in a scale-dependent outline collar, including the canvas boundary. Facial edits farther inside remain the generated picture. Regenerate affected blink/talk pictures after updating to apply the repair.
  • Add Arrange avatars directly to Roleplay, Visual Novel and Game. Move an avatar with a mouse, touch or arrow keys, adjust each avatar's size, and select Done to resume normal chat interaction. The size control has an always-visible thumb and a 2.75rem input target (at least 44px in the tested browser profiles).
  • Keep placement and per-owner size in the existing device-local, per-chat layout cache, including Game and reload restoration. Queued edits to different avatars preserve each other.
  • Update the avatar guide and add deterministic pixel and uploaded-VRM browser regressions.

Validation

Current head: a49944e051e60d09e0fe86a3d3a338dc31b9e5da, preserving the owner's staging merge.

  • pnpm check: passed, including localization, formatting, lint, TypeScript and production builds.
  • The previous bf0c5b974 official Dockerfile.lite arm64 build and existing two-phase container runtime smoke passed. Baked commit was independently verified; API, compiled frontend, native Sharp, non-root startup, writable/persistent settings and environment, and SIGTERM exit0 across replacement all passed. The current-head container proof is pending.
  • node scripts/run-regressions.mjs --filter avatar-placement: 1/1 passed on bf0c5b974; its Game callbacks and harness are unchanged by this follow-up. This actual callback queue harness first reproduced one avatar move overwriting another before a render. It now verifies both owner maps, metadata fallback, preserved owner fields, saving outside React updaters, stale-chat callbacks, and preference-cache write failures. It does not mount React.
  • Game uploaded-VRM placement: 3/3 passed on desktop Chromium, phone Chromium and phone WebKit, including actual rendered canvas resizing, reload restoration, narration staying on the same segment during Arrange/drag, and background navigation resuming after Done. The desktop drag first reproduced narration advancing on bf0c5b974. The green browser proof ran on 295e0aed0; all three follow-up files are byte-identical after the owner merge into the current head.
  • pnpm smoke:ui: 7/7 passed.

Retained evidence from earlier combined head cc371a3b for unchanged paths:

  • Node backgrounds 1/1, generation plus cancellation 2/2, and stage logic 1/1 passed. New bottom/fringe assertions failed against the old algorithm.
  • Uploaded-VRM Roleplay and Game cases covered all three browser profiles; changed Game callbacks were rerun on the final head above. Final light-thumb/Roleplay control-row cases passed on desktop and phone Chromium. An initial phone Game screenshot hit ENOSPC after its feature assertions; its rerun passed after storage recovery.
  • Existing 2D sprite/avatar Arrange and 2D avatar-generation browser cases each passed all three profiles.
  • Compiled frontend production startup/reload smoke passed all three profiles.
  • A read-only replay on the reported 2D source, with explicitly synthetic provider corruption, restored all 2,171 near-outline and 1,935 bottom-row corrupted pixels, preserved every alpha byte, retained generated eyes/teeth/interior white hair and the original bowtie, and left the source file byte-identical.

The full local CodeRabbit review covered all eight original files and found one valid minor Game batching issue. That issue is fixed and reproduced by the new harness. The two-file incremental local review completed with no additional findings on bf0c5b974. The hosted full review covered all nine files on that head and posted seven comments. This follow-up addresses the Game navigation defect, the semantic Done key, genuine Chromium touch input, and slider styling. A combined incremental local review and substantive current-head hosted review remain merge gates.

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually regenerate blink and talk pictures with the original provider and compare them with the source on dark and light backgrounds. Existing saved pictures and pending old drafts are not rewritten.
  • The original unsaved phone draft was unavailable. The 2D replay uses synthetic corruption calibrated to the report; no paid generation or production write was made.
  • Manually verify VRM dragging and resizing on a physical phone. Browser proof uses Chromium CDP touch start/move/end gestures and emulated touchscreen taps, with browser-dispatched held-touch pointer events retained for WebKit. Physical iOS/Android gestures and native shells remain unverified.
  • Layout preferences are saved on this device for this chat and do not sync across devices.

Docs and release impact

English guide: docs/agents/avatars.md:34–36 documents the direct controls, keyboard access and device-local persistence. Translation work follows the maintainer's agreed English-change list and release translation sweep: documented release-cycle instruction.

  • No docs changes needed
  • Updated docs as needed
  • Translated docs release sweep completed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence

Published fixture-only uploaded-VRM screenshots cover desktop and phone, dark and light controls. The pre-repair desktop capture shows the missing entry point. No unpatched phone screenshot was recorded. The actual 2D character source/replay stays private and local.

Summary by CodeRabbit

  • New Features
    • Arrange avatars in Roleplay, Visual Novel, and Game chats by dragging them or using the arrow keys.
    • Adjust each avatar’s size and save its layout for that chat on the current device. Saved layouts persist after reloading but do not sync across devices.
    • Continue arranging avatars with the Expression Engine’s Arrange mode.
  • Bug Fixes
    • Improved avatar image outlines, including at canvas edges, while preserving nearby details such as highlights and facial features.

🔄 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/7843 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/avatar-3d-placement` --- ### 📝 Commits (10+) - [`eb567a0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eb567a0c678bfc265a3b35d43ad03295417706f7) chore: start 2D avatar variant edge investigation (#7840) - [`70d5eb1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/70d5eb17a24cc20f85c30747222868f2d1e41418) Merge branch 'staging' into fix/avatar-variant-white-edges - [`fa7d3b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fa7d3b16efc9417a51a60c24b42942d7278cb255) test(avatars): reproduce uploaded VRM layout controls - [`d2fb780`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d2fb7802e99986490aad2cd918d23c5165423cf6) fix(avatars): preserve source colour at generated variant edges (#7840) - [`9109df2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9109df2914e1eba98843d23c7443ac960e06b832) fix(avatars): expose saved avatar layout controls in chats - [`cc371a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc371a3b583b0587ee53c3276f880991b82247ba) Merge 2D avatar cutout repair into avatar fixes - [`bf0c5b9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bf0c5b9741f7a1c9244e7e92d1be165fcdbfd85a) fix(avatars): preserve queued Game layout edits - [`416b56d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/416b56d933db392a9f7e8ed81e54407406c86252) Merge branch 'staging' into fix/avatar-3d-placement - [`295e0ae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/295e0aed0400c5e8ed61ad746a5586c493c7dac1) fix(avatars): isolate arrangement from Game navigation - [`a49944e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a49944e051e60d09e0fe86a3d3a338dc31b9e5da) Merge commit '416b56d933db392a9f7e8ed81e54407406c86252' into fix/avatar-3d-placement ### 📊 Changes **9 files changed** (+703 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/avatars.md` (+3 -1) ➕ `e2e/avatar-placement.e2e.ts` (+252 -0) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+9 -0) 📝 `packages/client/src/components/game/GameSurface.tsx` (+83 -1) 📝 `packages/client/src/features/avatars/stage/AvatarStage.tsx` (+115 -49) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/server/src/services/avatars/generation/generation-context.ts` (+6 -6) 📝 `scripts/regressions/avatar-backgrounds.regression.ts` (+71 -0) ➕ `scripts/regressions/avatar-placement.regression.ts` (+160 -0) </details> ### 📄 Description ## Linked issue Closes #7840. Closes #7842. ## Why this change Generated 2D blink/talk pictures can acquire a pale hair fringe or bottom stripe absent from the original sprite. Uploaded VRMs also lack usable move/resize controls in avatar-only Roleplay chats, and Game does not connect avatar placement controls. ## What changed - Preserve the source sprite's colour and alpha in a scale-dependent outline collar, including the canvas boundary. Facial edits farther inside remain the generated picture. Regenerate affected blink/talk pictures after updating to apply the repair. - Add **Arrange avatars** directly to Roleplay, Visual Novel and Game. Move an avatar with a mouse, touch or arrow keys, adjust each avatar's size, and select **Done** to resume normal chat interaction. The size control has an always-visible thumb and a 2.75rem input target (at least 44px in the tested browser profiles). - Keep placement and per-owner size in the existing device-local, per-chat layout cache, including Game and reload restoration. Queued edits to different avatars preserve each other. - Update the avatar guide and add deterministic pixel and uploaded-VRM browser regressions. ## Validation Current head: `a49944e051e60d09e0fe86a3d3a338dc31b9e5da`, preserving the owner's staging merge. - `pnpm check`: passed, including localization, formatting, lint, TypeScript and production builds. - The previous `bf0c5b974` official `Dockerfile.lite` arm64 build and existing two-phase container runtime smoke passed. Baked commit was independently verified; API, compiled frontend, native Sharp, non-root startup, writable/persistent settings and environment, and SIGTERM exit0 across replacement all passed. The current-head container proof is pending. - `node scripts/run-regressions.mjs --filter avatar-placement`: 1/1 passed on `bf0c5b974`; its Game callbacks and harness are unchanged by this follow-up. This actual callback queue harness first reproduced one avatar move overwriting another before a render. It now verifies both owner maps, metadata fallback, preserved owner fields, saving outside React updaters, stale-chat callbacks, and preference-cache write failures. It does not mount React. - Game uploaded-VRM placement: 3/3 passed on desktop Chromium, phone Chromium and phone WebKit, including actual rendered canvas resizing, reload restoration, narration staying on the same segment during Arrange/drag, and background navigation resuming after Done. The desktop drag first reproduced narration advancing on `bf0c5b974`. The green browser proof ran on `295e0aed0`; all three follow-up files are byte-identical after the owner merge into the current head. - `pnpm smoke:ui`: 7/7 passed. Retained evidence from earlier combined head `cc371a3b` for unchanged paths: - Node backgrounds 1/1, generation plus cancellation 2/2, and stage logic 1/1 passed. New bottom/fringe assertions failed against the old algorithm. - Uploaded-VRM Roleplay and Game cases covered all three browser profiles; changed Game callbacks were rerun on the final head above. Final light-thumb/Roleplay control-row cases passed on desktop and phone Chromium. An initial phone Game screenshot hit ENOSPC after its feature assertions; its rerun passed after storage recovery. - Existing 2D sprite/avatar Arrange and 2D avatar-generation browser cases each passed all three profiles. - Compiled frontend production startup/reload smoke passed all three profiles. - A read-only replay on the reported 2D source, with explicitly synthetic provider corruption, restored all 2,171 near-outline and 1,935 bottom-row corrupted pixels, preserved every alpha byte, retained generated eyes/teeth/interior white hair and the original bowtie, and left the source file byte-identical. The full local CodeRabbit review covered all eight original files and found one valid minor Game batching issue. That issue is fixed and reproduced by the new harness. The two-file incremental local review completed with no additional findings on `bf0c5b974`. The hosted full review covered all nine files on that head and posted seven comments. This follow-up addresses the Game navigation defect, the semantic Done key, genuine Chromium touch input, and slider styling. A combined incremental local review and substantive current-head hosted review remain merge gates. - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually regenerate blink and talk pictures with the original provider and compare them with the source on dark and light backgrounds. Existing saved pictures and pending old drafts are not rewritten. - The original unsaved phone draft was unavailable. The 2D replay uses synthetic corruption calibrated to the report; no paid generation or production write was made. - Manually verify VRM dragging and resizing on a physical phone. Browser proof uses Chromium CDP touch start/move/end gestures and emulated touchscreen taps, with browser-dispatched held-touch pointer events retained for WebKit. Physical iOS/Android gestures and native shells remain unverified. - Layout preferences are saved on this device for this chat and do not sync across devices. ## Docs and release impact English guide: `docs/agents/avatars.md:34–36` documents the direct controls, keyboard access and device-local persistence. Translation work follows the maintainer's agreed English-change list and release translation sweep: [documented release-cycle instruction](https://github.com/Pasta-Devs/Marinara-Engine/pull/7824#discussion_r4315238393). - [ ] No docs changes needed - [ ] Updated docs as needed - [ ] Translated docs release sweep completed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence [Published fixture-only uploaded-VRM screenshots](https://github.com/Pasta-Devs/Marinara-Engine/pull/7843#issuecomment-6273538453) cover desktop and phone, dark and light controls. The pre-repair desktop capture shows the missing entry point. No unpatched phone screenshot was recorded. The actual 2D character source/replay stays private and local. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Arrange avatars in Roleplay, Visual Novel, and Game chats by dragging them or using the arrow keys. * Adjust each avatar’s size and save its layout for that chat on the current device. Saved layouts persist after reloading but do not sync across devices. * Continue arranging avatars with the Expression Engine’s Arrange mode. * **Bug Fixes** * Improved avatar image outlines, including at canvas edges, while preserving nearby details such as highlights and facial features. <!-- 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-24 04:09:14 +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#7964
No description provided.