[PR #7643] [MERGED] fix(avatars): clear the Tripo key with Connections data and tidy the key field #7856

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

📋 Pull Request Information

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

Base: staging ← Head: fix/tripo-key-followups


📝 Commits (3)

  • 4cce594 fix(avatars): clear the Tripo key with Connections data and tidy the key field
  • c73ef86 fix(avatars): leave focus alone when the user moved on during a key save
  • 7fe0075 Merge branch 'staging' into fix/tripo-key-followups

📊 Changes

7 files changed (+124 additions, -13 deletions)

View changed files

📝 docs/agents/avatars.md (+1 -1)
📝 docs/data/clearing-data.md (+1 -1)
📝 e2e/avatar-vrm-generation.e2e.ts (+62 -3)
📝 packages/client/src/features/avatars/renderers/vrm/VrmModelMaker.tsx (+38 -7)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/routes/admin.routes.ts (+5 -0)
📝 scripts/regressions/avatar-vrm-generation.regression.ts (+16 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

No linked issue: requested by the maintainer on 2026-10-14.

Follow-up to #7633 (Tripo set up on the 3D Avatars page instead of Connections), which merged before its review findings were fixed. Tripo is on staging only and was never released.

Why this change

  • Clear data kept the Tripo key. Before #7633 the Tripo key was on a connection row, so Settings → Clear data → Connections deleted it. #7633 moved the key to an app setting, and no clear-data scope removed it. After Clear All Data, the 3D Avatars page still showed the balance, and Make 3D model could still spend that account's paid credits. It was the only stored credential that survived a full wipe.
  • The key field was hard to use with a screen reader or keyboard. With a key saved, the field reads as blank: the "Your key is saved" line wasn't linked to it. After Remove (and after Save in some browsers), keyboard focus dropped to the page.
  • A failed key check looked like a lost key. If the key-status request failed (server restarting, network blip), the field showed the "paste your key" state with no Remove, and nothing said the check failed.
  • The docs' bad-key fix didn't fix it. "Paste your key … again" gives the same error when Tripo rejects that key.

What changed

Server

  • admin.routes.ts: the Connections clear-data scope also deletes the tripoApiKey app setting (TRIPO_API_KEY_SETTING from tripo-key.ts), next to the TTS and Speech to Text settings it already deletes. Clear All Data runs every scope, so it removes it too.

3D Avatars page (VrmModelMaker.tsx, Tripo API key field)

  • The help line under the field is now the input's aria-describedby. A screen reader hears "Your key is saved. Paste a new one to replace it." (or the empty-state line) on the field.
  • After Save or Remove from the keyboard, focus returns to the key field instead of dropping to the page. A tap or mouse click doesn't move focus, because focusing the field would open a phone's keyboard. This uses :focus-visible on the element that started the action. Focus is only taken back when it dropped to the page or is still in the key field. If the user moved to another control while the request was running, focus stays there (GitHub CodeRabbit's review comment).
  • While a save or remove is in progress, the input is read-only instead of disabled, so it keeps focus. The buttons still block a second submit.
  • When the key-status request fails and there's no earlier answer, the help line says "Couldn't check whether your Tripo API key is saved." Remove stays hidden. Pasting and saving a key still works and replaces that state. One new string: avatars.vrm.make.key.checkFailed.

Docs

  • docs/agents/avatars.md: Key not accepted now says to paste a working key and select Save, and that Get a key opens Tripo's key page.
  • docs/data/clearing-data.md: Connections also removes the Tripo API key saved on the 3D Avatars page.
  • Translations: #7642 ([docs-i18n] docs/agents/avatars.md, docs/data/clearing-data.md).

Tests

  • scripts/regressions/avatar-vrm-generation.regression.ts: saves a key through PUT /tripo-key, runs POST /api/admin/expunge with the connections scope, then checks that the setting is gone and GET /tripo-key answers { saved: false }. Without the server change this fails (the encrypted key is still stored).
  • e2e/avatar-vrm-generation.e2e.ts:
    • The key input's accessible description matches the help line, both before and after saving.
    • Remove is reached with Tab and pressed with Enter, then the key field is focused.
    • New test A failed key check says so, and a key can still be saved: GET /tripo-key answers 503, the field shows the failure line with no Remove, then Save works. It then presses Remove from the keyboard, holds the request, and focuses the character picker. Once the request is let through, the picker keeps focus.
    • Without the client change, the description, focus and failed-check assertions fail on desktop-chromium. Without the "focus was lost" guard, the picker assertion fails.
  • No existing assertion was weakened or removed. The old Remove step clicked the button; it now uses the keyboard, and every earlier check on that step is still there.

Review findings not changed in code

  • The optional suggestion to shorten the server's bad-key message ("Check your Tripo API key on the 3D Avatars page.") was not taken. The message is accurate wherever it shows, and changing it would be a copy edit the task didn't need.
  • The suggestion to widen the Connections scope description in Settings was not taken. The docs page now says the scope removes the Tripo key, and the in-app description doesn't list the TTS or Speech to Text settings either.
  • #7633's manual check said the key buttons wrap at phone width. They don't: the input narrows so Save and Remove stay on one row, with no horizontal scroll. The note below says that, and the same sentence in #7633's body is corrected.

Validation

  • 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

Commands run by the agent:

  • pnpm check: exit 0, run after each commit. The only lint output is a warning that was already there, in HomeProfessorMariChat.tsx.
  • pnpm localization:check: passed.
  • node scripts/run-regressions.mjs --filter avatar: 17/17 passed.
  • node scripts/run-regressions.mjs --filter connection: 7/7 passed.
  • node scripts/run-regressions.mjs --filter admin: 2/2 passed.
  • node scripts/run-regressions.mjs --filter speech-to-text: 1/1 passed.
  • node scripts/run-regressions.mjs --filter avatar-vrm-generation without the admin.routes.ts change: failed on the new expunge assertion, as expected.
  • npx playwright test e2e/avatar-vrm-generation.e2e.ts --project=desktop-chromium --project=mobile-chromium --workers=1: 8/8 passed, both before and after the focus-guard commit.
  • The same spec on desktop-chromium without the client change failed the new assertions, as expected. With only the refocus disabled, it failed on toBeFocused for the key field. With the guard bypassed, it failed on toBeFocused for the character picker.
  • Local CodeRabbit (coderabbit review --agent --committed --base-commit <merge-base>) on the first commit: review completed, 0 findings, 7 files reviewed. GitHub CodeRabbit then found 1 issue (focus taken back after the user moved on). It is fixed in the second commit, and the thread is answered and resolved.
  • mobile-webkit was not run.

Manual verification notes

  • Manually verify in Settings → Advanced → Danger Zone: save a Tripo key on the 3D Avatars page, clear only Connections, then go back to the 3D Avatars page. The field should say "Paste your Tripo API key to make 3D models." with no balance and no Make 3D model.
  • Manually verify with a screen reader (VoiceOver or NVDA) that, with a key saved, the Tripo API key field is announced with "Your key is saved. Paste a new one to replace it."
  • Manually verify with the keyboard only: Tab to Remove and press Enter. Focus should land in the Tripo API key field. Type a key and press Enter: the key saves and focus stays in the field. Over a slow connection (devtools throttling), press Remove and then Tab away at once: focus should stay where you moved it.
  • Manually verify on a phone: tap Save or Remove. The on-screen keyboard should not pop up afterwards.
  • Manually verify the failed-check line: in the browser devtools, block the request URL /api/avatar-generation/tripo-key (Network → Block request URL), then reload and open the 3D Avatars page. After a second or two the field should say "Couldn't check whether your Tripo API key is saved."
  • Manually verify the key field at phone width in light and dark mode: the input narrows so Save and Remove fit on the same row, with no horizontal scroll.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Docs changed: docs/agents/avatars.md and docs/data/clearing-data.md. Translation follow-up: #7642. No CHANGELOG entry: release notes are compiled from this PR's "What changed".

UI evidence (if applicable)

No new screenshots. The layout didn't change. The e2e still saves tripo-key-empty.png, vrm-model-draft.png and vrm-model-saved.png on both projects.

Summary by CodeRabbit

  • Bug Fixes
    • The 3D Avatars page now reports when it can’t check whether a Tripo API key is saved. Status messages are accessible to screen readers, and keyboard focus is retained appropriately when saving or removing a key.
    • Clearing data under Connections also removes the saved Tripo API key.
  • Documentation
    • Updated guidance on getting a working Tripo API key and what the Connections cleanup removes.

🔄 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/7643 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/tripo-key-followups` --- ### 📝 Commits (3) - [`4cce594`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4cce5946919e3633bbc903688f9efac0cf8646e4) fix(avatars): clear the Tripo key with Connections data and tidy the key field - [`c73ef86`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c73ef86e406f76014a8e3cb45314329a1c0c8e45) fix(avatars): leave focus alone when the user moved on during a key save - [`7fe0075`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7fe0075042710d4ac666dc0e7291be2fc3d47c57) Merge branch 'staging' into fix/tripo-key-followups ### 📊 Changes **7 files changed** (+124 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/avatars.md` (+1 -1) 📝 `docs/data/clearing-data.md` (+1 -1) 📝 `e2e/avatar-vrm-generation.e2e.ts` (+62 -3) 📝 `packages/client/src/features/avatars/renderers/vrm/VrmModelMaker.tsx` (+38 -7) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/routes/admin.routes.ts` (+5 -0) 📝 `scripts/regressions/avatar-vrm-generation.regression.ts` (+16 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue No linked issue: requested by the maintainer on 2026-10-14. Follow-up to #7633 (Tripo set up on the 3D Avatars page instead of Connections), which merged before its review findings were fixed. Tripo is on `staging` only and was never released. ## Why this change - **Clear data kept the Tripo key.** Before #7633 the Tripo key was on a connection row, so Settings → Clear data → **Connections** deleted it. #7633 moved the key to an app setting, and no clear-data scope removed it. After **Clear All Data**, the 3D Avatars page still showed the balance, and **Make 3D model** could still spend that account's paid credits. It was the only stored credential that survived a full wipe. - **The key field was hard to use with a screen reader or keyboard.** With a key saved, the field reads as blank: the "Your key is saved" line wasn't linked to it. After **Remove** (and after **Save** in some browsers), keyboard focus dropped to the page. - **A failed key check looked like a lost key.** If the key-status request failed (server restarting, network blip), the field showed the "paste your key" state with no Remove, and nothing said the check failed. - **The docs' bad-key fix didn't fix it.** "Paste your key … again" gives the same error when Tripo rejects that key. ## What changed **Server** - `admin.routes.ts`: the **Connections** clear-data scope also deletes the `tripoApiKey` app setting (`TRIPO_API_KEY_SETTING` from `tripo-key.ts`), next to the TTS and Speech to Text settings it already deletes. **Clear All Data** runs every scope, so it removes it too. **3D Avatars page (`VrmModelMaker.tsx`, Tripo API key field)** - The help line under the field is now the input's `aria-describedby`. A screen reader hears "Your key is saved. Paste a new one to replace it." (or the empty-state line) on the field. - After **Save** or **Remove** from the keyboard, focus returns to the key field instead of dropping to the page. A tap or mouse click doesn't move focus, because focusing the field would open a phone's keyboard. This uses `:focus-visible` on the element that started the action. Focus is only taken back when it dropped to the page or is still in the key field. If the user moved to another control while the request was running, focus stays there (GitHub CodeRabbit's review comment). - While a save or remove is in progress, the input is read-only instead of disabled, so it keeps focus. The buttons still block a second submit. - When the key-status request fails and there's no earlier answer, the help line says "Couldn't check whether your Tripo API key is saved." Remove stays hidden. Pasting and saving a key still works and replaces that state. One new string: `avatars.vrm.make.key.checkFailed`. **Docs** - `docs/agents/avatars.md`: **Key not accepted** now says to paste a working key and select **Save**, and that **Get a key** opens Tripo's key page. - `docs/data/clearing-data.md`: **Connections** also removes the Tripo API key saved on the **3D Avatars** page. - Translations: #7642 (`[docs-i18n] docs/agents/avatars.md, docs/data/clearing-data.md`). **Tests** - `scripts/regressions/avatar-vrm-generation.regression.ts`: saves a key through `PUT /tripo-key`, runs `POST /api/admin/expunge` with the `connections` scope, then checks that the setting is gone and `GET /tripo-key` answers `{ saved: false }`. Without the server change this fails (the encrypted key is still stored). - `e2e/avatar-vrm-generation.e2e.ts`: - The key input's accessible description matches the help line, both before and after saving. - **Remove** is reached with Tab and pressed with Enter, then the key field is focused. - New test **A failed key check says so, and a key can still be saved**: `GET /tripo-key` answers 503, the field shows the failure line with no Remove, then **Save** works. It then presses **Remove** from the keyboard, holds the request, and focuses the character picker. Once the request is let through, the picker keeps focus. - Without the client change, the description, focus and failed-check assertions fail on desktop-chromium. Without the "focus was lost" guard, the picker assertion fails. - No existing assertion was weakened or removed. The old Remove step clicked the button; it now uses the keyboard, and every earlier check on that step is still there. ### Review findings not changed in code - The optional suggestion to shorten the server's bad-key message ("Check your Tripo API key on the 3D Avatars page.") was not taken. The message is accurate wherever it shows, and changing it would be a copy edit the task didn't need. - The suggestion to widen the **Connections** scope description in Settings was not taken. The docs page now says the scope removes the Tripo key, and the in-app description doesn't list the TTS or Speech to Text settings either. - #7633's manual check said the key buttons wrap at phone width. They don't: the input narrows so **Save** and **Remove** stay on one row, with no horizontal scroll. The note below says that, and the same sentence in #7633's body is corrected. ## Validation - [ ] `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` Commands run by the agent: - `pnpm check`: exit 0, run after each commit. The only lint output is a warning that was already there, in `HomeProfessorMariChat.tsx`. - `pnpm localization:check`: passed. - `node scripts/run-regressions.mjs --filter avatar`: 17/17 passed. - `node scripts/run-regressions.mjs --filter connection`: 7/7 passed. - `node scripts/run-regressions.mjs --filter admin`: 2/2 passed. - `node scripts/run-regressions.mjs --filter speech-to-text`: 1/1 passed. - `node scripts/run-regressions.mjs --filter avatar-vrm-generation` without the `admin.routes.ts` change: failed on the new expunge assertion, as expected. - `npx playwright test e2e/avatar-vrm-generation.e2e.ts --project=desktop-chromium --project=mobile-chromium --workers=1`: 8/8 passed, both before and after the focus-guard commit. - The same spec on desktop-chromium without the client change failed the new assertions, as expected. With only the refocus disabled, it failed on `toBeFocused` for the key field. With the guard bypassed, it failed on `toBeFocused` for the character picker. - Local CodeRabbit (`coderabbit review --agent --committed --base-commit <merge-base>`) on the first commit: review completed, 0 findings, 7 files reviewed. GitHub CodeRabbit then found 1 issue (focus taken back after the user moved on). It is fixed in the second commit, and the thread is answered and resolved. - mobile-webkit was not run. ### Manual verification notes - Manually verify in Settings → Advanced → Danger Zone: save a Tripo key on the 3D Avatars page, clear only **Connections**, then go back to the 3D Avatars page. The field should say "Paste your Tripo API key to make 3D models." with no balance and no **Make 3D model**. - Manually verify with a screen reader (VoiceOver or NVDA) that, with a key saved, the **Tripo API key** field is announced with "Your key is saved. Paste a new one to replace it." - Manually verify with the keyboard only: Tab to **Remove** and press Enter. Focus should land in the **Tripo API key** field. Type a key and press Enter: the key saves and focus stays in the field. Over a slow connection (devtools throttling), press **Remove** and then Tab away at once: focus should stay where you moved it. - Manually verify on a phone: tap **Save** or **Remove**. The on-screen keyboard should not pop up afterwards. - Manually verify the failed-check line: in the browser devtools, block the request URL `/api/avatar-generation/tripo-key` (Network → Block request URL), then reload and open the 3D Avatars page. After a second or two the field should say "Couldn't check whether your Tripo API key is saved." - Manually verify the key field at phone width in light and dark mode: the input narrows so **Save** and **Remove** fit on the same row, with no horizontal scroll. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs changed: `docs/agents/avatars.md` and `docs/data/clearing-data.md`. Translation follow-up: #7642. No CHANGELOG entry: release notes are compiled from this PR's "What changed". ## UI evidence (if applicable) No new screenshots. The layout didn't change. The e2e still saves `tripo-key-empty.png`, `vrm-model-draft.png` and `vrm-model-saved.png` on both projects. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * The 3D Avatars page now reports when it can’t check whether a Tripo API key is saved. Status messages are accessible to screen readers, and keyboard focus is retained appropriately when saving or removing a key. * Clearing data under **Connections** also removes the saved Tripo API key. * **Documentation** * Updated guidance on getting a working Tripo API key and what the Connections cleanup removes. <!-- 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:08:11 +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#7856
No description provided.