mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-09 06:18:57 +00:00
* test(auth): lock gateway-unavailable logout to POST (#3001) Issue #3001 reports that the gateway-unavailable fallback rendered the recovery action as a plain link to /api/v1/auth/logout, which browsers navigate via GET against a POST-only endpoint — returning 405 and leaving the stale session cookie intact while the gateway is down or restarting. The code-level fix already landed in #3495: <GatewayOfflineBanner> renders a <button onClick={logout}> wired to AuthProvider.logout's fetch(..., { method: "POST" }). That PR's test suite, however, only covers the banner's pure helpers (visibility + retry interval) and the gateway_unavailable SSR tag — it never asserts that the recovery action actually reaches the network as a POST, so a regression back to a GET-style link/navigation would slip through silently. Add a DOM-level regression test that renders the banner inside a real AuthProvider, simulates a still-down gateway for the /auth/me probe (so the banner stays mounted and its recovery button stays actionable), clicks the button, and asserts that the resulting request is POST /api/v1/auth/logout — never GET. This pins the exact behaviour #3001 requires and fails loudly if the affordance ever regresses. Closes #3001. * test(auth): guard logoutCall against undefined in gateway-offline-banner test TypeScript's noUncheckedIndexedAccess types logoutCalls[0] as T|undefined, which surfaced as TS18048 on the three logoutCall.{url,method} accesses. The waitFor callback already asserts toHaveLength(1) before returning; add an explicit throw guard so the value narrows to a defined Call and the assertions below type-check. Unblocks lint-frontend on #4506. --------- Co-authored-by: now-ing <24534365+now-ing@users.noreply.github.com>