mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7837] [MERGED] fix(release): wait for connections before the new-chat gate; no 404 for owners without an avatar #7959
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7959
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7837
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/ready-client-minor-fixes📝 Commits (5)
29d1605fix(release): wait for the connection list before Home opens the connection gate2cf27e8fix(release): answer null, not 404, for an owner without an avatar90b6befMerge staging into client release fixes, retain Tripo test removal76bb909fix(chat): keep new-chat launch guarded until creation completes74023ddfix(chat): await current connections before starting a chat📊 Changes
9 files changed (+316 additions, -55 deletions)
View changed files
📝
e2e/avatar-generation.e2e.ts(+2 -2)📝
e2e/avatar-setup.e2e.ts(+18 -1)➕
e2e/home-new-chat-connections-loading.e2e.ts(+212 -0)📝
packages/client/src/hooks/use-avatar-models.ts(+4 -2)📝
packages/client/src/hooks/use-connections.ts(+12 -9)📝
packages/client/src/hooks/use-start-new-chat-mode.ts(+47 -32)📝
packages/server/src/routes/avatar-models.routes.ts(+5 -3)📝
packages/shared/src/types/avatars.ts(+2 -1)📝
scripts/regressions/avatar-models.regression.ts(+14 -5)📄 Description
Linked issue
No issue exists for either problem. Both were found during the release-readiness pass before the next release. An issue should be opened if one is wanted for tracking.
Why this change
GET /api/avatar-models/:ownerType/:ownerIdanswered 404 for a character or persona with no avatar yet. The browser loggedFailed to load resource: 404every time such an owner was picked on the 2D or 3D Avatars setup page, which looks like an error to anyone reading the console or a support log.What changed
use-start-new-chat-mode.ts: before deciding between the gate and the setup wizard, the hook now waits for the connection list withqueryClient.fetchQuery(connectionListQuery). Taps while the list loads or the new chat saves are ignored, so a second tap cannot make a second chat. Afinallyreleases the guard after either a successful launch, an empty-list gate or a failed request. A list that fails to load still counts as no connections, as before, so the gate keeps working when there really are none.use-connections.ts: the list query's options (key, fetcher, 10 s deadline, retry rule) moved into an exportedconnectionListQuerysouseConnectionsand the hook share them.useConnectionsbehaves the same. This file was not in the lane's expected list; sharing the options here is the way to reuse the same key and fetcher.avatar-models.routes.ts: GET answers JSONnull(200) for an existing owner without an avatar and keeps 404 for an owner that does not exist. The route doc comment, theavatarModelPathdoc inpackages/shared/src/types/avatars.ts, and thefetchAvatarModel/useAvatarModeldocs are updated.fetchAvatarModelstill maps 404 tonull, so a deleted owner still reads as "no avatar".AvatarStage.tsxandAvatarAgentSetup.tsxneeded no change because both already go throughfetchAvatarModel/useAvatarModeland treatnullas "none". Marinara-Agents does not call this route.e2e/home-new-chat-connections-loading.e2e.ts: it holdsGET /api/connectionsuntil after the tap and also holds the firstPOST /api/chatsafter the list loads. Further taps during both waits must send no duplicate save. It then checks that the New Roleplay wizard opens, that no gate appears and that exactly one chat is made. The negative control holds an empty list and checks that the gate opens with "No connections found" and no chat is made.scripts/regressions/avatar-models.regression.tsande2e/avatar-setup.e2e.tsexpected 404 for "nothing saved yet". They now expect 200 with anullbody. The regression also checks the JSON content type and adds 404 checks for a missing character and persona. The 404 check after the character is deleted inavatar-setup.e2e.tsstays.e2e/avatar-generation.e2e.tsreads anullbody safely while it polls.e2e/avatar-setup.e2e.tsnow also fails if the 2D or 3D setup page logs a failed avatar request.Validation
pnpm checkpasses locallyCONTRIBUTING.mdEarlier whole-PR validation at
76bb909d4e1503a213f21667d10076ad9c44f9b5(macOS arm64, Node 24.16.0, pnpm 10.34.5, isolated worktree and disposable data):pnpm install --frozen-lockfile --prefer-offline --store-dir <existing shared store>: exit 0; no lockfile change.pnpm check: exit 0, including localization, formatting, lint/type checks and production build. One pre-existingHomeProfessorMariChat.tsx:380hook-dependency warning remains.node scripts/run-regressions.mjs --filter scripts/regressions/avatar-models.regression.ts: 1/1 passed.avatar-contract.regression.tsandfrozen-server-client-timeouts.regression.tswere run through the same runner separately: 1/1 passed each.pnpm exec playwright test e2e/home-new-chat-connections-loading.e2e.ts e2e/avatar-setup.e2e.ts --grep 'new roleplay|2D Avatars shows|3D Avatars links' --project=desktop-chromium --project=mobile-chromium --project=mobile-webkit --workers=1: 12/12 passed. This covers the held-list and held-save positive case, empty-list negative case, and 2D/3D setup without failed avatar requests in all three browser projects.pnpm exec playwright test --grep '@smoke|Cancel stops the picture being made|3D Avatars points to VRoid Studio|A model made earlier with Tripo|Connections no longer offers Tripo' --project=desktop-chromium --workers=1: 11/11 passed, including all seven desktop smoke cases, null-safe avatar-generation polling and the three replacement Tripo-removal cases.coderabbit review --committed --base origin/staging: the initial substantive review found one valid issue: the guard ended before the first chat save. The held-save negative control reproduced a second POST on90b6bef4a; the guard now spans the full launch. The substantive post-fix review completed across all nine changed files with one minor suggestion, which was dismissed as an intentional non-regression: staging already converted missing query data through(connections ?? [])and opened the connection gate, while this PR preserves that fallback with.catch(() => []). Letting the fetch rejection propagate would instead reachHomeNewChatLauncher's catch, which assumes the create mutation already showed a toast and otherwise swallows the error. Redesigning connection-error UX is outside this PR. No additional code change was made for that suggestion.Final-head stale-cache follow-up at
74023dde9efd8523d74af53d3eef9b8c65f92abf(same macOS arm64 environment, isolated worktree/disposable data):76bb909d4found one valid stale-cache issue:ensureQueryDataimmediately returned cached rows while the mounted connection observer was refetching. The hook now usesfetchQuery(connectionListQuery), which waits for stale data to refresh and joins the observer's pending request. The existing error fallback and full-launch duplicate guard are unchanged.connectionListQueryoptions (five-minute stale time), in both directions: cached empty to configured, and cached configured to empty. The old call returned cached rows immediately; the new call waited for the single held request.76bb909d4: stale empty data opened the wrong connection gate, and stale configured data sent a premature chat save. Both pass with the final fix. The existing two Home launch assertions were retained; the two new cases also check that repeated taps do not make duplicate saves and that no second connection request is made.pnpm check: exit 0, including localization, formatting, lint/types and the production build; the same pre-existing hook-dependency warning remains.pnpm exec playwright test -c playwright.config.ts e2e/home-new-chat-connections-loading.e2e.ts --project=desktop-chromium --project=mobile-chromium --project=mobile-webkit --workers=1(run serially as desktop and mobile groups on private ports): 12/12 passed.pnpm smoke:ui: 7/7 passed.pnpm smoke:production: 3/3 passed across desktop Chromium, mobile Chromium and mobile WebKit.76bb909d4was audited, including its entire body and inline comments: one actionable finding was accepted and fixed; no outside-diff or nitpick items were present. The earlier local fallback suggestion remains the documented dismissal above. Final-head local incremental review, substantive hosted follow-up and required GitHub checks are separate merge gates; pending/rate-limited statuses are not reported as passed.Earlier negative controls: the avatar-models regression failed against staging with
actual: 404, expected: 200; the held-list home case failed against the staging hook in desktop and mobile Chromium because the connection gate opened; and the 3D setup case failed against staging with three avatar 404 console errors. Each passed with this PR.Conflict resolution: merged staging
c248baa9einto this PR and kept staging's deletion of the obsoletee2e/avatar-vrm-generation.e2e.tsTripo-maker test. Its only PR change was a missing-avatar assertion inside a removed paid-generation flow, so it has no corresponding assertion to move to the replacement spec. The active missing-avatar contract remains covered byavatar-models.regression.tsandavatar-setup.e2e.ts; the replacementavatar-vrm-tripo-removed.e2e.tsalso passed above. No production behavior was added during the merge.Manual verification notes
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No user-facing docs or UI copy change.
UI evidence (if applicable)
Behaviour only, no visual change. Before this change, tapping Roleplay while the connection list was still loading opened the "Set Up Roleplay" gate showing "No connections found", even though a connection existed. After it, the New Roleplay setup wizard opens.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.