Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
chore(lint): reject deprecated API references (#880)
Gener993e05b4ce80
diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 36ff5e6c8..791483b3b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -623,6 +623,9 @@ importers:typescript:specifier: ^6.0.3version: 6.0.3+ typescript-eslint:+ specifier: 8.71.0unified:specifier: ^11.0.5version: 11.0.5@@ -12824,7 +12827,7 @@ snapshots:'@sentry/utils': 7.120.4localforage: 1.10.0- '@sentry/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))':+ '@sentry/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))':dependencies:'@sentry/conventions': 0.16.0'@sentry/core': 10.75.3@@ -12844,7 +12847,7 @@ snapshots:'@opentelemetry/sdk-trace-base': 2.11.0(@opentelemetry/[email protected])'@sentry/conventions': 0.16.0'@sentry/core': 10.75.3- '@sentry/node-core': 10.75.3(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))+ '@sentry/node-core': 10.75.3(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))'@sentry/opentelemetry': 10.75.3(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))'@sentry/server-utils': 10.75.3import-in-the-middle: 3.5.2diff --git a/scripts/ci/eslint-deprecation-fixture.mjs b/scripts/ci/eslint-deprecation-fixture.mjsnew file mode 100644index 000000000..58d931674--- /dev/null+++ b/scripts/ci/eslint-deprecation-fixture.mjs@@ -0,0 +1,70 @@+import assert from "node:assert/strict";+import { randomUUID } from "node:crypto";+import { spawnSync } from "node:child_process";+import { mkdirSync, rmSync, writeFileSync } from "node:fs";+import { createRequire } from "node:module";+import { dirname, join } from "node:path";++export function verifyDeprecatedReferences(packageRoot, locations, existing = []) {+ const require = createRequire(join(packageRoot, "package.json"));+ const cli = join(dirname(require.resolve("eslint/package.json")), "bin/eslint.js");+ const token = randomUUID();+ const paths = locations.map(({ directory, extension }, index) =>+ join(packageRoot, directory, `eslint-deprecation-${token}-${index}${extension}`),+ );+ const existingPaths = existing.map((path) => join(packageRoot, path));+ const deprecated = `import { parse } from "node:url";+/** @deprecated Use currentApi. */+export const legacyApi = () => "legacy";+export const currentApi = () => "current";+export const localResult = legacyApi();+export const dependencyResult = parse("https://example.test/path");+/** @deprecated Compatibility probe. */+export const caretRangeFromPoint = () => "legacy";+export const compatibilityResult = caretRangeFromPoint();+`;+ const supported = `export const currentApi = () => "current";+export const localResult = currentApi();+export const dependencyResult = new URL("https://example.test/path");+`;+ const lint = () => {+ const result = spawnSync(process.execPath, [cli, "--format", "json", ...paths, ...existingPaths], {+ cwd: packageRoot,+ encoding: "utf8",+ timeout: 60_000,+ maxBuffer: 4 * 1024 * 1024,+ });+ assert.equal(result.error, undefined, result.error?.message);+ assert.equal(result.signal, null, result.stderr);+ return { status: result.status, rows: JSON.parse(result.stdout) };+ };+ try {+ for (const path of paths) {+ mkdirSync(dirname(path), { recursive: true });+ writeFileSync(path, deprecated);+ }+ const rejected = lint();+ assert.equal(rejected.status, 1);+ assert.equal(rejected.rows.length, paths.length + existingPaths.length);+ for (const row of rejected.rows) {+ if (existingPaths.includes(row.filePath)) {+ assert.equal(row.errorCount, 0, JSON.stringify(row.messages));+ assert.equal(row.fatalErrorCount, 0);+ continue;+ }+ const errors = row.messages.filter(({ severity }) => severity === 2);+ assert.ok(errors.length >= 3, `${row.filePath}: ${JSON.stringify(row.messages)}`);+ assert.ok(errors.every(({ ruleId }) => ruleId === "@typescript-eslint/no-deprecated"));+ assert.ok(errors.some(({ message }) => message.includes("legacyApi")));+ assert.ok(errors.some(({ message }) => message.includes("parse")));+ assert.ok(errors.some(({ message }) => message.includes("caretRangeFromPoint")));+ }+ for (const path of paths) writeFileSync(path, supported);+ const accepted = lint();+ assert.equal(accepted.status, 0);+ assert.equal(accepted.rows.length, paths.length + existingPaths.length);+ assert.ok(accepted.rows.every(({ errorCount, fatalErrorCount }) => errorCount === 0 && fatalErrorCount === 0));+ } finally {+ for (const path of paths) rmSync(path, { force: true });+ }+}diff --git a/scripts/ci/eslint-deprecation.test.ts b/scripts/ci/eslint-deprecation.test.tsnew file mode 100644index 000000000..260591618--- /dev/null+++ b/scripts/ci/eslint-deprecation.test.ts@@ -0,0 +1,52 @@+import { fileURLToPath } from "node:url"+import { describe, it } from "vitest"+import { verifyDeprecatedReferences } from "./eslint-deprecation-fixture.mjs"++const packages = [+ {+ name: "Web main, Blog, Auth and JavaScript scripts",+ path: "../../src/web/",+ existing: [+ "src/components/community/messages/composer-accessory-rail.dom.test.tsx",+ "src/lib/authenticated-context-menu-policy.ts",+ ],+ locations: [+ { directory: "src", extension: ".test.ts" },+ { directory: "src", extension: ".test.tsx" },+ { directory: "src/app/.well-known", extension: ".test.ts" },+ { directory: "blog/src", extension: ".test.ts" },+ { directory: "auth", extension: ".test.ts" },+ { directory: "scripts", extension: ".mjs" },+ ],+ },+ {+ name: "App source and tests",+ path: "../../src/app/",+ locations: [{ directory: "src", extension: ".test.ts" }],+ },+ {+ name: "Daemon source tests, config and JavaScript tooling",+ path: "../../src/daemon/",+ locations: [+ { directory: "src", extension: ".test.ts" },+ { directory: ".", extension: ".config.ts" },+ { directory: "scripts", extension: ".mjs" },+ ],+ },+ {+ name: "independent agent-driver tests and JavaScript tooling",+ path: "../../src/daemon/agent-driver/",+ locations: [+ { directory: "src", extension: ".test.ts" },+ { directory: "scripts", extension: ".mjs" },+ ],+ },+]++describe("deprecated API lint errors", () => {+ for (const scope of packages) {+ it(`rejects deprecated local and dependency APIs and accepts replacements in ${scope.name}`, () => {+ verifyDeprecatedReferences(fileURLToPath(new URL(scope.path, import.meta.url)), scope.locations, "existing" in scope ? scope.existing : [])+ }, 180_000)+ }+})diff --git a/src/app/eslint.config.mjs b/src/app/eslint.config.mjsindex 8d67ca6ff..897a1df0d 100644--- a/src/app/eslint.config.mjs+++ b/src/app/eslint.config.mjs@@ -3,6 +3,16 @@ import tseslint from "typescript-eslint";const eslintConfig = defineConfig([...tseslint.configs.recommended,+ {+ files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: {+ parserOptions: {+ project: "./tsconfig.json",+ tsconfigRootDir: import.meta.dirname,+ },+ },+ rules: { "@typescript-eslint/no-deprecated": "error" },+ },globalIgnores(["dist/**"]),{files: ["**/*.test.ts"],diff --git a/src/daemon/agent-driver/eslint.config.ts b/src/daemon/agent-driver/eslint.config.tsindex 9fc40e6de..be40e3205 100644--- a/src/daemon/agent-driver/eslint.config.ts+++ b/src/daemon/agent-driver/eslint.config.ts@@ -3,6 +3,15 @@ import { defineConfig } from "eslint/config";export default defineConfig([...baseConfig,+ {+ files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: {+ parserOptions: {+ project: "./tsconfig.eslint.json",+ tsconfigRootDir: import.meta.dirname,+ },+ },+ },{files: ["src/adapters/**/*.ts"],rules: {diff --git a/src/daemon/agent-driver/src/internal/spawnAuthorityLint.test.ts b/src/daemon/agent-driver/src/internal/spawnAuthorityLint.test.tsindex c8bae5330..d754088b1 100644--- a/src/daemon/agent-driver/src/internal/spawnAuthorityLint.test.ts+++ b/src/daemon/agent-driver/src/internal/spawnAuthorityLint.test.ts@@ -1,21 +1,43 @@import { ESLint } from "eslint";import { fileURLToPath } from "node:url";import { resolve } from "node:path";-import { describe, expect, it } from "vitest";+import { randomUUID } from "node:crypto";+import { writeFileSync, rmSync } from "node:fs";+import { afterAll, beforeAll, describe, expect, it } from "vitest";+import adapterConfig from "../../eslint.config.js";const packageRoot = fileURLToPath(new URL("../../", import.meta.url));-const adapterProbe = resolve(packageRoot, "src/adapters/__gate__.ts");+const token = randomUUID();+const cases = [+ ["named import", 'import { spawn } from "node:child_process"; void spawn;'],+ ["namespace import", 'import * as cp from "node:child_process"; void cp.spawn;'],+ ["default import", 'import cp from "child_process"; void cp.spawn;'],+ ["dynamic import", 'import("node:child_process").then((cp) => cp.spawn);'],+].map(([label, source], index) => ({+ label: label!, source: source!,+ path: resolve(packageRoot, `src/adapters/__gate_${token}_${index}.ts`),+}));describe("adapter process-spawn authority lint", () => {- it.each([- ["named import", 'import { spawn } from "node:child_process"; void spawn;'],- ["namespace import", 'import * as cp from "node:child_process"; void cp.spawn;'],- ["default import", 'import cp from "child_process"; void cp.spawn;'],- ["dynamic import", 'import("node:child_process").then((cp) => cp.spawn);'],- ])("rejects the %s bypass", async (_label, source) => {- const eslint = new ESLint({ cwd: packageRoot });- const [result] = await eslint.lintText(source, { filePath: adapterProbe });+ beforeAll(() => {+ for (const probe of cases) writeFileSync(probe.path, probe.source);+ });+ afterAll(() => {+ for (const probe of cases) rmSync(probe.path, { force: true });+ });+ it.each(cases)("rejects the $label bypass", async ({ path }) => {+ const eslint = new ESLint({+ cwd: packageRoot,+ overrideConfigFile: true,+ overrideConfig: adapterConfig,+ });+ const config = await eslint.calculateConfigForFile(path);+ expect(config.rules["@typescript-eslint/no-deprecated"][0]).toBe(2);+ expect(config.languageOptions.parserOptions.project).toBe("./tsconfig.eslint.json");+ expect(config.languageOptions.parserOptions.tsconfigRootDir).toBe(resolve(packageRoot));+ const [result] = await eslint.lintFiles(path);+ expect(result?.fatalErrorCount).toBe(0);expect(result?.errorCount).toBeGreaterThan(0);expect(result?.messages.some((message) =>message.ruleId === "no-restricted-imports" || message.ruleId === "no-restricted-syntax",diff --git a/src/daemon/agent-driver/tsconfig.eslint.json b/src/daemon/agent-driver/tsconfig.eslint.jsonnew file mode 100644index 000000000..0b9634d64--- /dev/null+++ b/src/daemon/agent-driver/tsconfig.eslint.json@@ -0,0 +1,21 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "allowJs": true,+ "noEmit": true,+ "rootDir": "."+ },+ "include": [+ "**/*.ts",+ "**/*.mts",+ "**/*.cts",+ "**/*.js",+ "**/*.mjs",+ "**/*.cjs"+ ],+ "exclude": [+ "node_modules",+ "dist",+ "coverage"+ ]+}diff --git a/src/daemon/eslint.config.ts b/src/daemon/eslint.config.tsindex 6db09117b..6c9afed8c 100644--- a/src/daemon/eslint.config.ts+++ b/src/daemon/eslint.config.ts@@ -3,6 +3,16 @@ import tseslint from "typescript-eslint";const eslintConfig = defineConfig([...tseslint.configs.recommended,+ {+ files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: {+ parserOptions: {+ project: "./tsconfig.eslint.json",+ tsconfigRootDir: import.meta.dirname,+ },+ },+ rules: { "@typescript-eslint/no-deprecated": "error" },+ },globalIgnores(["dist/**", "coverage/**", "agent-driver/**"]),{files: ["src/drivers/**/*.ts", "src/cli/proxyServerApi.ts", "src/server/contract.ts", "src/server/wsControlServer.ts"],diff --git a/src/daemon/tsconfig.eslint.json b/src/daemon/tsconfig.eslint.jsonnew file mode 100644index 000000000..7a9a3b738--- /dev/null+++ b/src/daemon/tsconfig.eslint.json@@ -0,0 +1,22 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "allowJs": true,+ "noEmit": true,+ "rootDir": "."+ },+ "include": [+ "**/*.ts",+ "**/*.mts",+ "**/*.cts",+ "**/*.js",+ "**/*.mjs",+ "**/*.cjs"+ ],+ "exclude": [+ "node_modules",+ "dist",+ "coverage",+ "agent-driver"+ ]+}diff --git a/src/videos/logo/eslint.config.mjs b/src/videos/logo/eslint.config.mjsindex 13b44a0d6..031ee9d6f 100644--- a/src/videos/logo/eslint.config.mjs+++ b/src/videos/logo/eslint.config.mjs@@ -1,3 +1,15 @@import { config } from "@remotion/eslint-config-flat";-export default config;+export default [+ ...config,+ {+ files: ["**/*.{ts,tsx}"],+ languageOptions: {+ parserOptions: {+ project: "./tsconfig.json",+ tsconfigRootDir: import.meta.dirname,+ },+ },+ rules: { "@typescript-eslint/no-deprecated": "error" },+ },+];diff --git a/src/videos/logo/package.json b/src/videos/logo/package.jsonindex 442998b50..2be8080c4 100644--- a/src/videos/logo/package.json+++ b/src/videos/logo/package.json@@ -33,7 +33,8 @@"render:reference-still": "remotion still AlookLogoReference out/reference-frame.png","verify": "npm run lint && node scripts/verify.mjs","upgrade": "remotion upgrade",- "lint": "eslint src && tsc"+ "lint": "eslint src && tsc",+ "test:lint": "node --test scripts/no-deprecated.test.mjs"},"sideEffects": ["*.css"diff --git a/src/videos/logo/scripts/no-deprecated.test.mjs b/src/videos/logo/scripts/no-deprecated.test.mjsnew file mode 100644index 000000000..aac8c2d0c--- /dev/null+++ b/src/videos/logo/scripts/no-deprecated.test.mjs@@ -0,0 +1,10 @@+import { test } from "node:test";+import { fileURLToPath } from "node:url";+import { verifyDeprecatedReferences } from "../../../../scripts/ci/eslint-deprecation-fixture.mjs";++test("Logo rejects deprecated local and dependency APIs and accepts replacements", { timeout: 180_000 }, () => {+ verifyDeprecatedReferences(fileURLToPath(new URL("../", import.meta.url)), [+ { directory: "src", extension: ".ts" },+ { directory: "src", extension: ".tsx" },+ ]);+});diff --git a/src/web/auth/tsconfig.eslint.json b/src/web/auth/tsconfig.eslint.jsonnew file mode 100644index 000000000..e2561d7bc--- /dev/null+++ b/src/web/auth/tsconfig.eslint.json@@ -0,0 +1,21 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "allowJs": true,+ "noEmit": true,+ "rootDir": "."+ },+ "include": [+ "**/*.ts",+ "**/*.tsx",+ "**/*.mts",+ "**/*.cts",+ "**/*.js",+ "**/*.mjs",+ "**/*.cjs",+ "**/*.jsx"+ ],+ "exclude": [+ "node_modules"+ ]+}diff --git a/src/web/blog/tsconfig.eslint.json b/src/web/blog/tsconfig.eslint.jsonnew file mode 100644index 000000000..28b2ad290--- /dev/null+++ b/src/web/blog/tsconfig.eslint.json@@ -0,0 +1,23 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "allowJs": true,+ "noEmit": true,+ "rootDir": "."+ },+ "include": [+ "**/*.ts",+ "**/*.tsx",+ "**/*.mts",+ "**/*.cts",+ "**/*.js",+ "**/*.mjs",+ "**/*.cjs",+ "**/*.jsx"+ ],+ "exclude": [+ "node_modules",+ ".next",+ ".open-next"+ ]+}diff --git a/src/web/eslint.config.mjs b/src/web/eslint.config.mjsindex 01c4134d9..ccf6eeeb6 100644--- a/src/web/eslint.config.mjs+++ b/src/web/eslint.config.mjs@@ -1,12 +1,32 @@import { defineConfig, globalIgnores } from "eslint/config";import nextVitals from "eslint-config-next/core-web-vitals";import nextTs from "eslint-config-next/typescript";+import tseslint from "typescript-eslint";import tailwindCanonicalClasses from "eslint-plugin-tailwind-canonical-classes";const eslintConfig = defineConfig([...nextVitals,...nextTs,...tailwindCanonicalClasses.configs["flat/recommended"],+ {+ files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: {+ parser: tseslint.parser,+ parserOptions: {+ project: "./tsconfig.eslint.json",+ tsconfigRootDir: import.meta.dirname,+ },+ },+ rules: { "@typescript-eslint/no-deprecated": "error" },+ },+ {+ files: ["blog/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: { parserOptions: { project: "./blog/tsconfig.eslint.json" } },+ },+ {+ files: ["auth/**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],+ languageOptions: { parserOptions: { project: "./auth/tsconfig.eslint.json" } },+ },// Override default ignores of eslint-config-next.globalIgnores([// Default ignores of eslint-config-next:diff --git a/src/web/package.json b/src/web/package.jsonindex 6d837a680..440eabff8 100644--- a/src/web/package.json+++ b/src/web/package.json@@ -17,7 +17,7 @@"verify:zone-output": "tsx scripts/verify-zone-output.ts","preflight:bug-reports": "tsx scripts/preflight-bug-reports.ts","start": "next start",- "lint": "eslint src/ blog/ auth/ scripts/",+ "lint": "node --max-old-space-size=6144 node_modules/eslint/bin/eslint.js src/ blog/ auth/ scripts/","deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy","deploy:blog": "pnpm build:blog && opennextjs-cloudflare deploy --config blog/wrangler.toml","deploy:auth": "wrangler deploy --config auth/wrangler.toml",@@ -163,6 +163,7 @@"tailwindcss": "^4","tsx": "^4.23.15","typescript": "^6.0.3",+ "typescript-eslint": "8.71.0","unified": "^11.0.5","vitest": "4.1.11","wrangler": "4.146.0"diff --git a/src/web/src/app/(auth)/sign-in/sign-in-client.tsx b/src/web/src/app/(auth)/sign-in/sign-in-client.tsxindex 0ea89d30a..cf9a9ec1f 100644--- a/src/web/src/app/(auth)/sign-in/sign-in-client.tsx+++ b/src/web/src/app/(auth)/sign-in/sign-in-client.tsx@@ -76,7 +76,7 @@ function SignInForm({},}- async function handleSendCode(e: React.FormEvent) {+ async function handleSendCode(e: React.SubmitEvent) {e.preventDefault()if (retryAfter != null) returnconst observation = startAction("auth_send_code")@@ -133,7 +133,7 @@ function SignInForm({setLoading(false)}- async function handleDevSignIn(e: React.FormEvent) {+ async function handleDevSignIn(e: React.SubmitEvent) {e.preventDefault()const observation = startAction("auth_dev_sign_in")setEmailError("")diff --git a/src/web/src/app/api/community/bots/me/nap/route.ts b/src/web/src/app/api/community/bots/me/nap/route.tsindex f67a69173..c784187c5 100644--- a/src/web/src/app/api/community/bots/me/nap/route.ts+++ b/src/web/src/app/api/community/bots/me/nap/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextResponse, type NextRequest } from "next/server"import { nanoid } from "nanoid"import {@@ -52,7 +53,7 @@ export const POST = withCommunityActor(async (req: NextRequest, ctx) => {}const parsed = CommunityAgentNapRequestSchema.safeParse(raw)if (!parsed.success) {- return NextResponse.json({ error: "invalid nap request", details: parsed.error.flatten() }, { status: 400 })+ return NextResponse.json({ error: "invalid nap request", details: flattenError(parsed.error) }, { status: 400 })}const handoff = parsed.data.handoffdiff --git a/src/web/src/app/api/community/channels/[id]/messages/route.test.ts b/src/web/src/app/api/community/channels/[id]/messages/route.test.tsindex 3ad52dda7..a703a1c1d 100644--- a/src/web/src/app/api/community/channels/[id]/messages/route.test.ts+++ b/src/web/src/app/api/community/channels/[id]/messages/route.test.ts@@ -290,6 +290,50 @@ describe("POST /api/community/channels/[id]/messages", () => {mockGetDMBetween.mockResolvedValue(null)})+ it.each([+ {+ name: "field types",+ body: { channel: 42, content: { text: 17 } },+ details: {+ formErrors: [],+ fieldErrors: {+ channel: ["Invalid input: expected string, received number"],+ content: ["Invalid input: expected string, received number"],+ },+ },+ },+ {+ name: "empty message",+ body: { channel: "/demo#0042/general", content: { text: " " } },+ details: { formErrors: ["message must have text or attachments"], fieldErrors: {} },+ },+ ])("rejects bot schema-invalid $name with the original details wire before target or write work", async ({ body, details }) => {+ const res = await POST(botPostReq(body), ctx)++ expect(res.status).toBe(400)+ await expect(res.json()).resolves.toEqual({ error: "invalid payload", details })+ expect(mockGetPrimaryDb).toHaveBeenCalledOnce()+ for (const [name, mock] of Object.entries({+ resolveServer: mockResolveServerByNameForMember,+ getChannel: mockGetChannel,+ getChannelForMember: mockGetChannelForMember,+ createDm: mockCreateOrGetDM,+ replay: mockGetMessageByAuthorAndNonce,+ duplicate: mockDuplicateCheck,+ rateLimit: mockCheckMessageRateLimit,+ pendingAttachments: mockFindPendingAttachmentsForSender,+ reserveAttachments: mockReserveAttachmentsForMessage,+ createChannel: mockCreateChannel,+ createMessage: mockCreateMessage,+ createMentions: mockCreateMentions,+ activity: mockBumpBotDailyActivityStatement,+ agentProjection: mockToAgentMessage,+ dispatch: mockDispatchCommittedMessage,+ channelFanout: mockFanOutToChannel,+ userBroadcast: mockBroadcastToUserSafe,+ })) expect(mock, name).not.toHaveBeenCalled()+ })+it.each(["text", "forum", "thread"])("rejects a redundant bot send in %s before any message write", async (type) => {mockResolveServerByNameForMember.mockResolvedValue([{ id: "s1" }])mockResolveChannelByNameForMember.mockResolvedValue([{ id: "c1", serverId: "s1", type: "text", parentChannelId: null }])diff --git a/src/web/src/app/api/community/channels/[id]/messages/route.ts b/src/web/src/app/api/community/channels/[id]/messages/route.tsindex 877237a8c..0ab6ff3a0 100644--- a/src/web/src/app/api/community/channels/[id]/messages/route.ts+++ b/src/web/src/app/api/community/channels/[id]/messages/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextRequest, NextResponse } from "next/server"import { withCommunityActor } from "@/lib/middleware/community-actor"import { writeJSON, writeError } from "@/lib/middleware/helpers"@@ -314,7 +315,7 @@ async function handleBotSend(): Promise<NextResponse> {const parsed = CommunityAgentSendRequestSchema.safeParse(raw)if (!parsed.success) {- return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ return NextResponse.json({ error: "invalid payload", details: flattenError(parsed.error) }, { status: 400 })}const body = parsed.datadiff --git a/src/web/src/app/api/community/daemon/activate/route.test.ts b/src/web/src/app/api/community/daemon/activate/route.test.tsindex 50dbad90a..a5f331772 100644--- a/src/web/src/app/api/community/daemon/activate/route.test.ts+++ b/src/web/src/app/api/community/daemon/activate/route.test.ts@@ -116,6 +116,19 @@ describe("POST /api/community/daemon/activate", () => {expect(await res.json()).toMatchObject({ sessionOutcome: "not_committed" })})+ it("keeps flattened field errors and the uncommitted outcome for invalid payloads", async () => {+ const res = await POST(jsonReq({}, { Authorization: "Bearer cmt_abc" }))+ expect(res.status).toBe(400)+ const body = await res.json()+ expect(body).toMatchObject({+ error: "invalid payload", sessionOutcome: "not_committed",+ details: { formErrors: [], fieldErrors: expect.any(Object) },+ })+ expect(Object.keys(body.details)).toEqual(["formErrors", "fieldErrors"])+ expect(Object.keys(body.details.fieldErrors).length).toBeGreaterThan(0)+ expect(mockActivate).not.toHaveBeenCalled()+ })+it("returns 200 + credential/machineId on happy path", async () => {mockActivate.mockResolvedValue({credential: "cmk_alpha",diff --git a/src/web/src/app/api/community/daemon/activate/route.ts b/src/web/src/app/api/community/daemon/activate/route.tsindex bc267a817..ee560ed62 100644--- a/src/web/src/app/api/community/daemon/activate/route.ts+++ b/src/web/src/app/api/community/daemon/activate/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextResponse } from "next/server"import {queries,@@ -33,7 +34,7 @@ export const POST = withCommunityPairingToken(async (req, ctx) => {const parsed = CommunityDaemonActivateRequestSchema.safeParse(raw)if (!parsed.success) {return NextResponse.json(- { error: "invalid payload", details: parsed.error.flatten(), sessionOutcome: "not_committed" },+ { error: "invalid payload", details: flattenError(parsed.error), sessionOutcome: "not_committed" },{ status: 400 })}diff --git a/src/web/src/app/api/community/daemon/enroll-agent/route.ts b/src/web/src/app/api/community/daemon/enroll-agent/route.tsindex 2c350e3a2..8185abc37 100644--- a/src/web/src/app/api/community/daemon/enroll-agent/route.ts+++ b/src/web/src/app/api/community/daemon/enroll-agent/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextResponse } from "next/server"import {queries,@@ -28,7 +29,7 @@ export const POST = withCommunityDaemonAuth(async (req, ctx) => {const parsed = CommunityDaemonEnrollAgentRequestSchema.safeParse(raw)if (!parsed.success) {return NextResponse.json(- { error: "invalid payload", details: parsed.error.flatten() },+ { error: "invalid payload", details: flattenError(parsed.error) },{ status: 400 })}diff --git a/src/web/src/app/api/community/users/me/inbox/ack/route.ts b/src/web/src/app/api/community/users/me/inbox/ack/route.tsindex 38918638f..f980aa9b6 100644--- a/src/web/src/app/api/community/users/me/inbox/ack/route.ts+++ b/src/web/src/app/api/community/users/me/inbox/ack/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextResponse, type NextRequest } from "next/server"import { queries, withD1Retry, CommunityAgentAckRequestSchema, type CommunityCliAckResponse } from "@alook/shared"import { getDb } from "@/lib/db"@@ -54,7 +55,7 @@ export const POST = withCommunityActor(async (req: NextRequest, ctx) => {}const parsed = CommunityAgentAckRequestSchema.safeParse(raw)if (!parsed.success) {- return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ return NextResponse.json({ error: "invalid payload", details: flattenError(parsed.error) }, { status: 400 })}const applied: Array<{ channel: string; seq: number }> = []diff --git a/src/web/src/app/api/community/users/me/inbox/pull/route.test.ts b/src/web/src/app/api/community/users/me/inbox/pull/route.test.tsindex cf894dce7..bc92eb497 100644--- a/src/web/src/app/api/community/users/me/inbox/pull/route.test.ts+++ b/src/web/src/app/api/community/users/me/inbox/pull/route.test.ts@@ -85,6 +85,39 @@ describe("POST /api/community/users/me/inbox/pull — bot arm (folds inboxPull)"expect(res.status).toBe(400)})+ it.each([+ {+ name: "max type",+ body: { max: "5" },+ details: {+ formErrors: [],+ fieldErrors: { max: ["Invalid input: expected number, received string"] },+ },+ },+ {+ name: "body type",+ body: [],+ details: {+ formErrors: ["Invalid input: expected object, received array"],+ fieldErrors: {},+ },+ },+ ])("rejects schema-invalid $name with the original details wire before inbox work", async ({ body, details }) => {+ const res = await POST(req(JSON.stringify(body), { Authorization: "Bearer crk_abc" }))++ expect(res.status).toBe(400)+ await expect(res.json()).resolves.toEqual({ error: "invalid payload", details })+ expect(mockFindActiveAgentRunnerKeyByBearer).toHaveBeenCalledOnce()+ expect(mockGetBotBinding).toHaveBeenCalledOnce()+ for (const [name, mock] of Object.entries({+ visibility: mockListAccessVisibleChannelIdsForUser,+ unread: mockListUnreadMessagesForAgent,+ marks: mockCountMarksForUser,+ attachments: mockListByMessageIds,+ hydration: mockToAgentMessages,+ })) expect(mock, name).not.toHaveBeenCalled()+ })+it("returns an empty page for an inactive bot without querying or hydrating inbox data", async () => {mockGetBotBinding.mockResolvedValue({ machineId: "m_1", runtime: "claude", isActive: false })diff --git a/src/web/src/app/api/community/users/me/inbox/pull/route.ts b/src/web/src/app/api/community/users/me/inbox/pull/route.tsindex 2166884ce..841388036 100644--- a/src/web/src/app/api/community/users/me/inbox/pull/route.ts+++ b/src/web/src/app/api/community/users/me/inbox/pull/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextResponse, type NextRequest } from "next/server"import { queries, withD1Retry, CommunityAgentInboxPullRequestSchema } from "@alook/shared"import { getDb } from "@/lib/db"@@ -49,7 +50,7 @@ export const POST = withCommunityActor(async (req: NextRequest, ctx) => {}const parsed = CommunityAgentInboxPullRequestSchema.safeParse(raw)if (!parsed.success) {- return NextResponse.json({ error: "invalid payload", details: parsed.error.flatten() }, { status: 400 })+ return NextResponse.json({ error: "invalid payload", details: flattenError(parsed.error) }, { status: 400 })}const max = Math.min(parsed.data.max ?? MAX_PULL, MAX_PULL)diff --git a/src/web/src/app/api/machine-tokens/activate/route.ts b/src/web/src/app/api/machine-tokens/activate/route.tsindex d3ed2940f..b03bb320d 100644--- a/src/web/src/app/api/machine-tokens/activate/route.ts+++ b/src/web/src/app/api/machine-tokens/activate/route.ts@@ -1,3 +1,4 @@+import { flattenError } from "zod"import { NextRequest } from "next/server";import { queries, ActivateTokenRequestSchema, createLogger } from "@alook/shared";import { getDb } from "@/lib/db"@@ -20,7 +21,7 @@ export const POST = withEnv(async (req: NextRequest, ctx) => {const parsed = ActivateTokenRequestSchema.safeParse(raw);if (!parsed.success) {- return writeJSON({ error: "invalid payload", details: parsed.error.flatten() }, 400);+ return writeJSON({ error: "invalid payload", details: flattenError(parsed.error) }, 400);}const { token, hostname, runtimes } = parsed.data;diff --git a/src/web/src/app/c/channels/layout.route-memory.dom.test.ts b/src/web/src/app/c/channels/layout.route-memory.dom.test.tsindex d99bb6ef1..58b88929a 100644--- a/src/web/src/app/c/channels/layout.route-memory.dom.test.ts+++ b/src/web/src/app/c/channels/layout.route-memory.dom.test.ts@@ -274,7 +274,7 @@ describe("ServerLayout deletion routing", () => {mocks.routeToken = actual.createOwnerServerDeleteRouteToken(client)registry.runtime.ui.actions.registerUiHandlers({ cancelPendingNavigation: mocks.cancelPendingNavigation, navigatePath: mocks.navigatePath })vi.spyOn(client, "getQueryData")- vi.spyOn(client, "fetchQuery")+ vi.spyOn(client, "query")window.history.replaceState({}, "", "/c/channels/missing-server/missing-channel")mocks.replace.mockClear()mocks.search.current = ""@@ -313,8 +313,8 @@ describe("ServerLayout deletion routing", () => {}return mocks.serverDetails.get(String(key.at(-1)))})- vi.mocked(mocks.queryClient.fetchQuery).mockReset()- vi.mocked(mocks.queryClient.fetchQuery).mockImplementation(({ queryKey }: { queryKey: unknown[] }) => (+ vi.mocked(mocks.queryClient.query).mockReset()+ vi.mocked(mocks.queryClient.query).mockImplementation(({ queryKey }: { queryKey: unknown[] }) => (Promise.resolve(mocks.serverDetails.get(String(queryKey.at(-1))))))mocks.runEject.mockReturnValue(false)diff --git a/src/web/src/app/c/me/layout.route-memory.dom.test.ts b/src/web/src/app/c/me/layout.route-memory.dom.test.tsindex 2e22d3dcd..44944218b 100644--- a/src/web/src/app/c/me/layout.route-memory.dom.test.ts+++ b/src/web/src/app/c/me/layout.route-memory.dom.test.ts@@ -261,12 +261,12 @@ describe("MeLayout route memory", () => {const rendered = renderLayout(queryClient)await act(async () => {await Promise.allSettled([- queryClient.fetchQuery({+ queryClient.query({queryKey: communityKeys.friends(),queryFn: async () => { throw new Error("friends refresh failed") },staleTime: 0,}),- queryClient.fetchQuery({+ queryClient.query({queryKey: communityKeys.accountAttention(),queryFn: async () => { throw new Error("inbox refresh failed") },staleTime: 0,diff --git a/src/web/src/app/device/page.tsx b/src/web/src/app/device/page.tsxindex 0e98d627c..16ed5f43d 100644--- a/src/web/src/app/device/page.tsx+++ b/src/web/src/app/device/page.tsx@@ -79,7 +79,7 @@ function DeviceAuthPageInner() {}}, [isPending, session, router, userCode, source])- const handleVerifyCode = (e: React.FormEvent) => {+ const handleVerifyCode = (e: React.SubmitEvent) => {e.preventDefault()const code = userCode.trim()command.reset()diff --git a/src/web/src/app/pricing/pricing-client.tsx b/src/web/src/app/pricing/pricing-client.tsxindex ab22e935a..f8f8483d9 100644--- a/src/web/src/app/pricing/pricing-client.tsx+++ b/src/web/src/app/pricing/pricing-client.tsx@@ -3,7 +3,7 @@import { useObservedRegion } from "@/lib/observability/regions"import { valueEvidence, mergeEvidence } from "@/lib/observability/data-source"-import { useEffect, useRef, type MutableRefObject } from "react"+import { useEffect, useRef, type RefObject } from "react"import { useRouter, useSearchParams } from "next/navigation"import { useQuery } from "@tanstack/react-query"import { PublicPricingSchema, type PublicPricing, type BillingOffer } from "@alook/shared"@@ -20,7 +20,7 @@ function PricingContent({ signedIn, sessionPending, sessionError, viewTrackedRefsignedIn: booleansessionPending: booleansessionError: boolean- viewTrackedRef: MutableRefObject<boolean>+ viewTrackedRef: RefObject<boolean>}) {const router = useRouter()const search = useSearchParams()@@ -128,7 +128,7 @@ function PricingSession({ signedIn, sessionPending, sessionError, viewTrackedRefsignedIn: booleansessionPending: booleansessionError: boolean- viewTrackedRef: MutableRefObject<boolean>+ viewTrackedRef: RefObject<boolean>}) {return <PublicQueryProvider><PricingContent signedIn={signedIn} sessionPending={sessionPending} sessionError={sessionError} viewTrackedRef={viewTrackedRef} /></PublicQueryProvider>}diff --git a/src/web/src/components/community/machines/machine-list.dom.test.ts b/src/web/src/components/community/machines/machine-list.dom.test.tsindex 69343b7b9..76146bc4c 100644--- a/src/web/src/components/community/machines/machine-list.dom.test.ts+++ b/src/web/src/components/community/machines/machine-list.dom.test.ts@@ -5,7 +5,7 @@ import { renderCommunity as render } from "@/test/community-owner-harness"const mocks = vi.hoisted(() => ({apiFetch: vi.fn(),- fetchQuery: vi.fn(),+ query: vi.fn(),toastSuccess: vi.fn(),toastError: vi.fn(),fetchLatestDaemonVersion: vi.fn(),@@ -81,7 +81,7 @@ vi.mock("./machine-card", () => ({vi.mock("./pair-machine-sheet", () => ({ PairMachineSheet: ({ open, onLimitReached }: { open: boolean; onLimitReached: () => void }) => open ? React.createElement("button", { "data-testid": "test-pair-sheet", onClick: onLimitReached }, "Simulate server limit") : null }))vi.mock("@/components/community/onboarding-tiles/connect-tile", () => ({ ConnectTile: () => null }))vi.mock("@/hooks/community/use-machines", async (importOriginal) => ({ ...await importOriginal<typeof import("@/hooks/community/use-machines")>(),- machinesQueryFn: mocks.fetchQuery,+ machinesQueryFn: mocks.query,useMachines: () => ({ machines: mocks.machines.current, isLoading: mocks.machinesLoading.current, data: { machineCapacity: mocks.capacity.current } }),}))vi.mock("@/hooks/community/use-bots", () => ({ useBots: () => ({ bots: [] }) }))@@ -131,7 +131,7 @@ describe("machine daemon update UI", () => {beforeEach(() => {mocks.capacity.current = { plan: { id: "free", displayName: "Free" }, isFounder: false, limit: 1, ownedCount: 0, onlineCount: 0 }mocks.apiFetch.mockReset()- mocks.fetchQuery.mockReset()+ mocks.query.mockReset()mocks.toastSuccess.mockReset()mocks.toastError.mockReset()mocks.fetchLatestDaemonVersion.mockReset()@@ -167,7 +167,7 @@ describe("machine daemon update UI", () => {})it("refreshes the allowance before showing a server rejection", async () => {- mocks.fetchQuery.mockImplementation(async () => {+ mocks.query.mockImplementation(async () => {mocks.capacity.current = { ...mocks.capacity.current, limit: 5, ownedCount: 5 }return { machines: mocks.machines.current, machineCapacity: mocks.capacity.current }})@@ -175,12 +175,12 @@ describe("machine daemon update UI", () => {fireEvent.click(view.getByRole("button", { name: "Connect a machine" }))fireEvent.click(view.getByText("Simulate server limit"))expect(await view.findByText(/Your plan allows 5 machines/)).toBeInTheDocument()- expect(mocks.fetchQuery).toHaveBeenCalledOnce()+ expect(mocks.query).toHaveBeenCalledOnce()expect(view.queryByTestId("test-pair-sheet")).not.toBeInTheDocument()})it("keeps a failed allowance refresh out of the limit dialog", async () => {- mocks.fetchQuery.mockRejectedValue(new Error("unavailable"))+ mocks.query.mockRejectedValue(new Error("unavailable"))const view = render(React.createElement(MachineList))fireEvent.click(view.getByRole("button", { name: "Connect a machine" }))fireEvent.click(view.getByText("Simulate server limit"))diff --git a/src/web/src/components/community/machines/machine-list.tsx b/src/web/src/components/community/machines/machine-list.tsxindex 91e56d633..efca0fc84 100644--- a/src/web/src/components/community/machines/machine-list.tsx+++ b/src/web/src/components/community/machines/machine-list.tsx@@ -382,7 +382,7 @@ export function MachineList({ onBack }: { onBack?: () => void } = {}) {assert()closePair(false)try {- await queryClient.fetchQuery({ queryKey: communityKeys.machines(), queryFn: machinesQueryFn, staleTime: 0 })+ await queryClient.query({ queryKey: communityKeys.machines(), queryFn: machinesQueryFn, staleTime: 0, select: undefined })assert()setLimitOpen(true)} catch {diff --git a/src/web/src/components/community/messages/attachment-preview-sheet.dom.test.ts b/src/web/src/components/community/messages/attachment-preview-sheet.dom.test.tsindex 75ab88749..dac3f6aee 100644--- a/src/web/src/components/community/messages/attachment-preview-sheet.dom.test.ts+++ b/src/web/src/components/community/messages/attachment-preview-sheet.dom.test.ts@@ -171,13 +171,7 @@ describe("AttachmentPreviewSheet", () => {const fetchMock = vi.fn().mockResolvedValueOnce(new Response("# Hello", { status: 200 })).mockResolvedValueOnce(new Response("download bytes", { status: 200 }))- const anchor = document.createElement("a")- const click = vi.spyOn(anchor, "click").mockImplementation(() => undefined)- vi.spyOn(anchor, "remove").mockImplementation(() => undefined)- const createElement = document.createElement.bind(document)- vi.spyOn(document, "createElement").mockImplementation((tagName, options) => (- tagName === "a" ? anchor : createElement(tagName, options)- ))+ const click = vi.spyOn(window.HTMLAnchorElement.prototype, "click").mockImplementation(() => undefined)vi.stubGlobal("fetch", fetchMock)vi.stubGlobal("URL", { createObjectURL: vi.fn(() => "blob:preview"), revokeObjectURL: vi.fn() })const renderer = render(React.createElement(AttachmentPreviewSheet, {@@ -204,7 +198,7 @@ describe("AttachmentPreviewSheet", () => {})expect(fetchMock).toHaveBeenNthCalledWith(2, "/attachments/a1", { credentials: "same-origin", signal: expect.any(AbortSignal) })await waitFor(() => expect(click).toHaveBeenCalledOnce())- expect(anchor).toEqual(expect.objectContaining({ href: "blob:preview", download: "notes.md" }))+ expect(click.mock.contexts[0]).toEqual(expect.objectContaining({ href: "blob:preview", download: "notes.md" }))expect(click).toHaveBeenCalledOnce()await waitFor(() => expect(renderer.container.querySelector('[data-testid="community-attachment-preview-download"]',diff --git a/src/web/src/components/community/messages/media-attachment-block.dom.test.ts b/src/web/src/components/community/messages/media-attachment-block.dom.test.tsindex 3081d4697..2b4691ccc 100644--- a/src/web/src/components/community/messages/media-attachment-block.dom.test.ts+++ b/src/web/src/components/community/messages/media-attachment-block.dom.test.ts@@ -289,16 +289,7 @@ describe("MediaAttachmentBlock", () => {it("downloads the original file through the shared owner without activating playback", async () => {const stopPropagation = vi.fn()- const createElement = document.createElement.bind(document)- const anchor = createElement("a")- vi.spyOn(anchor, "click").mockImplementation(() => {})- vi.spyOn(anchor, "remove").mockImplementation(() => {})- vi.spyOn(document, "createElement").mockImplementation((function createElementMock(- tagName: string,- options?: ElementCreationOptions,- ) {- return tagName === "a" ? anchor : createElement(tagName, options)- }) as typeof document.createElement)+ const downloadClick = vi.spyOn(window.HTMLAnchorElement.prototype, "click").mockImplementation(() => undefined)vi.stubGlobal("fetch", vi.fn().mockResolvedValue(new Response("media bytes")))vi.stubGlobal("URL", { createObjectURL: vi.fn(() => "blob:media"), revokeObjectURL: vi.fn() })const { renderer, mediaNode } = renderMedia()@@ -312,8 +303,8 @@ describe("MediaAttachmentBlock", () => {})expect(stopPropagation).toHaveBeenCalledOnce()expect(fetch).toHaveBeenCalledWith("/attachments/video-1", { credentials: "same-origin", signal: expect.any(AbortSignal) })- expect(anchor).toEqual(expect.objectContaining({ href: "blob:media", download: "clip.mp4" }))- expect(anchor.click).toHaveBeenCalledOnce()+ expect(downloadClick.mock.contexts[0]).toEqual(expect.objectContaining({ href: "blob:media", download: "clip.mp4" }))+ expect(downloadClick).toHaveBeenCalledOnce()expect(renderer.getByRole("status")).toHaveTextContent("Download started")expect(mediaNode.play).not.toHaveBeenCalled()expect(renderer.container.querySelectorAll("video")).toHaveLength(0)diff --git a/src/web/src/components/community/messages/message-share-dialog.tsx b/src/web/src/components/community/messages/message-share-dialog.tsxindex 223720ca9..8543499c1 100644--- a/src/web/src/components/community/messages/message-share-dialog.tsx+++ b/src/web/src/components/community/messages/message-share-dialog.tsx@@ -161,7 +161,7 @@ export function MessageShareDialog({ m, open, onClose }: {original()const prepared = client.getQueryData<{ value: PreparedShareImageSession; filename: string }>(preparationKey)if (!prepared) throw new ShareImageSessionError("source")- const blob = await client.fetchQuery(pngOptions)+ const blob = await client.query({ ...pngOptions, select: undefined })original()if (action === "copy") {if (mobileNative) {diff --git a/src/web/src/components/community/onboarding/community-onboarding-form.tsx b/src/web/src/components/community/onboarding/community-onboarding-form.tsxindex 5ffa4ac42..c46c35d9c 100644--- a/src/web/src/components/community/onboarding/community-onboarding-form.tsx+++ b/src/web/src/components/community/onboarding/community-onboarding-form.tsx@@ -78,7 +78,7 @@ export function CommunityOnboardingForm() {assert.signal.addEventListener("abort", unsubscribe, { once: true })try {assert()- await queryClient.fetchQuery(options)+ await queryClient.query({ ...options, select: undefined })assert()return [...origin.registry!.collections.channels.values()].filter((channel) => channel.serverId === serverId && !channel.parentChannelId).map(({ id, name }) => ({ id, name }))} finally { assert.signal.removeEventListener("abort", unsubscribe); unsubscribe() }diff --git a/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx b/src/web/src/components/community/onboarding/onboarding-select-dialog.tsxindex 453b73b5a..98e6d9ed5 100644--- a/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx+++ b/src/web/src/components/community/onboarding/onboarding-select-dialog.tsx@@ -5,7 +5,7 @@* contrast: pass (46–50)*/-import { useId, type FormEvent } from "react"+import { useId, type SubmitEvent } from "react"import {CheckIcon,LoaderCircleIcon,@@ -143,7 +143,7 @@ export function OnboardingSelectDialog({}}- const handleSubmit = (event: FormEvent<HTMLFormElement>) => {+ const handleSubmit = (event: SubmitEvent<HTMLFormElement>) => {event.preventDefault()if (!canSubmit || locked) returnonSubmit(submittedValue)diff --git a/src/web/src/components/community/shell/community-inbox-popover.dom.test.ts b/src/web/src/components/community/shell/community-inbox-popover.dom.test.tsindex 35ada92db..00901c93a 100644--- a/src/web/src/components/community/shell/community-inbox-popover.dom.test.ts+++ b/src/web/src/components/community/shell/community-inbox-popover.dom.test.ts@@ -68,7 +68,7 @@ function popover(onOpenChannel: ReturnType<typeof vi.fn>, onOpenThread: ReturnTydescribe("InboxPopover thread opener rows", () => {it("accepts the generic thread callback used by opener-backed buttons", () => {- expectTypeOf<Parameters<typeof InboxPopover>[0]>().toMatchTypeOf<{+ expectTypeOf<Parameters<typeof InboxPopover>[0]>().toExtend<{onOpenThread?: (server: UnreadServer,parent: UnreadServer["channels"][number],diff --git a/src/web/src/components/community/shell/server-sidebar-slot.tsx b/src/web/src/components/community/shell/server-sidebar-slot.tsxindex 88fe26fc1..000526c0f 100644--- a/src/web/src/components/community/shell/server-sidebar-slot.tsx+++ b/src/web/src/components/community/shell/server-sidebar-slot.tsx@@ -193,7 +193,7 @@ function ServerSidebar({ serverId }: { serverId: string }) {const read = () => communityDb ? Array.from(communityDb.collections.channels.values()).filter((channel) => channel.serverId === id && channel.type !== "thread" && !channel.pending).map((channel) => channel.id) : []if (!communityDb?.collections.servers.get(id)?.detailComplete && !lastChannel && read().length === 0) {try {- await queryClient.fetchQuery({ queryKey: communityKeys.server(id), queryFn: ({ signal }) => serverProjectedQueryFn(queryClient, id, signal)(), staleTime: Infinity })+ await queryClient.query({ queryKey: communityKeys.server(id), queryFn: ({ signal }) => serverProjectedQueryFn(queryClient, id, signal)(), staleTime: Infinity, select: undefined })} catch {}}const channelIds = read()diff --git a/src/web/src/components/community/shell/use-shell-profile-controller.dom.test.ts b/src/web/src/components/community/shell/use-shell-profile-controller.dom.test.tsindex e591de2b3..9e58b6b8d 100644--- a/src/web/src/components/community/shell/use-shell-profile-controller.dom.test.ts+++ b/src/web/src/components/community/shell/use-shell-profile-controller.dom.test.ts@@ -18,7 +18,7 @@ const mocks = vi.hoisted(() => ({statusEmoji: "🙂",statusText: "Here",},- fetchQuery: vi.fn(),+ query: vi.fn(),createDm: vi.fn(),acceptDm: vi.fn(),updateProfile: vi.fn(),@@ -42,7 +42,7 @@ vi.mock("sonner", () => ({ toast: mocks.toast }))vi.mock("@/lib/api/client", () => ({ACCOUNT_DELETED_SIGN_IN_PATH: "/sign-in?account_deleted=1",toastApiError: mocks.toastApiError,- apiFetch: (path: string, options: { method?: string; body?: string }) => Promise.resolve(options?.method === "PATCH" ? mocks.updateProfile(JSON.parse(options.body!)) : mocks.fetchQuery(path, options)).then((data) => ({ id: path.split("/").at(-2), name: "Remote", discriminator: "0001", image: null, avatarVersion: 0, bannerColor: null, aboutMe: "", mutualServers: 0, statusEmoji: null, statusText: null, kind: "human", ...data })),+ apiFetch: (path: string, options: { method?: string; body?: string }) => Promise.resolve(options?.method === "PATCH" ? mocks.updateProfile(JSON.parse(options.body!)) : mocks.query(path, options)).then((data) => ({ id: path.split("/").at(-2), name: "Remote", discriminator: "0001", image: null, avatarVersion: 0, bannerColor: null, aboutMe: "", mutualServers: 0, statusEmoji: null, statusText: null, kind: "human", ...data })),}))vi.mock("@/lib/community/image-crop", () => ({ validateIconSourceFile: mocks.validate }))vi.mock("@/contexts/community/current-user", () => ({@@ -238,7 +238,7 @@ describe("useShellProfileController", () => {await act(async () => hook.current.openProfile("Self", { clientX: 2, clientY: 3 } as never, undefined, "self"))expect(hook.current.profile?.data.userId).toBe("self")expect(hook.current.profile?.x).toBe(2)- expect(mocks.fetchQuery).not.toHaveBeenCalled()+ expect(mocks.query).not.toHaveBeenCalled()})it("does not infer self from matching name or discriminator", async () => {@@ -251,7 +251,7 @@ describe("useShellProfileController", () => {expect(hook.current.profile?.data.name).toBe("Self")expect(hook.current.profile?.data.userId).toBeUndefined()- expect(mocks.fetchQuery).not.toHaveBeenCalled()+ expect(mocks.query).not.toHaveBeenCalled()})it("opens a remote seed before fetch and hydrates only card state", async () => {@@ -264,14 +264,14 @@ describe("useShellProfileController", () => {statusText: string | nullkind: "human"}>()- mocks.fetchQuery.mockReturnValue(response.promise)+ mocks.query.mockReturnValue(response.promise)const hook = await renderController()await act(async () => hook.current.openProfile("Remote", { clientX: 4, clientY: 5 } as never, undefined, "remote"))expect(hook.current.profile?.data).toMatchObject({userId: "remote",contextLabel: "Server member",})- expect(mocks.fetchQuery).toHaveBeenCalledWith("/api/community/users/remote/profile", expect.objectContaining({ authenticationAccount: "self" }))+ expect(mocks.query).toHaveBeenCalledWith("/api/community/users/remote/profile", expect.objectContaining({ authenticationAccount: "self" }))expect(hook.queryClient.getQueryCache().find({ queryKey: ["community", "profile", "remote"], exact: true })?.options.staleTime).toBe(300_000)await act(async () => response.resolve({@@ -291,7 +291,7 @@ describe("useShellProfileController", () => {})it("keeps identity fields out of controller state after an authoritative profile fetch", async () => {- mocks.fetchQuery.mockResolvedValue({+ mocks.query.mockResolvedValue({id: "remote",aboutMe: "hydrated",mutualServers: 1,@@ -322,7 +322,7 @@ describe("useShellProfileController", () => {})it("keeps open-card state limited to target and context metadata", async () => {- mocks.fetchQuery.mockReturnValue(new Promise(() => {}))+ mocks.query.mockReturnValue(new Promise(() => {}))const hook = await renderController()await act(async () => hook.current.openProfile("Remote",@@ -340,7 +340,7 @@ describe("useShellProfileController", () => {it("does not let a slow profile response overwrite the next opened card", async () => {const first = deferred<Record<string, unknown>>()const second = deferred<Record<string, unknown>>()- mocks.fetchQuery+ mocks.query.mockReturnValueOnce(first.promise).mockReturnValueOnce(second.promise)const hook = await renderController()@@ -385,7 +385,7 @@ describe("useShellProfileController", () => {})it("hydrates bot ownership, swaps to the exact owner, and routes audit preview", async () => {- mocks.fetchQuery.mockResolvedValueOnce({+ mocks.query.mockResolvedValueOnce({id: "remote",aboutMe: "bot",mutualServers: 0,diff --git a/src/web/src/components/community/shell/use-shell-rail-controller.dom.test.ts b/src/web/src/components/community/shell/use-shell-rail-controller.dom.test.tsindex 6ae00d19c..642b90311 100644--- a/src/web/src/components/community/shell/use-shell-rail-controller.dom.test.ts+++ b/src/web/src/components/community/shell/use-shell-rail-controller.dom.test.ts@@ -95,7 +95,7 @@ async function renderController(overrides: Record<string, unknown> = {}) {}const cache = new Map<string, unknown>()const { client: queryClient, registry } = await createCommunityQueryOwner()- vi.spyOn(queryClient, "fetchQuery")+ vi.spyOn(queryClient, "query")if (!mocks.communityDb.current) mocks.communityDb.current = registryconst options = {@@ -151,7 +151,7 @@ describe("useShellRailController", () => {})expect(hook.pushed).toEqual(["/c/channels/s1", "/c/channels/s2"])- expect(hook.queryClient.fetchQuery).not.toHaveBeenCalled()+ expect(hook.queryClient.query).not.toHaveBeenCalled()expect(mocks.markSwitch).toHaveBeenNthCalledWith(1, "server", "s1")expect(mocks.markSwitch).toHaveBeenNthCalledWith(2, "server", "s2")@@ -197,7 +197,7 @@ describe("useShellRailController", () => {hook.current.navigate("s1", "c1")})expect(hook.pushed).toEqual(["/c/channels/s2", "/c/channels/s1/c1"])- expect(hook.queryClient.fetchQuery).not.toHaveBeenCalled()+ expect(hook.queryClient.query).not.toHaveBeenCalled()expect(mocks.markSwitch).toHaveBeenLastCalledWith("channel", "c1")})@@ -255,7 +255,7 @@ describe("useShellRailController", () => {hook.current.railProps.onHome()})expect(hook.pushed).toEqual(["/c/channels/s2", "/c/me/friends"])- expect(hook.queryClient.fetchQuery).not.toHaveBeenCalled()+ expect(hook.queryClient.query).not.toHaveBeenCalled()})it("restores the remembered server target directly on desktop", async () => {@@ -306,14 +306,14 @@ describe("useShellRailController", () => {await act(async () => hook.current.railProps.onServerNavigate("s1"))expect(hook.pushed).toEqual(["/c/channels/s1/cached"])expect(hook.prefetched).toEqual([])- expect(hook.queryClient.fetchQuery).not.toHaveBeenCalled()+ expect(hook.queryClient.query).not.toHaveBeenCalled()await act(async () => hook.current.railProps.onServerNavigate("s2"))expect(hook.pushed).toContain("/c/channels/s2/cached")expect(hook.prefetched).toEqual([])expect(hook.current.railProps).not.toHaveProperty("onServerPrefetch")expect(hook.current.railProps).not.toHaveProperty("onHomePrefetch")- expect(hook.queryClient.fetchQuery).not.toHaveBeenCalled()+ expect(hook.queryClient.query).not.toHaveBeenCalled()})it("uses the breakpoint-canonical Home destination only on activation", async () => {diff --git a/src/web/src/components/community/shell/user-bar.tsx b/src/web/src/components/community/shell/user-bar.tsxindex 9bba4bcd3..a5a6b4c03 100644--- a/src/web/src/components/community/shell/user-bar.tsx+++ b/src/web/src/components/community/shell/user-bar.tsx@@ -4,9 +4,8 @@ import { useAtom, useCreateAtom } from "@tanstack/react-store";import {useId,useRef,- type MutableRefObject,- type ReactNode,type RefObject,+ type ReactNode,} from "react"import { CircleAlert, Download, LoaderCircle, Settings } from "lucide-react"import { InboxUnreadIndicator } from "./inbox-unread-indicator"@@ -184,7 +183,7 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnreacloseInboxForAction: () => voidprofileTriggerRef: RefObject<HTMLButtonElement | null>profileNameTriggerRef: RefObject<HTMLButtonElement | null>- lastProfileTriggerRef: MutableRefObject<HTMLButtonElement | null>+ lastProfileTriggerRef: RefObject<HTMLButtonElement | null>inboxTriggerRef: RefObject<HTMLButtonElement | null>updateBadgeRef: RefObject<HTMLButtonElement | null>onRequestExtensionFocus: (extension: UserBarExtensionKind) => voiddiff --git a/src/web/src/components/daemon-update-notice.tsx b/src/web/src/components/daemon-update-notice.tsxindex b47521fff..cca7190f2 100644--- a/src/web/src/components/daemon-update-notice.tsx+++ b/src/web/src/components/daemon-update-notice.tsx@@ -103,10 +103,11 @@ export function DaemonUpdateNotice({const token = captureApplicationOwner(owner)const assertActive = () => assertApplicationOwner(token)let active = true- void owner.queryClient.fetchQuery({+ void owner.queryClient.query({queryKey: applicationKey(owner, "daemon-update-check", webVersion, latestDaemonVersion),staleTime: Infinity,queryFn: ({ signal }) => runApplicationRequest(owner, (options) => loadMachines ? loadMachines() : apiFetch<MachinesResponse>("/api/community/machines", options), signal),+ select: undefined,}).then(({ machines }) => {if (!active) returndiff --git a/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts b/src/web/src/components/home-pet/cloud-code-monster-pet-drag.tsindex 5c1d02847..922559506 100644--- a/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts+++ b/src/web/src/components/home-pet/cloud-code-monster-pet-drag.ts@@ -2,7 +2,7 @@import type { Atom } from "@tanstack/react-store";-import { type MutableRefObject, type PointerEvent as ReactPointerEvent, type RefObject, useCallback, useRef } from "react";+import { type RefObject, type PointerEvent as ReactPointerEvent, useCallback, useRef } from "react";import {calculateMonsterWalkIntensity,@@ -34,8 +34,8 @@ type UsePetDragParams = {isDragging: boolean;fainted: boolean;activityState: StoredCloudCodeMonsterActivity | null;- lastFootstepAtRef: MutableRefObject<number>;- violentDragEventsRef: MutableRefObject<number[]>;+ lastFootstepAtRef: RefObject<number>;+ violentDragEventsRef: RefObject<number[]>;setIsDragging: Atom<boolean>["set"];setNotificationActive: Atom<boolean>["set"];setFainted: Atom<boolean>["set"];diff --git a/src/web/src/hooks/community/channel-metadata.test.ts b/src/web/src/hooks/community/channel-metadata.test.tsindex 4a6760ef8..700bf0c68 100644--- a/src/web/src/hooks/community/channel-metadata.test.ts+++ b/src/web/src/hooks/community/channel-metadata.test.ts@@ -29,7 +29,7 @@ describe("canonical channel metadata lifecycle", () => {vi.useFakeTimers()try {const options = channelMetadataOptions(client, serverId, "child")- const result = client.fetchQuery(options)+ const result = client.query(options)const rejected = expect(result).rejects.toMatchObject({ name: "ConversationReadTimeoutError" })await vi.waitFor(() => expect(fetchMock).toHaveBeenCalledOnce())const readSignal = fetchMock.mock.calls[0]![1].signal as AbortSignal@@ -42,7 +42,7 @@ describe("canonical channel metadata lifecycle", () => {expect(runtime.ws.get().channelAccessScopes.has("child")).toBe(false)expect(client.getQueryData(options.queryKey)).toBeUndefined()fetchMock.mockResolvedValueOnce(payload)- await expect(client.fetchQuery(options)).resolves.toMatchObject({ id: "child" })+ await expect(client.query(options)).resolves.toMatchObject({ id: "child" })expect(runtime.ws.get().channelAccessScopes.has("child")).toBe(type !== "dm")expect(fetchMock).toHaveBeenCalledTimes(2)} finally { vi.useRealTimers() }@@ -54,7 +54,7 @@ describe("canonical channel metadata lifecycle", () => {vi.spyOn(registry.collections.channels, "preload").mockImplementationOnce(() => new Promise<void>((resolve) => { release = resolve }))vi.useFakeTimers()try {- const result = client.fetchQuery(channelMetadataOptions(client, "server", "child"))+ const result = client.query(channelMetadataOptions(client, "server", "child"))const rejected = expect(result).rejects.toMatchObject({ name: "ConversationReadTimeoutError" })await vi.advanceTimersByTimeAsync(CONVERSATION_READ_TIMEOUT_MS)await rejected@@ -79,7 +79,7 @@ describe("canonical channel metadata lifecycle", () => {let release!: (value: unknown) => voidfetchMock.mockImplementationOnce(() => new Promise((resolve) => { release = resolve }))const key = communityKeys.channelMeta("server", "child")- const result = client.fetchQuery({+ const result = client.query({queryKey: key,queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal),})@@ -103,7 +103,7 @@ describe("canonical channel metadata lifecycle", () => {let release!: (value: unknown) => voidfetchMock.mockImplementationOnce(() => new Promise((resolve) => { release = resolve }))const { client, runtime } = await createCommunityQueryOwner()- const result = client.fetchQuery({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })+ const result = client.query({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })await vi.waitFor(() => expect(fetchMock).toHaveBeenCalledOnce())const state = runtime.ws.actionsconst epoch = runtime.ws.get().accessEpoch@@ -121,7 +121,7 @@ describe("canonical channel metadata lifecycle", () => {state.revokeChannelAccess("server", "child")state.revokeServerAccess("server")fetchMock.mockResolvedValue(metadata)- await expect(client.fetchQuery({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })).resolves.toMatchObject({+ await expect(client.query({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })).resolves.toMatchObject({archived: false, activityAt: metadata.createdAt,})expect(runtime.ws.actions.isChannelAccessRevoked("child")).toBe(false)@@ -134,7 +134,7 @@ describe("canonical channel metadata lifecycle", () => {const { client, runtime } = await createCommunityQueryOwner()runtime.ws.actions.revokeChannelAccess("server", "child")fetchMock.mockResolvedValue({ ...metadata, ...overrides })- await expect(client.fetchQuery({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })).rejects.toThrow("scope mismatch")+ await expect(client.query({ queryKey: communityKeys.channelMeta("server", "child"), queryFn: ({ signal }) => fetchChannelMetadata(client, "server", "child", signal) })).rejects.toThrow("scope mismatch")expect(runtime.ws.actions.isChannelAccessRevoked("child")).toBe(true)},)diff --git a/src/web/src/hooks/community/community-ws/bundle-events.dom.test.ts b/src/web/src/hooks/community/community-ws/bundle-events.dom.test.tsindex 62d042022..a1fd8f515 100644--- a/src/web/src/hooks/community/community-ws/bundle-events.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/bundle-events.dom.test.ts@@ -316,7 +316,7 @@ describe("useCommunityWs — operation bundles", () => {throw new Error(`unexpected API fetch: ${String(url)}`)})vi.spyOn(capturedQueryClient, "invalidateQueries")- vi.spyOn(capturedQueryClient, "fetchQuery")+ vi.spyOn(capturedQueryClient, "query")const lease = registerReadSurface(capturedQueryClient,"viewer-1",@@ -362,7 +362,7 @@ describe("useCommunityWs — operation bundles", () => {servers: [{ id: "server-1", mentions: 5 }],})vi.spyOn(capturedQueryClient, "invalidateQueries")- vi.spyOn(capturedQueryClient, "fetchQuery")+ vi.spyOn(capturedQueryClient, "query")const frame = await batchFor("message-1", mentionEvents)capturedOnMessage!(frame)@@ -453,7 +453,7 @@ describe("useCommunityWs — operation bundles", () => {}, { once: true })})}- const first = capturedQueryClient.fetchQuery({ queryKey: key, queryFn, staleTime: 0 })+ const first = capturedQueryClient.query({ queryKey: key, queryFn, staleTime: 0 }).catch(() => undefined)await vi.waitFor(() => expect(queryCalls).toBe(1))const cancel = vi.spyOn(capturedQueryClient, "cancelQueries")@@ -478,7 +478,7 @@ describe("useCommunityWs — operation bundles", () => {servers: [{ id: "server-1", mentions: 9 }],})vi.spyOn(capturedQueryClient, "invalidateQueries")- vi.spyOn(capturedQueryClient, "fetchQuery")+ vi.spyOn(capturedQueryClient, "query")capturedOnMessage!(await batchFor("message-late", mentionEvents))expect(capturedQueryClient.getQueryData<{ servers: Array<{ mentions: number }> }>(@@ -876,7 +876,7 @@ describe("useCommunityWs — operation bundles", () => {try {await mountHook({ viewerUserId: "viewer-1" })vi.spyOn(capturedQueryClient, "invalidateQueries")- vi.spyOn(capturedQueryClient, "fetchQuery")+ vi.spyOn(capturedQueryClient, "query")const original = await batchFor("bounded-operation", [{...message,message: { ...message.message, id: "bounded-operation" },diff --git a/src/web/src/hooks/community/community-ws/channel-scope-projection.dom.test.ts b/src/web/src/hooks/community/community-ws/channel-scope-projection.dom.test.tsindex 64bfb2eaa..5ef755297 100644--- a/src/web/src/hooks/community/community-ws/channel-scope-projection.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/channel-scope-projection.dom.test.ts@@ -131,7 +131,7 @@ describe.each(["text", "forum"] as const)("%s canonical thread scope eviction",})let release!: (value: typeof preview) => voidlet requestSignal!: AbortSignal- const pending = capturedQueryClient.fetchQuery({+ const pending = capturedQueryClient.query({queryKey: pendingKey,queryFn: ({ signal }) => {requestSignal = signal@@ -170,7 +170,7 @@ it("cancels an unresolved parent thread list before its child rows can arrive",const key = communityKeys.threads("parent")let release!: (value: ThreadsResponse) => voidlet requestSignal!: AbortSignal- const pending = capturedQueryClient.fetchQuery({+ const pending = capturedQueryClient.query({queryKey: key,queryFn: ({ signal }) => {requestSignal = signaldiff --git a/src/web/src/hooks/community/community-ws/membership-events.dom.test.ts b/src/web/src/hooks/community/community-ws/membership-events.dom.test.tsindex b057fcff5..6ce7b6b89 100644--- a/src/web/src/hooks/community/community-ws/membership-events.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/membership-events.dom.test.ts@@ -93,7 +93,7 @@ describe("useCommunityWs — member events", () => {it("evicts an unresolved reaction-details request when the viewer leaves", async () => {await mountHook({ viewerUserId: "u_me" })const key = communityKeys.reactionDetails("pending_message")- void capturedQueryClient.fetchQuery({+ void capturedQueryClient.query({queryKey: key,queryFn: () => new Promise(() => undefined),}).catch(() => undefined)@@ -201,8 +201,8 @@ describe("useCommunityWs — member events", () => {online: ["u_other"],}))- await capturedQueryClient.fetchQuery({ queryKey: affectedKey, queryFn: affectedQuery })- await capturedQueryClient.fetchQuery({ queryKey: otherKey, queryFn: otherQuery })+ await capturedQueryClient.query({ queryKey: affectedKey, queryFn: affectedQuery })+ await capturedQueryClient.query({ queryKey: otherKey, queryFn: otherQuery })const observer = new QueryObserver(capturedQueryClient, {queryKey: affectedKey,queryFn: affectedQuery,diff --git a/src/web/src/hooks/community/community-ws/membership-events.ts b/src/web/src/hooks/community/community-ws/membership-events.tsindex ca269b860..f50ede2e6 100644--- a/src/web/src/hooks/community/community-ws/membership-events.ts+++ b/src/web/src/hooks/community/community-ws/membership-events.ts@@ -116,10 +116,11 @@ export function handleChannelMemberEvent(await queryClient.cancelQueries({ queryKey: key, exact: true })if (!isChannelMetadataTokenCurrent(token)) returntry {- await queryClient.fetchQuery({+ await queryClient.query({...channelMetadataOptions(queryClient, event.serverId, event.channelId),staleTime: 0,retry: false,+ select: undefined,})if (!isChannelMetadataTokenCurrent(token)) returnconst type = canonicalType()diff --git a/src/web/src/hooks/community/community-ws/message-events.dom.test.ts b/src/web/src/hooks/community/community-ws/message-events.dom.test.tsindex 05d2049a2..e7af2d24c 100644--- a/src/web/src/hooks/community/community-ws/message-events.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/message-events.dom.test.ts@@ -598,7 +598,7 @@ describe("useCommunityWs — message.create", () => {vi.useFakeTimers()try {await mountHook({ viewerUserId: "u_me" })- const fetchAttention = vi.spyOn(capturedQueryClient, "fetchQuery")+ const fetchAttention = vi.spyOn(capturedQueryClient, "query")for (let i = 0; i < 10; i++) {capturedOnMessage!(messageCreate("ch_x", `m_${i}`))capturedOnMessage!({@@ -1110,7 +1110,7 @@ describe("useCommunityWs — DM message.create", () => {pages: [{ messages: [], hasMore: false }],pageParams: [null],})- const fetchAttention = vi.spyOn(capturedQueryClient, "fetchQuery")+ const fetchAttention = vi.spyOn(capturedQueryClient, "query")// A DM is a channel now — its message arrives as `message.create` keyed by// the DM's channel id (which the subscription tracks in `dmConversationId`).const event: CommunityMessageCreate = {diff --git a/src/web/src/hooks/community/community-ws/message-events.ts b/src/web/src/hooks/community/community-ws/message-events.tsindex 1ac9212b4..d61e1bb81 100644--- a/src/web/src/hooks/community/community-ws/message-events.ts+++ b/src/web/src/hooks/community/community-ws/message-events.ts@@ -51,7 +51,7 @@ function warmLiveForumChildOwner(|| !isForumSidebarParent(queryClient, event.serverId, event.parentChannelId)|| hasForumSidebarOwnershipEvidence(queryClient, event.serverId, event.channelId)) return- void queryClient.fetchQuery(channelMetadataOptions(queryClient, event.serverId, event.channelId))+ void queryClient.query({ ...channelMetadataOptions(queryClient, event.serverId, event.channelId), select: undefined }).catch(() => undefined)}diff --git a/src/web/src/hooks/community/community-ws/projection-transaction.test.ts b/src/web/src/hooks/community/community-ws/projection-transaction.test.tsindex 66010c070..031ac2fc4 100644--- a/src/web/src/hooks/community/community-ws/projection-transaction.test.ts+++ b/src/web/src/hooks/community/community-ws/projection-transaction.test.ts@@ -62,7 +62,7 @@ describe("community WS projection transaction", () => {const unsubscribe = observer.subscribe(() => {})const cancel = vi.spyOn(queryClient, "cancelQueries").mockResolvedValue()const invalidate = vi.spyOn(queryClient, "invalidateQueries").mockResolvedValue()- const refetch = vi.spyOn(queryClient, "fetchQuery").mockResolvedValue("current")+ const refetch = vi.spyOn(queryClient, "query").mockResolvedValue("current")const filters = { queryKey: ["community", "servers"] as const, exact: true }runCommunityWsProjectionTransaction(queryClient, (transaction) => {@@ -96,7 +96,7 @@ describe("community WS projection transaction", () => {const invalidate = vi.spyOn(queryClient, "invalidateQueries").mockImplementation(async () => {order.push("invalidate")})- vi.spyOn(queryClient, "fetchQuery").mockImplementation(async () => {+ vi.spyOn(queryClient, "query").mockImplementation(async () => {order.push("refetch")return "current"})@@ -157,6 +157,31 @@ describe("community WS projection transaction", () => {}})+ it("refetches raw data without applying an observer selector to the imperative result", async () => {+ const client = new QueryClient()+ const key = ["selected-read"]+ const select = vi.fn((data: { value: string }) => data.value)+ const read = vi.fn(async () => ({ value: "fresh" }))+ const observer = new QueryObserver(client, {+ queryKey: key, queryFn: read, select, initialData: { value: "prior" }, staleTime: Infinity,+ })+ const unsubscribe = observer.subscribe(() => {})+ const execute = vi.spyOn(client, "query")+ try {+ expect(observer.getCurrentResult().data).toBe("prior")+ expect(select).toHaveBeenCalledOnce()+ runCommunityWsProjectionTransaction(client, (transaction) => {+ transaction.fence("selected", { queryKey: key, exact: true })+ })+ await vi.waitFor(() => expect(execute).toHaveBeenCalledOnce())+ await expect(execute.mock.results[0]!.value).resolves.toEqual({ value: "fresh" })+ expect(execute).toHaveBeenCalledWith(expect.objectContaining({ select: undefined }))+ expect(client.getQueryData(key)).toEqual({ value: "fresh" })+ expect(observer.getCurrentResult().data).toBe("fresh")+ expect(select).toHaveBeenCalledTimes(2)+ } finally { unsubscribe(); client.clear() }+ })+it("absorbs a rejected active replacement while preserving its query error state", async () => {const queryClient = new QueryClient()const prefix = ["community", "channel", "forum_1", "threads"] as constdiff --git a/src/web/src/hooks/community/community-ws/projection-transaction.ts b/src/web/src/hooks/community/community-ws/projection-transaction.tsindex 88a4a2687..1068a220d 100644--- a/src/web/src/hooks/community/community-ws/projection-transaction.ts+++ b/src/web/src/hooks/community/community-ws/projection-transaction.ts@@ -2,7 +2,7 @@ import {hashKey,notifyManager,type InvalidateQueryFilters,- type FetchQueryOptions,+ type QueryExecuteOptions,type QueryClient,type Query,} from "@tanstack/react-query"@@ -27,7 +27,7 @@ type PendingInvalidation = {filters: InvalidateQueryFilterscancellation?: Promise<void>originalQueries?: ReadonlySet<Query>- replacements?: Array<{ query: Query; options: FetchQueryOptions }>+ replacements?: Array<{ query: Query; options: QueryExecuteOptions }>isCurrent?: () => boolean}@@ -56,7 +56,7 @@ function createProjectionTransaction(const originalQueries = new Set(queries)const replacements = queries.filter((query) => query.isActive() && query.options.queryFn)- .map((query) => ({ query, options: { ...query.options, staleTime: 0 } as FetchQueryOptions }))+ .map((query) => ({ query, options: { ...query.options, staleTime: 0 } as QueryExecuteOptions }))const cancellation = queryClient.cancelQueries(filters)if (current) {current.cancellation = cancellation@@ -85,7 +85,7 @@ function createProjectionTransaction(if (isCurrent && !isCurrent()) returnawait Promise.all((replacements ?? []).filter(({ query }) => queryClient.getQueryCache().get(query.queryHash) === query && query.isActive())- .map(({ options }) => queryClient.fetchQuery(options)))+ .map(({ options }) => queryClient.query({ ...options, select: undefined })))}).catch(() => {})} else {void queryClient.invalidateQueries(filters)diff --git a/src/web/src/hooks/community/community-ws/read-state-events.test.ts b/src/web/src/hooks/community/community-ws/read-state-events.test.tsindex 2083c0ef1..ab6d4ff62 100644--- a/src/web/src/hooks/community/community-ws/read-state-events.test.ts+++ b/src/web/src/hooks/community/community-ws/read-state-events.test.ts@@ -267,7 +267,7 @@ describe("same-account read-state WS events", () => {}return Promise.resolve([])})- const oldRequest = queryClient.fetchQuery({+ const oldRequest = queryClient.query({queryKey: communityKeys.notificationSettings(),queryFn: notificationSettingsQueryFn,}).catch(() => undefined)diff --git a/src/web/src/hooks/community/community-ws/reconnect-messages.ts b/src/web/src/hooks/community/community-ws/reconnect-messages.tsindex 6e5bd4840..d5e5f72b3 100644--- a/src/web/src/hooks/community/community-ws/reconnect-messages.ts+++ b/src/web/src/hooks/community/community-ws/reconnect-messages.ts@@ -1,4 +1,4 @@-import { isCancelledError, queryOptions, type InfiniteData, type QueryClient, type QueryKey } from "@tanstack/react-query"+import { CancelledError, queryOptions, type InfiniteData, type QueryClient, type QueryKey } from "@tanstack/react-query"import { apiFetchProfiles, messageProfilePatches } from "@/lib/community/profile-seed"import { getCommunityDbRegistry } from "@/lib/community-db/collections"import { assertCommunityLiveSnapshotTokenCurrent, captureCommunityLiveSnapshotToken, publishCommunityMessages } from "@/lib/community-db/sync"@@ -113,8 +113,8 @@ function reconcile(queryClient: QueryClient, scope: GapRepairScope, target = 0)try { assertCommunityLiveSnapshotTokenCurrent(queryClient, receipt.token, undefined) } catch { current = false }if (!current) queryClient.removeQueries({ queryKey: repairKey, exact: true })}- return queryClient.fetchQuery(messageReconcileOptions(queryClient, scope.scopeId, query.queryKey)).catch((error: unknown) => {- if (!isAbortError(error) && !isCancelledError(error)) throw error+ return queryClient.query({ ...messageReconcileOptions(queryClient, scope.scopeId, query.queryKey), select: undefined }).catch((error: unknown) => {+ if (!isAbortError(error) && !(error instanceof CancelledError)) throw error})})).then(() => undefined)}diff --git a/src/web/src/hooks/community/community-ws/reconnect.dom.test.ts b/src/web/src/hooks/community/community-ws/reconnect.dom.test.tsindex 73b498ea1..1fd1babca 100644--- a/src/web/src/hooks/community/community-ws/reconnect.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/reconnect.dom.test.ts@@ -619,8 +619,8 @@ describe("useCommunityWs — resyncs machines on WS reconnect", () => {const friendsKey = communityKeys.friends()const inboxKey = communityKeys.accountAttention()await Promise.all([- queryClient.fetchQuery({ queryKey: friendsKey, queryFn: friendsQuery }),- queryClient.fetchQuery({ queryKey: inboxKey, queryFn: inboxQuery }),+ queryClient.query({ queryKey: friendsKey, queryFn: friendsQuery }),+ queryClient.query({ queryKey: inboxKey, queryFn: inboxQuery }),])const friendsObserver = new QueryObserver(queryClient, {queryKey: friendsKey,@@ -761,7 +761,7 @@ describe("useCommunityWs — resyncs machines on WS reconnect", () => {fetchCount += 1return { version }}- await queryClient.fetchQuery({ queryKey, queryFn })+ await queryClient.query({ queryKey, queryFn })const observer = new QueryObserver(queryClient, { queryKey, queryFn, staleTime: Infinity })const unsubscribe = observer.subscribe(() => undefined)version = 2@@ -803,7 +803,7 @@ describe("useCommunityWs — resyncs machines on WS reconnect", () => {}for (const serverId of ["srv_a", "srv_b"] as const) {for (const queryKey of keys(serverId)) {- await queryClient.fetchQuery({ queryKey, queryFn: queryFn(serverId, queryKey) })+ await queryClient.query({ queryKey, queryFn: queryFn(serverId, queryKey) })}queryClient.setQueryData(communityKeys.forumSidebarThreads(serverId), { seeded: true })}@@ -831,7 +831,7 @@ describe("useCommunityWs — resyncs machines on WS reconnect", () => {for (const queryKey of keys("srv_b")) {expect(queryClient.getQueryData(queryKey)).toMatchObject({ version: 1 })expect(queryClient.getQueryState(queryKey)?.isInvalidated).toBe(true)- await queryClient.fetchQuery({ queryKey, queryFn: queryFn("srv_b", queryKey) })+ await queryClient.query({ queryKey, queryFn: queryFn("srv_b", queryKey) })expect(queryClient.getQueryData(queryKey)).toMatchObject({ version: 2 })expect(fetches.get(JSON.stringify(queryKey))).toBe(2)}diff --git a/src/web/src/hooks/community/community-ws/reconnect.ts b/src/web/src/hooks/community/community-ws/reconnect.tsindex efcc8c785..b56302b42 100644--- a/src/web/src/hooks/community/community-ws/reconnect.ts+++ b/src/web/src/hooks/community/community-ws/reconnect.ts@@ -251,7 +251,7 @@ function policyExecutors())const settled = await Promise.allSettled([...(viewerUserId- ? [queryClient.fetchQuery({ queryKey: communityKeys.profile(viewerUserId), queryFn: userProfileQueryFn(viewerUserId), staleTime: 0 })]+ ? [queryClient.query({ queryKey: communityKeys.profile(viewerUserId), queryFn: userProfileQueryFn(viewerUserId), staleTime: 0, select: undefined })]: []),...(hasIdentitySurface? [queryClient.invalidateQueries({diff --git a/src/web/src/hooks/community/community-ws/social-events.dom.test.ts b/src/web/src/hooks/community/community-ws/social-events.dom.test.tsindex 1d33f848d..ee6655da2 100644--- a/src/web/src/hooks/community/community-ws/social-events.dom.test.ts+++ b/src/web/src/hooks/community/community-ws/social-events.dom.test.ts@@ -321,7 +321,7 @@ describe("useCommunityWs — friend + mention → invalidate", () => {it("friend.block evicts an unresolved reaction-details request", async () => {await mountHook()const key = communityKeys.reactionDetails("pending_message")- void capturedQueryClient.fetchQuery({+ void capturedQueryClient.query({queryKey: key,queryFn: () => new Promise(() => undefined),}).catch(() => undefined)diff --git a/src/web/src/hooks/community/fetch-all-server-members.ts b/src/web/src/hooks/community/fetch-all-server-members.tsindex 602df94ab..e79d1b3cf 100644--- a/src/web/src/hooks/community/fetch-all-server-members.ts+++ b/src/web/src/hooks/community/fetch-all-server-members.ts@@ -40,7 +40,7 @@ export async function fetchAllServerMembers(queryClient: QueryClient, serverId:const unsubscribe = observer.subscribe(() => undefined)signal?.addEventListener("abort", unsubscribe, { once: true })try {- let data: InfiniteData<Awaited<ReturnType<ReturnType<typeof membersPageQueryFn>>>> = await queryClient.fetchInfiniteQuery(options)+ let data: InfiniteData<Awaited<ReturnType<ReturnType<typeof membersPageQueryFn>>>> = await queryClient.infiniteQuery({ ...options, select: undefined })assert()while (observer.getCurrentResult().hasNextPage) {assert()diff --git a/src/web/src/hooks/community/friend-request-action-order.red.dom.test.tsx b/src/web/src/hooks/community/friend-request-action-order.red.dom.test.tsxindex b003cd6d2..75750fe91 100644--- a/src/web/src/hooks/community/friend-request-action-order.red.dom.test.tsx+++ b/src/web/src/hooks/community/friend-request-action-order.red.dom.test.tsx@@ -4,7 +4,7 @@ import { publishCommunityFriendships, publishAccountAttentionSnapshot, captureCoimport { useFriendshipRows } from "@/lib/community-db/projections"import { createCommunityDbRegistry, registerCommunityDbRegistry } from "@/lib/community-db/collections"import { CommunityDbProvider } from "@/lib/community-db/projections"-import { useCallback, useLayoutEffect, type MutableRefObject } from "react"+import { useCallback, useLayoutEffect, type RefObject } from "react"import {QueryClient,QueryClientProvider,@@ -128,7 +128,7 @@ function TestSurfaces({controlsRef,onPaint,}: {- controlsRef: MutableRefObject<Controls | null>+ controlsRef: RefObject<Controls | null>onPaint?: (paint: Paint) => void}) {const friends = useQuery({@@ -242,7 +242,7 @@ async function createClient(ids: readonly string[] = ["a", "b"]) {function mount(client: QueryClient, onPaint?: (paint: Paint) => void) {const registry = createCommunityDbRegistry(client, "viewer")registerCommunityDbRegistry(registry)- const controls = { current: null } as MutableRefObject<Controls | null>+ const controls = { current: null } as RefObject<Controls | null>const rendered = render(<QueryClientProvider client={client}><CommunityDbProvider registry={registry}><TestSurfaces controlsRef={controls} onPaint={onPaint} /></CommunityDbProvider>@@ -252,7 +252,7 @@ function mount(client: QueryClient, onPaint?: (paint: Paint) => void) {}async function fetchFriends(client: QueryClient) {- return client.fetchQuery({+ return client.query({queryKey: communityKeys.friends(),queryFn: friendsQueryFn,staleTime: 0,diff --git a/src/web/src/hooks/community/inbox-read-reservation.test.ts b/src/web/src/hooks/community/inbox-read-reservation.test.tsindex 1ad314c35..41a28e143 100644--- a/src/web/src/hooks/community/inbox-read-reservation.test.ts+++ b/src/web/src/hooks/community/inbox-read-reservation.test.ts@@ -568,7 +568,7 @@ describe("inbox read reservation", () => {}const observer = new QueryObserver(queryClient, options)const unsubscribe = observer.subscribe(() => undefined)- const originalRead = queryClient.fetchQuery(options).catch((error) => error)+ const originalRead = queryClient.query(options).catch((error) => error)await vi.waitFor(() => expect(signals).toHaveLength(1))await settleInboxReadReservationGeneration(queryClient, 17, false, "focused")diff --git a/src/web/src/hooks/community/mutations/channels.dom.test.ts b/src/web/src/hooks/community/mutations/channels.dom.test.tsindex f1b43248d..7d556245d 100644--- a/src/web/src/hooks/community/mutations/channels.dom.test.ts+++ b/src/web/src/hooks/community/mutations/channels.dom.test.ts@@ -111,7 +111,7 @@ describe("canonical channel move and create", () => {it("physically cancels an in-flight server refetch before the optimistic write", async () => {seed()let signal!: AbortSignal- const read = client.fetchQuery({ queryKey: communityKeys.server("s1"), staleTime: 0, queryFn: (context) => { signal = context.signal; return new Promise<string>(() => {}) } }).catch((error) => error)+ const read = client.query({ queryKey: communityKeys.server("s1"), staleTime: 0, queryFn: (context) => { signal = context.signal; return new Promise<string>(() => {}) } }).catch((error) => error)const held = deferred(), rendered = mount(commands.useCreateChannel), pending = start(rendered.result.current.command, create)await waitFor(() => expect(treeChannels(rendered.result.current.tree).some((row) => row.pending)).toBe(true))expect(signal.aborted).toBe(true)diff --git a/src/web/src/hooks/community/mutations/channels.ts b/src/web/src/hooks/community/mutations/channels.tsindex 773ee09d0..96b3e4c95 100644--- a/src/web/src/hooks/community/mutations/channels.ts+++ b/src/web/src/hooks/community/mutations/channels.ts@@ -82,7 +82,7 @@ async function persistTreeChange<T>(} catch (error) { origin.assert(original); throw error }} })transaction.mutate(() => optimistic(registry!))- try { await transaction.isPersisted.promise } catch (error) { origin.assert(original); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(original); throw error }return result}@@ -169,7 +169,7 @@ export function useRenameChannel() {transaction.mutate(() => registry!.collections.channels.update(args.channelId, (row) => { row.name = args.name.trim() }))if (transaction.mutations.length === 0) return persist()try {- await transaction.isPersisted.promise+ await transaction.when("settled")} catch (error) {origin.assert(original)throw errordiff --git a/src/web/src/hooks/community/mutations/forum-commands.dom.test.ts b/src/web/src/hooks/community/mutations/forum-commands.dom.test.tsindex 023e479e2..e20694166 100644--- a/src/web/src/hooks/community/mutations/forum-commands.dom.test.ts+++ b/src/web/src/hooks/community/mutations/forum-commands.dom.test.ts@@ -152,7 +152,7 @@ describe("Native forum tag transactions", () => {let replacementSignal: AbortSignal | undefined, replacementRead!: Promise<{ tags: string[] }>act(() => {view.client.removeQueries({ queryKey: key, exact: true })- replacementRead = view.client.fetchQuery({ queryKey: key, queryFn: ({ signal }) => {+ replacementRead = view.client.query({ queryKey: key, queryFn: ({ signal }) => {replacementSignal = signalreturn held.promise as Promise<{ tags: string[] }>} })diff --git a/src/web/src/hooks/community/mutations/invites.ts b/src/web/src/hooks/community/mutations/invites.tsindex 17850c82d..eb917d04f 100644--- a/src/web/src/hooks/community/mutations/invites.ts+++ b/src/web/src/hooks/community/mutations/invites.ts@@ -27,7 +27,7 @@ export function useResolveOrCreateInvite(serverId: string) {const unsubscribe = observer.subscribe(() => undefined)assert.signal.addEventListener("abort", unsubscribe, { once: true })let cached: InvitesResponse- try { cached = await client.fetchQuery(options); origin.assert(original); assert() }+ try { cached = await client.query({ ...options, select: undefined }); origin.assert(original); assert() }finally { assert.signal.removeEventListener("abort", unsubscribe); unsubscribe() }const now = new Date().toISOString()const reusable = cached.invites.find((invite) => invite.creatorId === currentUserId && (!invite.expiresAt || invite.expiresAt > now) && (invite.maxUses === null || invite.uses < invite.maxUses))diff --git a/src/web/src/hooks/community/mutations/members.ts b/src/web/src/hooks/community/mutations/members.tsindex bc26abbba..29fe012a2 100644--- a/src/web/src/hooks/community/mutations/members.ts+++ b/src/web/src/hooks/community/mutations/members.ts@@ -60,7 +60,7 @@ function useMemberCommand<TInput extends KickMemberArgs>(kind: "role" | "kick")if (kind === "role") registry.collections.serverMemberships.update(memberKey, (row) => { row.role = (input as SetMemberRoleArgs).role })else registry.collections.serverMemberships.delete(memberKey)})- try { await transaction.isPersisted.promise } catch (error) { origin.assert(original); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(original); throw error }} else await persist()origin.assert(original)} finally { invalidateOriginal() }diff --git a/src/web/src/hooks/community/mutations/server-rail.ts b/src/web/src/hooks/community/mutations/server-rail.tsindex 8772e0178..6465d276e 100644--- a/src/web/src/hooks/community/mutations/server-rail.ts+++ b/src/web/src/hooks/community/mutations/server-rail.ts@@ -59,7 +59,7 @@ export function useServerRailCommit() {} catch (error) { origin.assert(original); throw error }} })transaction.mutate(() => mutateCommunityServerRail(registry!, optimistic.value))- try { await transaction.isPersisted.promise } catch (error) { origin.assert(original); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(original); throw error }return response!},onSettled: (_response, error, args) => {diff --git a/src/web/src/hooks/community/mutations/servers.ts b/src/web/src/hooks/community/mutations/servers.tsindex e8f5d4c77..62a0416b9 100644--- a/src/web/src/hooks/community/mutations/servers.ts+++ b/src/web/src/hooks/community/mutations/servers.ts@@ -123,7 +123,7 @@ export function useLeaveServer() {} catch (error) { origin.assert(token); throw error }} })transaction.mutate(() => mutateViewerMembership(registry, args.serverId))- try { await transaction.isPersisted.promise } catch (error) { origin.assert(token); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(token); throw error }},onError: (_error, _args, context) => {if (!context) return@@ -165,7 +165,7 @@ export function useDeleteServer(callbacks: DeleteServerCallbacks) {} catch (error) { origin.assert(token); throw error }} })transaction.mutate(() => mutateViewerMembership(registry, args.serverId))- try { await transaction.isPersisted.promise } catch (error) { origin.assert(token); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(token); throw error }},onError: (error, args, context) => {cancelOwnerServerDelete(queryClient, args.serverId, context?.routeToken)@@ -221,7 +221,7 @@ export function useUpdateServer() {if (!registry!.collections.servers.has(args.serverId)) return persist()const transaction = registry!.dbClient.createTransaction({ mutationFn: persist })transaction.mutate(() => registry!.collections.servers.update(args.serverId, (row) => { row.name = args.name.trim(); row.description = args.description }))- try { await transaction.isPersisted.promise } catch (error) { origin.assert(original); throw error }+ try { await transaction.when("settled") } catch (error) { origin.assert(original); throw error }},onSettled: (_data, error, args) => {if (isAbortError(error) || !origin.registry?.runtime.lifecycle.get().active) returndiff --git a/src/web/src/hooks/community/use-account-attention.ts b/src/web/src/hooks/community/use-account-attention.tsindex 9491ce92b..48e6d0d90 100644--- a/src/web/src/hooks/community/use-account-attention.ts+++ b/src/web/src/hooks/community/use-account-attention.ts@@ -81,10 +81,11 @@ export function useAccountAttentionProjection() {export async function reconcileAccountAttention(registry: CommunityDbRegistry,) {- const snapshot = await registry.queryClient.fetchQuery({+ const snapshot = await registry.queryClient.query({queryKey: communityKeys.accountAttention(),queryFn: accountAttentionQueryFn(registry.queryClient),staleTime: 0,+ select: undefined,})return snapshot}diff --git a/src/web/src/hooks/community/use-channel-members.ts b/src/web/src/hooks/community/use-channel-members.tsindex a0a92d208..3762a3090 100644--- a/src/web/src/hooks/community/use-channel-members.ts+++ b/src/web/src/hooks/community/use-channel-members.ts@@ -74,7 +74,7 @@ async function readChannelRoster(client: QueryClient, channelId: string, serverIconst unsubscribe = observer.subscribe(() => undefined)signal.addEventListener("abort", unsubscribe, { once: true })try {- const window = await client.fetchQuery(options)+ const window = await client.query({ ...options, select: undefined })assert()return window} finally { signal.removeEventListener("abort", unsubscribe); unsubscribe() }diff --git a/src/web/src/hooks/community/use-channel-metadata.dom.test.ts b/src/web/src/hooks/community/use-channel-metadata.dom.test.tsindex dd1ddb71b..ee3ebeff0 100644--- a/src/web/src/hooks/community/use-channel-metadata.dom.test.ts+++ b/src/web/src/hooks/community/use-channel-metadata.dom.test.ts@@ -84,7 +84,7 @@ describe("shared Channel resource and canonical DM publication", () => {const { client, registry, wrapper } = await fixture()ingestDms(registry, dms)apiFetch.mockResolvedValue(metadata)- await client.fetchQuery(channelMetadataOptions(client, null, metadata.id))+ await client.query(channelMetadataOptions(client, null, metadata.id))const route = renderHook(() => ({ route: useDmRouteVerification(metadata.id), peers: useDmProjection() }), { wrapper })await waitFor(() => expect(route.result.current.route.status).toBe("present"))await waitFor(() => expect(route.result.current.peers?.[0]).toMatchObject({ id: metadata.id, name: "Peer", preview: "canonical preview" }))diff --git a/src/web/src/hooks/community/use-channel-panels.test.ts b/src/web/src/hooks/community/use-channel-panels.test.tsindex 0ba0bf646..f1a4f0484 100644--- a/src/web/src/hooks/community/use-channel-panels.test.ts+++ b/src/web/src/hooks/community/use-channel-panels.test.ts@@ -43,7 +43,7 @@ describe("useThreads / threadsQueryFn", () => {.mockResolvedValueOnce({ participants: [] })const { threadsQueryFn } = await import("./use-channel-panels")const key = communityKeys.threads("ch_1")- await qc.fetchQuery({ queryKey: key, queryFn: threadsQueryFn("ch_1", qc) })+ await qc.query({ queryKey: key, queryFn: threadsQueryFn("ch_1", qc) })expect(qc.getQueryData<{ threads: unknown[] }>(key)?.threads).toHaveLength(1)})@@ -85,7 +85,7 @@ describe("useThreads / threadsQueryFn", () => {})const { threadsQueryFn } = await import("./use-channel-panels")const key = communityKeys.threads("forum_1")- const pending = qc.fetchQuery({ queryKey: key, queryFn: threadsQueryFn("forum_1", qc) }).catch(() => undefined)+ const pending = qc.query({ queryKey: key, queryFn: threadsQueryFn("forum_1", qc) }).catch(() => undefined)await vi.waitFor(() => expect(apiFetchMock).toHaveBeenCalledTimes(4))await qc.cancelQueries({ queryKey: key, exact: true })expect(new Set(signals).size).toBe(1)@@ -107,7 +107,7 @@ describe("usePins / pinsQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ pins: [{ id: "m_1", type: "chat", authorId: "u1", authorName: "A", content: "pin", createdAt: "now" }] })const { pinsQueryFn } = await import("./use-channel-panels")const key = communityKeys.pins("ch_1")- await qc.fetchQuery({ queryKey: key, queryFn: pinsQueryFn("ch_1", qc) })+ await qc.query({ queryKey: key, queryFn: pinsQueryFn("ch_1", qc) })expect(qc.getQueryData<{ pins: unknown[] }>(key)?.pins).toHaveLength(1)})})diff --git a/src/web/src/hooks/community/use-community-ws-foreground.dom.test.ts b/src/web/src/hooks/community/use-community-ws-foreground.dom.test.tsindex 687d19e51..b88a1cd7d 100644--- a/src/web/src/hooks/community/use-community-ws-foreground.dom.test.ts+++ b/src/web/src/hooks/community/use-community-ws-foreground.dom.test.ts@@ -103,7 +103,7 @@ describe("community foreground message reconciliation", () => {throw new Error(`unexpected fetch: ${String(path)}`)})const cancel = vi.spyOn(capturedQueryClient, "cancelQueries")- const reads = vi.spyOn(capturedQueryClient, "fetchQuery")+ const reads = vi.spyOn(capturedQueryClient, "query")let foreground!: void | Promise<void>; act(() => { foreground = capturedUseUserWsOptions!.onForeground!() })await vi.waitFor(() => expect(release).toBeTypeOf("function"))let duplicate!: void | Promise<void>, reconnect!: void | Promise<void>diff --git a/src/web/src/hooks/community/use-dm-route-verification.dom.test.ts b/src/web/src/hooks/community/use-dm-route-verification.dom.test.tsindex 4e2f8f38d..4c42de77f 100644--- a/src/web/src/hooks/community/use-dm-route-verification.dom.test.ts+++ b/src/web/src/hooks/community/use-dm-route-verification.dom.test.ts@@ -60,7 +60,7 @@ describe("DM route uses the shared Channel metadata owner", () => {it("reuses the same metadata Query when another Channel consumer has already fetched it", async () => {const { client, registry, wrapper } = await fixture()apiFetch.mockResolvedValue(metadata)- await client.fetchQuery(channelMetadataOptions(client, null, dm.id))+ await client.query(channelMetadataOptions(client, null, dm.id))const route = renderHook(() => useDmRouteVerification(dm.id), { wrapper })expect(route.result.current.status).toBe("present")await expect(startDmRouteVerification(client, dm.id)).resolves.toBe("present")diff --git a/src/web/src/hooks/community/use-dm-route-verification.ts b/src/web/src/hooks/community/use-dm-route-verification.tsindex fa43a24bc..6b0e1d73c 100644--- a/src/web/src/hooks/community/use-dm-route-verification.ts+++ b/src/web/src/hooks/community/use-dm-route-verification.ts@@ -44,8 +44,8 @@ export async function startDmRouteVerification(const token = captureCommunityLiveSnapshotToken(queryClient)try {const cached = queryClient.getQueryData<{ verification?: ReturnType<typeof captureChannelMetadataToken> }>(options.queryKey)- await queryClient.fetchQuery({ ...options,- staleTime: cached?.verification && isChannelMetadataTokenCurrent(cached.verification) ? Infinity : 0 })+ await queryClient.query({ ...options,+ staleTime: cached?.verification && isChannelMetadataTokenCurrent(cached.verification) ? Infinity : 0, select: undefined })return "present"} catch (error) {assertCommunityLiveSnapshotTokenCurrent(queryClient, token, undefined)diff --git a/src/web/src/hooks/community/use-dms.dom.test.ts b/src/web/src/hooks/community/use-dms.dom.test.tsindex 26d5fb874..f736a66f3 100644--- a/src/web/src/hooks/community/use-dms.dom.test.ts+++ b/src/web/src/hooks/community/use-dms.dom.test.ts@@ -59,7 +59,7 @@ describe("useDms / dmsQueryFn", () => {]apiFetchMock.mockResolvedValueOnce({ conversations })const { client: qc, registry } = await createCommunityQueryOwner()- const data = await qc.fetchQuery({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(getActiveAccountUnreadProjection(qc), qc) })+ const data = await qc.query({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(getActiveAccountUnreadProjection(qc), qc) })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/me/dms", expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }))expect(data).toEqual({ ids: ["dm_1"] })expect(registry.collections.channels.get("dm_1")?.type).toBe("dm")@@ -70,7 +70,7 @@ describe("useDms / dmsQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ conversations: [] })const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.dms()- await qc.fetchQuery({ queryKey: key, queryFn: dmsProjectedQueryFn(getActiveAccountUnreadProjection(qc), qc) })+ await qc.query({ queryKey: key, queryFn: dmsProjectedQueryFn(getActiveAccountUnreadProjection(qc), qc) })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/me/dms",expect.objectContaining({ signal: expect.any(AbortSignal) }),@@ -87,7 +87,7 @@ describe("useDms / dmsQueryFn", () => {projection.recordArrival({ channelId: "dm_1", seq: 3 })const { client: queryClient } = await createCommunityQueryOwner()- await queryClient.fetchQuery({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(projection, queryClient) })+ await queryClient.query({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(projection, queryClient) })expect(projection.projectUnread("dms", "dm_1", false)).toBe(false)})@@ -139,7 +139,7 @@ describe("useDms / dmsQueryFn", () => {const { dmsProjectedQueryFn } = await import("./use-dms")const { AccountUnreadProjection } = await import("./account-unread-projection")- await queryClient.fetchQuery({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(new AccountUnreadProjection("viewer"), queryClient) })+ await queryClient.query({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(new AccountUnreadProjection("viewer"), queryClient) })expect(registry.collections.channels.get("dm-current")).toBeUndefined()unregister()@@ -153,7 +153,7 @@ describe("useDms / dmsQueryFn", () => {const projection = new AccountUnreadProjection("u1")const { client: qc } = await createCommunityQueryOwner()- await expect(qc.fetchQuery({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(projection, qc) })).rejects.toThrow("offline")+ await expect(qc.query({ queryKey: communityKeys.dms(), queryFn: dmsProjectedQueryFn(projection, qc) })).rejects.toThrow("offline")expect(projection.inspectForTests().pendingSnapshots).toBe(0)})diff --git a/src/web/src/hooks/community/use-folders.test.ts b/src/web/src/hooks/community/use-folders.test.tsindex c7353c458..d264d5d19 100644--- a/src/web/src/hooks/community/use-folders.test.ts+++ b/src/web/src/hooks/community/use-folders.test.ts@@ -45,7 +45,7 @@ describe("useFolders / foldersQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ folders: [] })const { foldersProjectedQueryFn } = await import("./use-folders")const key = communityKeys.folders()- await qc.fetchQuery({ queryKey: key, queryFn: foldersProjectedQueryFn(qc) })+ await qc.query({ queryKey: key, queryFn: foldersProjectedQueryFn(qc) })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/me/server-folders",expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }),@@ -59,7 +59,7 @@ describe("useFolders / foldersQueryFn", () => {apiFetchMock.mockReturnValueOnce(new Promise((resolve) => { release = resolve }))const { foldersProjectedQueryFn } = await import("./use-folders")- const pending = qc.fetchQuery({ queryKey: communityKeys.folders(), queryFn: foldersProjectedQueryFn(qc) }).catch((error: unknown) => error)+ const pending = qc.query({ queryKey: communityKeys.folders(), queryFn: foldersProjectedQueryFn(qc) }).catch((error: unknown) => error)await vi.waitFor(() => expect(apiFetchMock).toHaveBeenCalledOnce())registry.runtime.ws.actions.revokeServerAccess("server_1")release({ folders: [] })diff --git a/src/web/src/hooks/community/use-forum-feed.dom.test.ts b/src/web/src/hooks/community/use-forum-feed.dom.test.tsindex 6df571373..3adc3d662 100644--- a/src/web/src/hooks/community/use-forum-feed.dom.test.ts+++ b/src/web/src/hooks/community/use-forum-feed.dom.test.ts@@ -36,7 +36,7 @@ beforeEach(async () => { client = (await createCommunityQueryOwner()).client; apasync function projectPages(pages: ForumFeedTransportPage[], canonical?: ReadonlyMap<string, never>) {apiFetchMock.mockReset()for (const page of pages) apiFetchMock.mockResolvedValueOnce(page)- const data = await client.fetchInfiniteQuery({ queryKey: communityKeys.forumFeed("forum_1", null), queryFn: forumFeedPageQueryFn("forum_1", null, client), initialPageParam: null as string | null, getNextPageParam: (last) => last.hasMore ? last.nextCursor : undefined, pages: pages.length })+ const data = await client.infiniteQuery({ queryKey: communityKeys.forumFeed("forum_1", null), queryFn: forumFeedPageQueryFn("forum_1", null, client), initialPageParam: null as string | null, getNextPageParam: (last) => last.hasMore ? last.nextCursor : undefined, pages: pages.length })const registry = getCommunityDbRegistry(client)!return mapForumFeedPages(data.pages, canonical ?? new Map(getCanonicalCommunityMessages(client).map((row) => [row.id, row])), new Map(getCanonicalCommunityChannels(client).map((row) => [row.id, row])), new Map([...registry.collections.profiles.values()].map((row) => [row.userId, row])))}@@ -176,7 +176,7 @@ describe("mapForumFeedPages", () => {})let release!: (value: ForumFeedTransportPage) => voidapiFetchMock.mockResolvedValueOnce(page("first", "Initial", true)).mockReturnValueOnce(new Promise((resolve) => { release = resolve }))- const request = client.fetchInfiniteQuery({ queryKey: communityKeys.forumFeed("forum_1", null), queryFn: forumFeedPageQueryFn("forum_1", null, client), initialPageParam: null as string | null, getNextPageParam: (last) => last.hasMore ? last.nextCursor : undefined, pages: 2 })+ const request = client.infiniteQuery({ queryKey: communityKeys.forumFeed("forum_1", null), queryFn: forumFeedPageQueryFn("forum_1", null, client), initialPageParam: null as string | null, getNextPageParam: (last) => last.hasMore ? last.nextCursor : undefined, pages: 2 })await waitFor(() => expect(apiFetchMock).toHaveBeenCalledTimes(2))writeCommunityProfilePatches([{ id: "author", identityAbout: { name: "Newer WS" } }], registry, { event: true })const next = page("second", "Old later page", false), duplicate = page("first", "Old duplicate", false)diff --git a/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts b/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.tsindex 6d7bed790..84a961b2d 100644--- a/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts+++ b/src/web/src/hooks/community/use-forum-sidebar-threads.dom.test.ts@@ -1,6 +1,6 @@import "fake-indexeddb/auto"import { createElement, type PropsWithChildren } from "react"-import { dehydrate, hydrate, isCancelledError, QueryClient, QueryClientProvider } from "@tanstack/react-query"+import { dehydrate, hydrate, CancelledError, QueryClient, QueryClientProvider } from "@tanstack/react-query"import { beforeEach, describe, expect, it, vi } from "vitest"import { act, renderHook, waitFor } from "@/test/react-dom-harness"import { createCommunityDbRegistry, registerCommunityDbRegistry } from "@/lib/community-db/collections"@@ -968,7 +968,7 @@ describe("forum sidebar canonical projection", () => {retainedDisposition: "eligible",included: retained.included,})- expect(isCancelledError(await grant)).toBe(true)+ expect((await grant) instanceof CancelledError).toBe(true)expect(getCanonicalCommunityChannels(queryClient).some(({ id }) => id === "post-1")).toBe(false)})diff --git a/src/web/src/hooks/community/use-forum-sidebar-threads.ts b/src/web/src/hooks/community/use-forum-sidebar-threads.tsindex 12b34de1b..7f5f44255 100644--- a/src/web/src/hooks/community/use-forum-sidebar-threads.ts+++ b/src/web/src/hooks/community/use-forum-sidebar-threads.ts@@ -536,7 +536,7 @@ async function fetchForumSidebarBaseExact(const requestEpoch = getCommunityRuntime(queryClient).ws.get().accessEpochlet normalized: NormalizedForumSidebarEnvelope | undefinedlet proof: CommunityFreshQueryProof | undefined- await queryClient.fetchQuery({+ await queryClient.query({queryKey,staleTime: 0,queryFn: async ({ signal }) => {@@ -564,6 +564,7 @@ async function fetchForumSidebarBaseExact(verifiedEpoch: requestEpoch,}},+ select: undefined,})if (!normalized || !proof) throw new Error("Forum sidebar base fetch did not settle")return { normalized, proof }@@ -688,7 +689,7 @@ export async function grantForumSidebarChild(queryClient: QueryClient, serverId:const observer = new QueryObserver(queryClient, { ...options, enabled: false })const release = observer.subscribe(() => undefined)assertActive?.signal.addEventListener("abort", release, { once: true })- try { const value = await queryClient.fetchQuery(options); assertActive?.(); return value } finally { assertActive?.signal.removeEventListener("abort", release); release() }+ try { const value = await queryClient.query({ ...options, select: undefined }); assertActive?.(); return value } finally { assertActive?.signal.removeEventListener("abort", release); release() }}export async function reconcileForumSidebarArchiveTag(diff --git a/src/web/src/hooks/community/use-friends.dom.test.ts b/src/web/src/hooks/community/use-friends.dom.test.tsindex 328c8b28d..66f6a007d 100644--- a/src/web/src/hooks/community/use-friends.dom.test.ts+++ b/src/web/src/hooks/community/use-friends.dom.test.ts@@ -64,7 +64,7 @@ describe("useFriends / friendsQueryFn", () => {const { friendsQueryFn } = await import("./use-friends")const { client } = await createCommunityQueryOwner()- const data = await client.fetchQuery({ queryKey: communityKeys.friends(), queryFn: friendsQueryFn })+ const data = await client.query({ queryKey: communityKeys.friends(), queryFn: friendsQueryFn })expect(data.ids).toEqual(["f_1", "p_1", "blocked:blocked_1", "blocked:b_legacy"])expect([...getCommunityDbRegistry(client)!.collections.friendships.values()]).toHaveLength(4)expect(apiFetchMock).toHaveBeenCalledTimes(3)@@ -212,7 +212,7 @@ describe("useFriends / friendsQueryFn", () => {const { friendsQueryFn } = await import("./use-friends")const { client: queryClient } = await createCommunityQueryOwner()const key = communityKeys.friends()- await queryClient.fetchQuery({ queryKey: key, queryFn: friendsQueryFn })+ await queryClient.query({ queryKey: key, queryFn: friendsQueryFn })expect(queryClient.getQueryData(key)).toBeDefined()await queryClient.invalidateQueries({ queryKey: communityKeys.all })expect(queryClient.getQueryState(key)?.isInvalidated).toBe(true)@@ -228,7 +228,7 @@ describe("useFriendsPresence / friendsPresenceQueryFn", () => {const { friendsPresenceQueryFn } = await import("./use-friends")const { client } = await createCommunityQueryOwner()- const data = await client.fetchQuery({ queryKey: communityKeys.friendsPresence(), queryFn: friendsPresenceQueryFn })+ const data = await client.query({ queryKey: communityKeys.friendsPresence(), queryFn: friendsPresenceQueryFn })expect(data.online).toEqual(["u1", "u2"])expect(apiFetchMock).toHaveBeenCalledOnce()})@@ -239,7 +239,7 @@ describe("useFriendsPresence / friendsPresenceQueryFn", () => {const { client: queryClient } = await createCommunityQueryOwner()const key = communityKeys.friendsPresence()expect(key.slice(0, communityKeys.friends().length)).toEqual(communityKeys.friends())- await queryClient.fetchQuery({ queryKey: key, queryFn: friendsPresenceQueryFn })+ await queryClient.query({ queryKey: key, queryFn: friendsPresenceQueryFn })expect(queryClient.getQueryData(key)).toEqual({ online: ["u1"] })await queryClient.invalidateQueries({ queryKey: communityKeys.friends() })expect(queryClient.getQueryState(key)?.isInvalidated).toBe(true)diff --git a/src/web/src/hooks/community/use-invitable-friends.dom.test.ts b/src/web/src/hooks/community/use-invitable-friends.dom.test.tsindex 5ad5db601..aef228075 100644--- a/src/web/src/hooks/community/use-invitable-friends.dom.test.ts+++ b/src/web/src/hooks/community/use-invitable-friends.dom.test.ts@@ -5,7 +5,8 @@ import { createCommunityQueryOwner } from "@/test/community-query-owner"import { CommunityTestProvider } from "@/test/community-owner-fixture"import { communityKeys } from "@/lib/query-keys"import { useInvitableFriends } from "./use-invitable-friends"-import { useFriends } from "./use-friends"+import { friendsQueryFn, useFriends } from "./use-friends"+import { fetchAllServerMembers } from "./fetch-all-server-members"const api = vi.hoisted(() => vi.fn())vi.mock("@/lib/api/client", () => ({ apiFetch: api, toastApiError: vi.fn() }))@@ -65,6 +66,45 @@ describe("Native invitable friend projection", () => {expect(api.mock.calls.filter(([path]) => path.includes("/members"))).toHaveLength(1)})+ it.each(["cold", "warm"] as const)("keeps %s raw friend IDs when query defaults select an empty view", async (state) => {+ const friend = { id: "friendship_selected", userId: "friend_selected", name: "Selected friend", discriminator: "0042", avatar: "S", avatarVersion: 0, status: "offline", sub: "" }+ api.mockClear()+ api.mockImplementation(async (path: string) => {+ if (path.endsWith("/accepted")) return { friends: [friend] }+ if (path.endsWith("/blocked")) return { blocked: [] }+ if (path.endsWith("/pending")) return { pending: [] }+ if (path.includes("/members")) return { members: [], hasMore: false, limit: 100, total: 0 }+ throw new Error(`Unexpected friend request: ${path}`)+ })+ const owner = await createCommunityQueryOwner("viewer", { defaultOptions: { queries: { staleTime: 5_000, retry: false } } })+ if (state === "warm") await owner.client.query({ queryKey: communityKeys.friends(), queryFn: friendsQueryFn })+ const select = vi.fn(() => ({ ids: [] }))+ owner.client.setQueryDefaults(communityKeys.friends(), { select })+ const wrapper = ({ children }: PropsWithChildren) => createElement(CommunityTestProvider, { client: owner.client, registry: owner.registry, retainOwner: true }, children)+ const view = renderHook(() => useInvitableFriends("server_1"), { wrapper })+ await waitFor(() => expect(view.result.current.isSuccess).toBe(true))+ expect(view.result.current.friends).toEqual([expect.objectContaining(friend)])+ expect(owner.client.getQueryData(communityKeys.friends())).toMatchObject({ ids: [friend.id] })+ expect(select).toHaveBeenCalled()+ expect(api.mock.calls.filter(([path]) => path.endsWith("/accepted"))).toHaveLength(1)+ })++ it("keeps raw complete member pages with a default selector on fetched and cached reads", async () => {+ const member = { id: "member_selected", userId: "user_selected", name: "Member", discriminator: "0042", avatar: "M", avatarVersion: 0, status: "offline", sub: "", role: "member" }+ api.mockClear()+ api.mockResolvedValue({ members: [member], hasMore: false, cursor: null, limit: 100, total: 1 })+ const owner = await createCommunityQueryOwner()+ const select = vi.fn(() => ({ pages: [], pageParams: [] }))+ owner.client.setQueryDefaults(communityKeys.members("server_1"), { select })+ try {+ const fetched = await fetchAllServerMembers(owner.client, "server_1")+ expect(fetched).toEqual([expect.objectContaining({ id: member.id, userId: member.userId, name: member.name })])+ expect(await fetchAllServerMembers(owner.client, "server_1")).toEqual(fetched)+ expect(select).toHaveBeenCalled()+ expect(api).toHaveBeenCalledOnce()+ } finally { await owner.registry.cleanup(); owner.client.clear() }+ })+it("reports one failed friends retry chain and recovers to an empty picker", async () => {let failing = trueapi.mockClear()diff --git a/src/web/src/hooks/community/use-invitable-friends.ts b/src/web/src/hooks/community/use-invitable-friends.tsindex cbc4ec477..c63e5e5c7 100644--- a/src/web/src/hooks/community/use-invitable-friends.ts+++ b/src/web/src/hooks/community/use-invitable-friends.ts@@ -21,7 +21,7 @@ async function invitableFriendsQueryFn(serverId: string, context: QueryFunctionCconst unsubscribe = observer.subscribe(() => undefined)context.signal.addEventListener("abort", unsubscribe, { once: true })try {- const [accepted] = await Promise.all([context.client.fetchQuery(options), fetchAllServerMembers(context.client, serverId, context.signal)])+ const [accepted] = await Promise.all([context.client.query({ ...options, select: undefined }), fetchAllServerMembers(context.client, serverId, context.signal)])assert()const allowed = new Set(accepted.ids)return { serverId, friendIds: [...original.registry!.collections.friendships.values()].filter((row) => row.kind === "accepted" && allowed.has(row.id)).map((row) => row.id) }diff --git a/src/web/src/hooks/community/use-machines.test.ts b/src/web/src/hooks/community/use-machines.test.tsindex 51182ec07..a50022a0c 100644--- a/src/web/src/hooks/community/use-machines.test.ts+++ b/src/web/src/hooks/community/use-machines.test.ts@@ -36,7 +36,7 @@ describe("useMachines / machinesQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ machines: [machineFixture] })const { machinesQueryFn } = await import("./use-machines")const { client: qc } = await createCommunityQueryOwner()- const data = await qc.fetchQuery({ queryKey: communityKeys.machines(), queryFn: machinesQueryFn })+ const data = await qc.query({ queryKey: communityKeys.machines(), queryFn: machinesQueryFn })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/machines", expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }))expect(data.machines).toEqual([machineFixture])})@@ -46,7 +46,7 @@ describe("useMachines / machinesQueryFn", () => {const { machinesQueryFn } = await import("./use-machines")const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.machines()- await qc.fetchQuery({ queryKey: key, queryFn: machinesQueryFn })+ await qc.query({ queryKey: key, queryFn: machinesQueryFn })expect(qc.getQueryData(key)).toEqual({ machines: [machineFixture] })// Prefix invalidation from communityKeys.all cascades to this key.await qc.invalidateQueries({ queryKey: communityKeys.all })diff --git a/src/web/src/hooks/community/use-message.test.ts b/src/web/src/hooks/community/use-message.test.tsindex da953e0c8..62dea4ad2 100644--- a/src/web/src/hooks/community/use-message.test.ts+++ b/src/web/src/hooks/community/use-message.test.ts@@ -18,7 +18,7 @@ describe("useMessage / messageQueryFn", () => {it("fetches from /messages/:id and publishes the hydrated payload into canonical DB", async () => {const { client, registry } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(payload)- const data = await client.fetchQuery({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, client) })+ const data = await client.query({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, client) })expect(data).toBe(payload.id)expect(apiFetchMock).toHaveBeenCalledWith("/api/community/messages/m_1", expect.objectContaining({ signal: expect.any(AbortSignal), assertActive: expect.any(Function) }))expect(registry.collections.messages.get(payload.id)).toMatchObject(payload)@@ -29,14 +29,14 @@ describe("useMessage / messageQueryFn", () => {const { client } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(payload)const key = communityKeys.message(payload.id)- await client.fetchQuery({ queryKey: key, queryFn: messageQueryFn(payload.id, client) })+ await client.query({ queryKey: key, queryFn: messageQueryFn(payload.id, client) })expect(client.getQueryData(key)).toBe(payload.id)})it("publishes an exact opener through the channel id carried by its response", async () => {const { client, registry } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce({ ...payload, channelId: "archived-post-1", content: "archived opener" })- await client.fetchQuery({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, client, "route-hint") })+ await client.query({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, client, "route-hint") })expect(registry.collections.messages.get(payload.id)).toMatchObject({ channelId: "archived-post-1", content: "archived opener" })})@@ -62,7 +62,7 @@ describe("useMessage / messageQueryFn", () => {const { client } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(payload)const key = communityKeys.message(payload.id)- await client.fetchQuery({ queryKey: key, queryFn: messageQueryFn(payload.id, client) })+ await client.query({ queryKey: key, queryFn: messageQueryFn(payload.id, client) })await client.invalidateQueries({ queryKey })expect(client.getQueryState(key)?.isInvalidated).toBe(true)})@@ -71,7 +71,7 @@ describe("useMessage / messageQueryFn", () => {const a = await createCommunityQueryOwner("A"), b = await createCommunityQueryOwner("B")let release!: (data: typeof payload) => voidapiFetchMock.mockImplementationOnce(() => new Promise((resolve) => { release = resolve }))- const result = a.client.fetchQuery({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, a.client) }).then(() => null, (error) => error)+ const result = a.client.query({ queryKey: communityKeys.message(payload.id), queryFn: messageQueryFn(payload.id, a.client) }).then(() => null, (error) => error)await vi.waitFor(() => expect(apiFetchMock).toHaveBeenCalledTimes(1))a.runtime.lifecycle.setState((state) => ({ active: false, generation: state.generation + 1 }))release(payload)diff --git a/src/web/src/hooks/community/use-messages.activation-refetch.dom.test.ts b/src/web/src/hooks/community/use-messages.activation-refetch.dom.test.tsindex e706c3585..1ca7f75b0 100644--- a/src/web/src/hooks/community/use-messages.activation-refetch.dom.test.ts+++ b/src/web/src/hooks/community/use-messages.activation-refetch.dom.test.ts@@ -1017,7 +1017,7 @@ describe("useMessagesInner — disabled-to-enabled cache revalidation", () => {expect(snapshots.at(-1)?.readStateFetching).toBe(true)await act(async () => {- await queryClient.fetchInfiniteQuery({+ await queryClient.infiniteQuery({queryKey,queryFn: () => apiFetchMock("/api/community/channels/dm_activation/messages?anchor=m_anchor",diff --git a/src/web/src/hooks/community/use-messages.dom.test.ts b/src/web/src/hooks/community/use-messages.dom.test.tsindex 2ec92e718..b5f07d408 100644--- a/src/web/src/hooks/community/use-messages.dom.test.ts+++ b/src/web/src/hooks/community/use-messages.dom.test.ts@@ -173,7 +173,7 @@ describe("channelMessagesQueryFn — queryClient integration", () => {apiFetchMock.mockResolvedValueOnce({ messages: [{ id: "m_1" }], hasMore: false })const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.channelMessages("ch_1")- await qc.fetchInfiniteQuery({+ await qc.infiniteQuery({queryKey: key,queryFn: channelMessagesQueryFn("ch_1"),initialPageParam: { mode: "newest" } as const,@@ -188,7 +188,7 @@ describe("channelMessagesQueryFn — queryClient integration", () => {apiFetchMock.mockResolvedValueOnce({ messages: [], hasMore: false })const { client: qc } = await createCommunityQueryOwner()const cursorKey = communityKeys.channelMessagesPage("ch_1", "cur|abc")- await qc.fetchQuery({ queryKey: cursorKey, queryFn: () => apiFetchMock() })+ await qc.query({ queryKey: cursorKey, queryFn: () => apiFetchMock() })expect(qc.getQueryData(cursorKey)).toBeDefined()await qc.invalidateQueries({ queryKey: communityKeys.channelMessages("ch_1") })@@ -207,7 +207,7 @@ describe("dmMessagesQueryFn", () => {const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.dmMessages("dm_1")- await qc.fetchInfiniteQuery({+ await qc.infiniteQuery({queryKey: key,queryFn: dmMessagesQueryFn("dm_1"),initialPageParam: { mode: "newest" } as const,@@ -267,7 +267,7 @@ describe("dmMessagesQueryFn", () => {.mockResolvedValueOnce({ messages: [{ id: "m_2" }], hasMore: false, latestSeq: 1 })const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.dmMessages("dm_1")- await qc.fetchInfiniteQuery({+ await qc.infiniteQuery({queryKey: key,queryFn: dmMessagesQueryFn("dm_1"),initialPageParam: { mode: "newest" } as const,diff --git a/src/web/src/hooks/community/use-messages.ts b/src/web/src/hooks/community/use-messages.tsindex 78db9a3dd..fed61c28e 100644--- a/src/web/src/hooks/community/use-messages.ts+++ b/src/web/src/hooks/community/use-messages.ts@@ -782,7 +782,7 @@ function useMessagesInner(})const repair = () => {if (!isCurrent()) return- void queryClient.fetchQuery(repairOptions)+ void queryClient.query({ ...repairOptions, select: undefined }).then((page) => {// Re-check right before the swap — a concurrent send/WS update or a// second re-anchor attempt in the interim shouldn't be clobbered bydiff --git a/src/web/src/hooks/community/use-native-system-notifications.ts b/src/web/src/hooks/community/use-native-system-notifications.tsindex 3d01aab7f..359ac0736 100644--- a/src/web/src/hooks/community/use-native-system-notifications.ts+++ b/src/web/src/hooks/community/use-native-system-notifications.ts@@ -71,7 +71,7 @@ async function nativeRead<T>(client: QueryClient, key: readonly unknown[], origiconst observer = new QueryObserver(client, { ...options, enabled: false })const release = observer.subscribe(() => undefined)original.signal.addEventListener("abort", release, { once: true })- try { const value = await client.fetchQuery(options); original(); return value }+ try { const value = await client.query({ ...options, select: undefined }); original(); return value }finally { original.signal.removeEventListener("abort", release); release() }}diff --git a/src/web/src/hooks/community/use-notification-settings.dom.test.ts b/src/web/src/hooks/community/use-notification-settings.dom.test.tsindex 260007d64..355741b00 100644--- a/src/web/src/hooks/community/use-notification-settings.dom.test.ts+++ b/src/web/src/hooks/community/use-notification-settings.dom.test.ts@@ -40,7 +40,7 @@ describe("useNotificationSettings / notificationSettingsQueryFn", () => {])const { notificationSettingsQueryFn } = await import("./use-notification-settings")const { client, registry } = await createCommunityQueryOwner()- const data = await client.fetchQuery({ queryKey: communityKeys.notificationSettings(), queryFn: notificationSettingsQueryFn })+ const data = await client.query({ queryKey: communityKeys.notificationSettings(), queryFn: notificationSettingsQueryFn })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/me/notifications", expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }))expect(data.ids).toEqual(["server:srv_1", "channel:ch_1", "channel:ch_2"])expect([...registry.collections.notificationSettings.values()].map(({ id, level }) => ({ id, level })).sort((a, b) => a.id.localeCompare(b.id))).toEqual([@@ -58,7 +58,7 @@ describe("useNotificationSettings / notificationSettingsQueryFn", () => {const { notificationSettingsQueryFn } = await import("./use-notification-settings")const queryClient = (await createCommunityQueryOwner()).clientconst key = communityKeys.notificationSettings()- await queryClient.fetchQuery({ queryKey: key, queryFn: notificationSettingsQueryFn })+ await queryClient.query({ queryKey: key, queryFn: notificationSettingsQueryFn })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/me/notifications",expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }),diff --git a/src/web/src/hooks/community/use-notification-settings.ts b/src/web/src/hooks/community/use-notification-settings.tsindex 587133da3..1f094f58b 100644--- a/src/web/src/hooks/community/use-notification-settings.ts+++ b/src/web/src/hooks/community/use-notification-settings.ts@@ -121,7 +121,7 @@ export async function reconcileNotificationSettings(queryClient: QueryClient) {assertCommunityLiveSnapshotTokenCurrent(queryClient, token, undefined)const options = { queryKey, queryFn: notificationSettingsQueryFn, staleTime: 0 }const lease = new QueryObserver(queryClient, { ...options, enabled: false }).subscribe(() => undefined)- try { await queryClient.fetchQuery(options) } finally { lease() }+ try { await queryClient.query({ ...options, select: undefined }) } finally { lease() }assertCommunityLiveSnapshotTokenCurrent(queryClient, token, undefined)const settings: NotificationSettings = { raw: [...token.registry!.collections.notificationSettings.values()], server: {}, channel: {} }for (const row of settings.raw) { if (row.channelId) settings.channel[row.channelId] = displayNotifLevel(row.level); else if (row.serverId) settings.server[row.serverId] = displayNotifLevel(row.level) }diff --git a/src/web/src/hooks/community/use-server-members.dom.test.ts b/src/web/src/hooks/community/use-server-members.dom.test.tsindex 54259c25e..c560ff979 100644--- a/src/web/src/hooks/community/use-server-members.dom.test.ts+++ b/src/web/src/hooks/community/use-server-members.dom.test.ts@@ -1,5 +1,5 @@import { CommunityTestProvider as QueryClientProvider } from "@/test/community-owner-fixture"-import { createElement, useEffect, type MutableRefObject } from "react"+import { createElement, useEffect, type RefObject } from "react"import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"import { type InfiniteData } from "@tanstack/react-query"import { act, render } from "@/test/react-dom-harness"@@ -78,7 +78,7 @@ function deferred<T>(): Deferred<T> {function HookProbe({ serverId, resultRef }: {serverId: string | null- resultRef: MutableRefObject<ServerMembersResult | null>+ resultRef: RefObject<ServerMembersResult | null>}) {const result = useServerMembers(serverId)useEffect(() => {@@ -93,7 +93,7 @@ async function mountServerMembers(serverId = "srv_1") {queries: { retry: false, gcTime: Infinity },},})).client- const resultRef = { current: null } as MutableRefObject<ServerMembersResult | null>+ const resultRef = { current: null } as RefObject<ServerMembersResult | null>const renderer = render(createElement(QueryClientProvider,{ client: queryClient },@@ -367,7 +367,7 @@ describe("membersPageQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ members: [], hasMore: false, limit: 50, total: 0 })const qc = (await createCommunityQueryOwner()).clientconst key = communityKeys.members("srv_1")- await qc.fetchInfiniteQuery({+ await qc.infiniteQuery({queryKey: key,queryFn: membersPageQueryFn("srv_1"),initialPageParam: null as string | null,@@ -383,7 +383,7 @@ describe("membersPageQueryFn", () => {.mockResolvedValueOnce({ members: [m("b")], hasMore: false, limit: 50, total: 2 })const qc = (await createCommunityQueryOwner()).clientconst key = communityKeys.members("srv_1")- await qc.fetchInfiniteQuery({+ await qc.infiniteQuery({queryKey: key,queryFn: membersPageQueryFn("srv_1"),initialPageParam: null as string | null,diff --git a/src/web/src/hooks/community/use-server-panels.test.ts b/src/web/src/hooks/community/use-server-panels.test.tsindex c35962e64..334da1a1f 100644--- a/src/web/src/hooks/community/use-server-panels.test.ts+++ b/src/web/src/hooks/community/use-server-panels.test.ts@@ -29,7 +29,7 @@ describe("useInvites / invitesQueryFn", () => {})const { invitesQueryFn } = await import("./use-server-panels")const { client: qc, registry } = await createCommunityQueryOwner()- const data = await qc.fetchQuery({ queryKey: communityKeys.invites("srv_1"), queryFn: invitesQueryFn("srv_1") })+ const data = await qc.query({ queryKey: communityKeys.invites("srv_1"), queryFn: invitesQueryFn("srv_1") })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/servers/srv_1/invites", expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }))expect(data.invites[0]).toEqual({code: "abcd",@@ -46,7 +46,7 @@ describe("useInvites / invitesQueryFn", () => {const { invitesQueryFn } = await import("./use-server-panels")const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.invites("srv_1")- await qc.fetchQuery({ queryKey: key, queryFn: invitesQueryFn("srv_1") })+ await qc.query({ queryKey: key, queryFn: invitesQueryFn("srv_1") })expect(qc.getQueryData(key)).toEqual({ invites: [] })})})@@ -56,7 +56,7 @@ describe("usePresence / presenceQueryFn", () => {apiFetchMock.mockResolvedValueOnce({ online: ["u_1", "u_2"], truncated: false, limit: 1000 })const { presenceQueryFn } = await import("./use-server-panels")const { client: qc } = await createCommunityQueryOwner()- const data = await qc.fetchQuery({ queryKey: communityKeys.presence("srv_1"), queryFn: presenceQueryFn("srv_1") })+ const data = await qc.query({ queryKey: communityKeys.presence("srv_1"), queryFn: presenceQueryFn("srv_1") })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/servers/srv_1/presence", expect.objectContaining({ signal: expect.any(AbortSignal), authenticationAccount: "viewer" }))expect(data.online).toEqual(["u_1", "u_2"])})@@ -66,7 +66,7 @@ describe("usePresence / presenceQueryFn", () => {const { presenceQueryFn } = await import("./use-server-panels")const { client: qc } = await createCommunityQueryOwner()const key = communityKeys.presence("srv_1")- await qc.fetchQuery({ queryKey: key, queryFn: presenceQueryFn("srv_1") })+ await qc.query({ queryKey: key, queryFn: presenceQueryFn("srv_1") })expect(qc.getQueryData(key)).toEqual({ online: [] })})})diff --git a/src/web/src/hooks/community/use-servers.dom.test.ts b/src/web/src/hooks/community/use-servers.dom.test.tsindex b0a7dc8f9..f2e94bcd0 100644--- a/src/web/src/hooks/community/use-servers.dom.test.ts+++ b/src/web/src/hooks/community/use-servers.dom.test.ts@@ -1,5 +1,5 @@import { createElement, type PropsWithChildren } from "react"-import { QueryClient, QueryClientProvider, isCancelledError } from "@tanstack/react-query"+import { QueryClient, QueryClientProvider, CancelledError } from "@tanstack/react-query"import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"import { act, renderHook, waitFor } from "@/test/react-dom-harness"import { createCommunityDbRegistry, type CommunityDbRegistry } from "@/lib/community-db/collections"@@ -46,10 +46,10 @@ function attention(channelId: string, count = 1, parentChannelId: string | null})}function fetchList(projection = getActiveAccountUnreadProjection(client)) {- return client.fetchQuery({ queryKey: communityKeys.servers(), queryFn: serversProjectedQueryFn(projection, client), staleTime: 0 })+ return client.query({ queryKey: communityKeys.servers(), queryFn: serversProjectedQueryFn(projection, client), staleTime: 0 })}function fetchDetail() {- return client.fetchQuery({ queryKey: communityKeys.server(identity.id), queryFn: ({ signal }) => serverProjectedQueryFn(client, identity.id, signal)(), staleTime: 0 })+ return client.query({ queryKey: communityKeys.server(identity.id), queryFn: ({ signal }) => serverProjectedQueryFn(client, identity.id, signal)(), staleTime: 0 })}function detailApi(url: string) {if (url === "/api/community/servers") return { servers: [identity] }@@ -59,7 +59,7 @@ function detailApi(url: string) {}async function rawList() {let result!: ServersResponse- await client.fetchQuery({ queryKey: ["server-transform"], queryFn: async (context) => {+ await client.query({ queryKey: ["server-transform"], queryFn: async (context) => {result = await serversQueryFn(context)return result.servers.map((server) => server.id)} })@@ -84,7 +84,7 @@ describe("useServers / serversQueryFn", () => {it("passes TanStack's abort signal to the canonical request", async () => {apiFetchMock.mockResolvedValueOnce({ servers: [] })let signal!: AbortSignal- await client.fetchQuery({ queryKey: communityKeys.servers(), queryFn: async (context) => { signal = context.signal; return (await serversQueryFn(context)).servers.map((server) => server.id) } })+ await client.query({ queryKey: communityKeys.servers(), queryFn: async (context) => { signal = context.signal; return (await serversQueryFn(context)).servers.map((server) => server.id) } })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/servers", expect.objectContaining({ signal, assertActive: expect.any(Function) }))})@@ -326,7 +326,7 @@ describe("useServer / projected canonical detail", () => {it.each([403, 404])("evicts live and persisted server state on definitive %s", async (status) => {seedDetail([{ id: "c1", name: "General", active: false, unread: false }])apiFetchMock.mockRejectedValue(new ApiError("denied", status))- await expect(fetchDetail()).rejects.toSatisfy(isCancelledError)+ await expect(fetchDetail()).rejects.toBeInstanceOf(CancelledError)expect(client.getQueryState(communityKeys.server(identity.id))).toBeUndefined()expect(client.getQueryData(communityKeys.servers())).toEqual([])expect(registry.collections.servers.get(identity.id)).toBeUndefined()diff --git a/src/web/src/hooks/community/use-servers.ts b/src/web/src/hooks/community/use-servers.tsindex 2ba24c4ff..8558465c5 100644--- a/src/web/src/hooks/community/use-servers.ts+++ b/src/web/src/hooks/community/use-servers.ts@@ -276,7 +276,7 @@ async function resolveServerIdentity(queryClient: QueryClient, serverId: string,signal?.addEventListener("abort", release, { once: true })try {assertCommunityLiveSnapshotTokenCurrent(queryClient, token, signal)- await queryClient.fetchQuery(options)+ await queryClient.query({ ...options, select: undefined })assertCommunityLiveSnapshotTokenCurrent(queryClient, token, signal)return read()} finally {diff --git a/src/web/src/hooks/community/use-user-profile.test.ts b/src/web/src/hooks/community/use-user-profile.test.tsindex 53735aa4a..9725de73c 100644--- a/src/web/src/hooks/community/use-user-profile.test.ts+++ b/src/web/src/hooks/community/use-user-profile.test.ts@@ -18,7 +18,7 @@ describe("useUserProfile / userProfileQueryFn", () => {const { client, registry } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(profile)const key = communityKeys.profile(profile.id)- expect(await client.fetchQuery({ queryKey: key, queryFn: userProfileQueryFn(profile.id) })).toEqual({ id: profile.id })+ expect(await client.query({ queryKey: key, queryFn: userProfileQueryFn(profile.id) })).toEqual({ id: profile.id })expect(apiFetchMock).toHaveBeenCalledWith("/api/community/users/u_1/profile", expect.objectContaining({ signal: expect.any(AbortSignal), assertActive: expect.any(Function) }))expect(registry.collections.profiles.get(profile.id)).toMatchObject({ userId: profile.id, name: "Alice", aboutMe: "about", mutualServers: 2, avatarVersion: 2 })expect(client.getQueryData(key)).toEqual({ id: profile.id })@@ -28,7 +28,7 @@ describe("useUserProfile / userProfileQueryFn", () => {const { client } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(profile)const key = communityKeys.profile(profile.id)- await client.fetchQuery({ queryKey: key, queryFn: userProfileQueryFn(profile.id) })+ await client.query({ queryKey: key, queryFn: userProfileQueryFn(profile.id) })await client.invalidateQueries({ queryKey: communityKeys.all })expect(client.getQueryState(key)?.isInvalidated).toBe(true)})@@ -39,8 +39,8 @@ describe("useUserProfile / userProfileQueryFn", () => {const { client } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(profile)const options = { queryKey: communityKeys.profile(profile.id), queryFn: userProfileQueryFn(profile.id), staleTime: PROFILE_STALE_TIME_MS }- const first = await client.fetchQuery(options)- expect(await client.fetchQuery(options)).toEqual(first)+ const first = await client.query(options)+ expect(await client.query(options)).toEqual(first)expect(apiFetchMock).toHaveBeenCalledTimes(1)})@@ -48,9 +48,9 @@ describe("useUserProfile / userProfileQueryFn", () => {const { client, registry } = await createCommunityQueryOwner()apiFetchMock.mockResolvedValueOnce(profile).mockResolvedValueOnce({ ...profile, aboutMe: "updated", mutualServers: 4 })const options = { queryKey: communityKeys.profile(profile.id), queryFn: userProfileQueryFn(profile.id), staleTime: 1 }- await client.fetchQuery(options)+ await client.query(options)await new Promise((resolve) => setTimeout(resolve, 5))- await client.fetchQuery(options)+ await client.query(options)expect(apiFetchMock).toHaveBeenCalledTimes(2)expect(registry.collections.profiles.get(profile.id)).toMatchObject({ aboutMe: "updated", mutualServers: 4 })})@@ -60,7 +60,7 @@ describe("useUserProfile / userProfileQueryFn", () => {let release!: (data: typeof profile) => voidapiFetchMock.mockImplementationOnce(() => new Promise((resolve) => { release = resolve }))const key = communityKeys.profile(profile.id)- const result = client.fetchQuery({ queryKey: key, queryFn: userProfileQueryFn(profile.id) }).then(() => null, (error) => error)+ const result = client.query({ queryKey: key, queryFn: userProfileQueryFn(profile.id) }).then(() => null, (error) => error)await vi.waitFor(() => expect(apiFetchMock).toHaveBeenCalledTimes(1))const signal = apiFetchMock.mock.calls[0]![1].signal as AbortSignalawait client.cancelQueries({ queryKey: key, exact: true })diff --git a/src/web/src/hooks/community/use-user-profile.ts b/src/web/src/hooks/community/use-user-profile.tsindex 38aba8b89..aef366aac 100644--- a/src/web/src/hooks/community/use-user-profile.ts+++ b/src/web/src/hooks/community/use-user-profile.ts@@ -68,7 +68,7 @@ export const userProfileQueryFn = (userId: string) => async (context: QueryFunct}// How long a fetched profile card is considered fresh before a re-click-// triggers a background refetch (`queryClient.fetchQuery`'s `staleTime`).+// triggers a background refetch (`queryClient.query`'s `staleTime`).// aboutMe/mutual-server-count change rarely enough that re-fetching on// every click (the pre-cache behavior) was pure waste — see// shell-frame.tsx's `openProfile`.diff --git a/src/web/src/lib/authenticated-context-menu-policy.test.ts b/src/web/src/lib/authenticated-context-menu-policy.test.tsindex bd42b66d3..92944ad94 100644--- a/src/web/src/lib/authenticated-context-menu-policy.test.ts+++ b/src/web/src/lib/authenticated-context-menu-policy.test.ts@@ -219,16 +219,37 @@ describe("authenticated context-menu policy", () => {})).toBe(false)})- it("falls back to caretRangeFromPoint and accepts selection boundaries", () => {+ it("accepts selection boundaries with a standard caret position", () => {const text = {} as Node- const ownerDocument = {- caretPositionFromPoint: undefined,- caretRangeFromPoint: () => ({ startContainer: text, startOffset: 0 }),- } as unknown as Document+ const ownerDocument = ownerDocumentWith({ node: text, offset: 0 })expect(selectionContainsClientPoint(selectionWith(), ownerDocument, { clientX: 10, clientY: 10 })).toBe(true)expect(selectionContainsClientPoint(selectionWith(), ownerDocument, { clientX: 20, clientY: 20 })).toBe(true)})+ it.each(["missing", "null"])(+ "uses the product menu when the standard caret API is %s without consulting the legacy API",+ (mode) => {+ const legacyCaret = vi.fn(() => ({ startContainer: {} as Node, startOffset: 0 }))+ const ownerDocument = {+ caretPositionFromPoint: mode === "missing" ? undefined : () => null,+ caretRangeFromPoint: legacyCaret,+ } as unknown as Document+ const selection = selectionWith()+ const point = { clientX: 15, clientY: 15 }+ expect(selectionContainsClientPoint(selection, ownerDocument, point)).toBe(false)+ expect(contextMenuDisposition({ event: eventAt(element()), selection, ownerDocument })).toBe("product")+ expect(legacyCaret).not.toHaveBeenCalled()+ expect(contextMenuDisposition({ event: eventAt(element("input")), selection, ownerDocument })).toBe("native")+ const escape = element() as unknown as FakeElement+ escape.setAttribute("data-native-context-menu", "true")+ expect(contextMenuDisposition({+ event: eventAt(escape as unknown as Element),+ selection,+ ownerDocument,+ })).toBe("native")+ },+ )+it("checks every selection range", () => {const ownerDocument = ownerDocumentWith({ node: {} as Node, offset: 1 })const ranges = [diff --git a/src/web/src/lib/authenticated-context-menu-policy.ts b/src/web/src/lib/authenticated-context-menu-policy.tsindex bcdd01736..826fcda78 100644--- a/src/web/src/lib/authenticated-context-menu-policy.ts+++ b/src/web/src/lib/authenticated-context-menu-policy.ts@@ -15,7 +15,6 @@ type CaretPositionDocument = Document & {offsetNode: Nodeoffset: number} | null- caretRangeFromPoint?: (x: number, y: number) => Range | null}type PointInRange = Pick<Range, "getClientRects" | "isPointInRange">@@ -99,11 +98,7 @@ function caretPointFromClientPoint(): { node: Node; offset: number } | null {const caretDocument = ownerDocument as CaretPositionDocumentconst position = caretDocument.caretPositionFromPoint?.(point.clientX, point.clientY)- if (position) return { node: position.offsetNode, offset: position.offset }-- const range = caretDocument.caretRangeFromPoint?.(point.clientX, point.clientY)- if (!range) return null- return { node: range.startContainer, offset: range.startOffset }+ return position ? { node: position.offsetNode, offset: position.offset } : null}export function selectionContainsClientPoint(diff --git a/src/web/src/lib/community-db/schema.ts b/src/web/src/lib/community-db/schema.tsindex 85dd368c2..3cd1a2b9e 100644--- a/src/web/src/lib/community-db/schema.ts+++ b/src/web/src/lib/community-db/schema.ts@@ -118,7 +118,7 @@ export const messageSchema = z.object({content: z.string().optional(),failed: z.boolean().optional(),replyToId: z.string().optional(),-}).passthrough()+}).loose()export const readStateSchema = z.object({channelId: z.string().min(1),diff --git a/src/web/src/lib/community-db/sync.test.ts b/src/web/src/lib/community-db/sync.test.tsindex dd94cd710..fe9e9f034 100644--- a/src/web/src/lib/community-db/sync.test.ts+++ b/src/web/src/lib/community-db/sync.test.ts@@ -218,7 +218,7 @@ describe("community DB sync", () => {expect(() => publishCommunityLiveSnapshotWithProof(db.queryClient, {snapshot: { kind: "dms", data: { conversations: [] } },proof: { kind: "structural", token, signal: controller.signal },- })).toThrowError(expect.objectContaining({ name: "AbortError" }))+ })).toThrow(expect.objectContaining({ name: "AbortError" }))expect(db.collections.channels.get("dm-current")).toBeDefined()},)@@ -528,7 +528,7 @@ describe("community DB sync", () => {expect(() => publishCommunityLiveSnapshotWithProof(db.queryClient, {snapshot: { kind: "server-detail", data: detail },proof: { kind: "structural", token, signal: undefined },- })).toThrowError(expect.objectContaining({ name: "AbortError" }))+ })).toThrow(expect.objectContaining({ name: "AbortError" }))expect(db.collections.channels.get("c1")).toBeUndefined()})diff --git a/src/web/src/lib/community-db/sync.ts b/src/web/src/lib/community-db/sync.tsindex fa61e9a8f..18b7392bc 100644--- a/src/web/src/lib/community-db/sync.ts+++ b/src/web/src/lib/community-db/sync.ts@@ -1382,7 +1382,7 @@ function rebaseAttentionTransactions(registry: CommunityDbRegistry) {} finally { store.setState((state) => ({ ...state, rebasing: false })) }}const transaction = registry.dbClient.createTransaction({ autoCommit: false, mutationFn: persist })- void transaction.isPersisted.promise.catch(() => undefined)+ void transaction.when("settled").catch(() => undefined)transaction.mutate(() => {const nextScopes = new Map(projected.scopes.map((scope) => [scope.scopeId, scope]))for (const scope of registry.collections.attentionScopes.values()) {diff --git a/src/web/src/lib/community-db/write.test.ts b/src/web/src/lib/community-db/write.test.tsindex fd89bf4f5..1478e90b0 100644--- a/src/web/src/lib/community-db/write.test.ts+++ b/src/web/src/lib/community-db/write.test.ts@@ -114,7 +114,7 @@ describe("canonical collection publication", () => {writeCommunityProfilePatches([{ id: "alice", identityAbout: { name: "Alicia" } }], registry)} })transaction.mutate(() => registry.collections.profiles.update("alice", (row) => { row.name = "Alicia" }))- await transaction.isPersisted.promise+ await transaction.when("settled")expect(registry.collections.profiles.get("alice")?.name).toBe("Alicia")expect(registry.queryClient.getQueryData(communityKeys.communityDbCollection("viewer", "profiles"))).toMatchObject([{ userId: "alice", name: "Alicia" }])})diff --git a/src/web/src/lib/community/conversation-navigation-warmup.test.ts b/src/web/src/lib/community/conversation-navigation-warmup.test.tsindex b3b80103a..cb0c7f586 100644--- a/src/web/src/lib/community/conversation-navigation-warmup.test.ts+++ b/src/web/src/lib/community/conversation-navigation-warmup.test.ts@@ -135,7 +135,7 @@ describe("conversation navigation warmup", () => {const key = surfaceKind === "dm" ? communityKeys.dmMessages("active") : communityKeys.channelMessages("active")let release!: (value: Page) => voidlet originalSignal!: AbortSignal- const existing = queryClient.fetchInfiniteQuery({ queryKey: key, initialPageParam: { mode: "newest" }, queryFn: ({ signal }) => {+ const existing = queryClient.infiniteQuery({ queryKey: key, initialPageParam: { mode: "newest" }, queryFn: ({ signal }) => {originalSignal = signalreturn new Promise<Page>((resolve) => { release = resolve }).then((page) => {recordConversationNavigationReceipt(queryClient, { channelId: "active", surfaceKind }, 4)diff --git a/src/web/src/lib/community/conversation-navigation-warmup.ts b/src/web/src/lib/community/conversation-navigation-warmup.tsindex 82aa96733..61d66658f 100644--- a/src/web/src/lib/community/conversation-navigation-warmup.ts+++ b/src/web/src/lib/community/conversation-navigation-warmup.ts@@ -101,7 +101,7 @@ export function startConversationNavigationWarmup(...messagesOptions, enabled: false,})const releaseMessages = messagesObserver.subscribe(() => undefined)- void queryClient.fetchInfiniteQuery(messagesOptions)+ void queryClient.infiniteQuery({ ...messagesOptions, select: undefined }).then(() => {if (!isCurrentConversationNavigation(queryClient, epoch, accessEpoch)) returncommitConversationNavigationProof(queryClient, target.channelId, accessEpoch)@@ -120,7 +120,7 @@ export function startConversationNavigationWarmup(const readKey = target.scopeKind === "dm"? communityKeys.dmReadStateSnapshot(target.channelId): communityKeys.channelReadStateSnapshot(target.channelId)- void queryClient.fetchQuery({+ void queryClient.query({queryKey: readKey,staleTime: 0,retry: false,@@ -131,6 +131,7 @@ export function startConversationNavigationWarmup(if (!isCurrentConversationNavigation(queryClient, epoch, accessEpoch)) throw new DOMException("Retired conversation warmup", "AbortError")},}),+ select: undefined,}).catch(() => undefined)if (target.serverId) {@@ -139,7 +140,7 @@ export function startConversationNavigationWarmup(const options = { queryKey, queryFn: ({ signal }: { signal: AbortSignal }) => serverProjectedQueryFn(queryClient, serverId, signal)(), staleTime: Infinity, networkMode: "always" as const, retry: conversationReadRetryPolicy(queryClient.defaultQueryOptions({ queryKey }).retry) }const observer = new QueryObserver(queryClient, { ...options, enabled: false })const release = observer.subscribe(() => undefined)- void queryClient.fetchQuery(options).finally(release).catch(() => undefined)+ void queryClient.query({ ...options, select: undefined }).finally(release).catch(() => undefined)}return epochdiff --git a/src/web/src/lib/community/desktop-system-notification.ts b/src/web/src/lib/community/desktop-system-notification.tsindex fd3ac5185..3c923d2d7 100644--- a/src/web/src/lib/community/desktop-system-notification.ts+++ b/src/web/src/lib/community/desktop-system-notification.ts@@ -113,13 +113,13 @@ export async function resolveDesktopSystemNotificationCandidate(const token = captureCommunityLiveSnapshotToken(queryClient)try {- await queryClient.fetchQuery(channelMetadataOptions(queryClient, create.serverId, create.channelId))+ await queryClient.query({ ...channelMetadataOptions(queryClient, create.serverId, create.channelId), select: undefined })assertCommunityLiveSnapshotTokenCurrent(queryClient, token, undefined)const channel = getCommunityDbRegistry(queryClient)?.collections.channels.get(create.channelId)if (!channel) return fallbacklet parent: ChannelRow | undefinedif (channel.parentChannelId) {- await queryClient.fetchQuery(channelMetadataOptions(queryClient, create.serverId, channel.parentChannelId))+ await queryClient.query({ ...channelMetadataOptions(queryClient, create.serverId, channel.parentChannelId), select: undefined })assertCommunityLiveSnapshotTokenCurrent(queryClient, token, undefined)parent = getCommunityDbRegistry(queryClient)?.collections.channels.get(channel.parentChannelId)}diff --git a/src/web/src/lib/file-download.ts b/src/web/src/lib/file-download.tsindex 8fd73a97b..3e7345985 100644--- a/src/web/src/lib/file-download.ts+++ b/src/web/src/lib/file-download.ts@@ -3,7 +3,7 @@import { startAction, finishAction } from "./observability/context"import { useCallback, useLayoutEffect, useMemo } from "react"import { createStore } from "@tanstack/react-store"-import { QueryObserver, queryOptions, useQuery, isCancelledError, type QueryKey } from "@tanstack/react-query"+import { QueryObserver, queryOptions, useQuery, CancelledError, type QueryKey } from "@tanstack/react-query"import { applicationKey, useApplicationOwner, captureApplicationOwner, assertApplicationOwner, type ApplicationOwner } from "./application-owner"import { downloadUrl, fileSaveMessage, type FileSaveResult } from "./file-save"import { isAbortError } from "./errors"@@ -57,13 +57,13 @@ export async function startFileDownload(owner: ApplicationOwner, target: FileDowsignal?.addEventListener("abort", release, { once: true })try {assertApplicationOwner(token, signal)- const receipt = await owner.queryClient.fetchQuery(options)+ const receipt = await owner.queryClient.query({ ...options, select: undefined })assertApplicationOwner(token, signal)finishAction(observation, receipt.status === "saved" ? "success" : receipt.status === "cancelled" ? "cancelled" : receipt.status === "error" ? "error" : "observed", { capability: receipt.status === "saved" ? "available" : "limited" })return receipt} catch (error) {- finishAction(observation, isCancelledError(error) || isAbortError(error) ? "cancelled" : "error")- if (isCancelledError(error) || isAbortError(error) || signal?.aborted) return { status: "cancelled" }+ finishAction(observation, error instanceof CancelledError || isAbortError(error) ? "cancelled" : "error")+ if (error instanceof CancelledError || isAbortError(error) || signal?.aborted) return { status: "cancelled" }throw error} finally {signal?.removeEventListener("abort", release)@@ -96,7 +96,7 @@ export function useFileDownload(target: FileDownloadTarget) {onComplete?.(receipt)return receipt} catch (error) {- return isAbortError(error) || isCancelledError(error) ? { status: "cancelled" } as FileSaveResult : { status: "error", message: "Couldn’t save this file" } as FileSaveResult+ return isAbortError(error) || error instanceof CancelledError ? { status: "cancelled" } as FileSaveResult : { status: "error", message: "Couldn’t save this file" } as FileSaveResult}}, [view, owner, target])const cancel = useCallback(() => { void cancelFileDownload(owner, fileDownloadKey(owner, target)).catch(() => undefined) }, [owner, target])diff --git a/src/web/src/lib/native-oauth-client.ts b/src/web/src/lib/native-oauth-client.tsindex 18efba7b3..f586683ac 100644--- a/src/web/src/lib/native-oauth-client.ts+++ b/src/web/src/lib/native-oauth-client.ts@@ -283,7 +283,7 @@ export const nativeOauthBrowserDeps: NativeOauthDeps = {},async hasSession() {const response = await request("/api/auth/get-session?disableCookieCache=true")- const result = z.object({ session: z.object({ id: z.string() }).passthrough().nullable() }).passthrough().safeParse(await response.json())+ const result = z.object({ session: z.object({ id: z.string() }).loose().nullable() }).loose().safeParse(await response.json())return response.ok && result.success && result.data.session !== null},navigate(path) { window.location.assign(path) },diff --git a/src/web/src/lib/observability/query-observer.test.ts b/src/web/src/lib/observability/query-observer.test.tsindex a6e472e8f..98f69a724 100644--- a/src/web/src/lib/observability/query-observer.test.ts+++ b/src/web/src/lib/observability/query-observer.test.ts@@ -13,13 +13,13 @@ beforeEach(() => { client = observeQueryClient(new QueryClient()); events.lengthafterEach(() => { retireTelemetry(); clearActions(); disposeQueryDiagnostics(client); client.clear() })it("distinguishes actual HTTP values from local Query functions and manual WS writes", async () => {const queryKey = ["remote"]- const remote = await client.fetchQuery({ queryKey, queryFn: async () => {+ const remote = await client.query({ queryKey, queryFn: async () => {const request = startRequest("/api/agents"), response = new Response('[{"id":"private"}]')requestHeaders(request, response)return readObservedResponse(response, () => response.json())} })expect(valueEvidence(client, remote).source).toBe("network")- const local = await client.fetchQuery({ queryKey: ["local"], queryFn: () => ({ status: "rendered" }) })+ const local = await client.query({ queryKey: ["local"], queryFn: () => ({ status: "rendered" }) })expect(valueEvidence(client, local).source).toBe("unknown")withSource(client, "ws", () => client.setQueryData(queryKey, [{ id: "private", changed: true }]))expect(valueEvidence(client, client.getQueryData(queryKey)).source).toBe("mixed")diff --git a/src/web/src/test/architecture/community-read-state-writer-contract.test.ts b/src/web/src/test/architecture/community-read-state-writer-contract.test.tsindex 13fe37a21..331f6dd8c 100644--- a/src/web/src/test/architecture/community-read-state-writer-contract.test.ts+++ b/src/web/src/test/architecture/community-read-state-writer-contract.test.ts@@ -110,7 +110,7 @@ describe("human account read-state writer contract", () => {)expect(projection).not.toMatch(/\b(?:apiFetch|fetch|setTimeout|setInterval)\s*\(/)expect(projection).not.toMatch(- /queryClient\.(?:setQueryData|invalidateQueries|fetchQuery|refetchQueries|cancelQueries)\s*\(/,+ /queryClient\.(?:setQueryData|invalidateQueries|fetchQuery|query|fetchInfiniteQuery|infiniteQuery|refetchQueries|cancelQueries)\s*\(/,)})diff --git a/src/web/src/test/e2e-ui/46-community-loading-geometry-android.spec.ts b/src/web/src/test/e2e-ui/46-community-loading-geometry-android.spec.tsindex ad18d7185..86f00f926 100644--- a/src/web/src/test/e2e-ui/46-community-loading-geometry-android.spec.ts+++ b/src/web/src/test/e2e-ui/46-community-loading-geometry-android.spec.ts@@ -1,4 +1,6 @@-import { test } from "./_fixtures/community-fixture"+import { test, expect } from "./_fixtures/community-fixture"+import { expectUniqueSsrInitialFrame } from "./_fixtures/community-ssr-frame"+import { tid } from "./_fixtures/testids"import {runAndroidLoadingGeometry,runSkeletonLoadingMotion,@@ -14,3 +16,55 @@ test.describe.serial("community Android loading geometry", () => {await runSkeletonLoadingMotion(asUser)})})++const frameHtml = (owner: string) => (+ `<div data-testid="${tid.initialFrame}" data-owner="${owner}" style="width:100px;height:100px"></div>`+)++test("SSR fixture requires a visible initial frame", async ({ page }) => {+ await page.setContent(frameHtml("visible"))+ const frame = await expectUniqueSsrInitialFrame(page)+ await expect(frame).toHaveAttribute("data-owner", "visible")+})++for (const streamFirst of [false, true]) {+ test(`SSR fixture classifies a hidden stream ${streamFirst ? "before" : "after"} the visible frame`, async ({ page }) => {+ const fallback = frameHtml("fallback")+ const stream = `<div hidden id="S:0">${frameHtml("stream")}</div>`+ await page.setContent(streamFirst ? stream + fallback : fallback + stream)+ const initialFrame = await expectUniqueSsrInitialFrame(page)+ await expect(initialFrame).toHaveAttribute("data-owner", "fallback")+ await expect(page.getByTestId(tid.initialFrame)).toHaveCount(2)+ await page.evaluate(() => {+ document.querySelector('[data-owner="fallback"]')!.remove()+ const segment = document.getElementById("S:0")!+ segment.replaceWith(...segment.childNodes)+ })+ const promotedFrame = await expectUniqueSsrInitialFrame(page)+ await expect(promotedFrame).toHaveAttribute("data-owner", "stream")+ await promotedFrame.evaluate((element) => element.remove())+ await expect(page.getByTestId(tid.initialFrame)).toHaveCount(0)+ })+}++test("SSR fixture rejects two visible frames without waiting for retirement", async ({ page }) => {+ await page.setContent(frameHtml("fallback") + frameHtml("duplicate"))+ await expect(expectUniqueSsrInitialFrame(page)).rejects.toThrow(+ "SSR must have exactly one visible initial frame",+ )+ await expect(page.getByTestId(tid.initialFrame)).toHaveCount(2)+})++test("SSR fixture rejects a stream copy without a hidden container", async ({ page }) => {+ await page.setContent(frameHtml("fallback") + `<div id="S:0">${frameHtml("stream")}</div>`)+ await expect(expectUniqueSsrInitialFrame(page)).rejects.toThrow(+ "SSR must have exactly one visible initial frame",+ )+})++test("SSR fixture rejects an unexplained hidden frame", async ({ page }) => {+ await page.setContent(frameHtml("fallback") + `<div hidden>${frameHtml("unknown")}</div>`)+ await expect(expectUniqueSsrInitialFrame(page)).rejects.toThrow(+ "Unexpected hidden SSR initial frame",+ )+})diff --git a/src/web/src/test/e2e-ui/_fixtures/community-loading-geometry.ts b/src/web/src/test/e2e-ui/_fixtures/community-loading-geometry.tsindex 2a16bc323..4ffc2a444 100644--- a/src/web/src/test/e2e-ui/_fixtures/community-loading-geometry.ts+++ b/src/web/src/test/e2e-ui/_fixtures/community-loading-geometry.ts@@ -25,6 +25,7 @@ import {import { tid } from "./testids"import { WEB_URL } from "../_setup/paths"import { ssrGeometryErrors, type SsrLifecycleSample } from "./community-ssr-geometry"+import { expectUniqueSsrInitialFrame } from "./community-ssr-frame"import type { UserKey } from "../_setup/users"type Theme = "light" | "dark"@@ -100,8 +101,7 @@ async function expectServerSeededRouteFrame(width: number,height: number,) {- const frame = page.getByTestId(tid.initialFrame)- await expect(frame).toBeVisible()+ const frame = await expectUniqueSsrInitialFrame(page)await expect(frame).toHaveAttribute("aria-busy", "true")await expect(frame).toHaveAttribute("aria-label", "Loading community")await expect(page.locator('[data-slot="community-restore-bootstrap"]')).toHaveCount(0)@@ -126,6 +126,7 @@ async function expectServerSeededRouteFrame(})expect(geometry.overflow).toBe(0)expect(geometry.root).toMatchObject({ x: 0, y: 0, width, height })+ return frame}async function holdRequest(page: Page, pattern: string) {@@ -533,6 +534,7 @@ export async function runAndroidLoadingGeometry(asUser: CommunityAsUser, testInftry {await page.goto(pathname, { waitUntil: "commit" })await expect.poll(() => scripts.blocked.length).toBeGreaterThan(0)+ expect(scripts.received).toEqual([])await expectServerSeededRouteFrame(page, width, width === 320 ? 720 : 900)await page.waitForTimeout(250)ssrEvidence = {@@ -606,6 +608,7 @@ export async function runDesktopPersistedPendingGeometry(const communityReads = await holdCommunityReads(page)await page.goto("/c/me/machines", { waitUntil: "commit" })await expect.poll(() => scripts.blocked.length).toBeGreaterThan(0)+ expect(scripts.received).toEqual([])expect(scripts.sessionRequests()).toBe(0)await expectServerSeededRouteFrame(page, viewportWidth, 900)scripts.release()@@ -662,6 +665,7 @@ export async function runSkeletonLoadingMotion(asUser: CommunityAsUser) {const communityReads = await holdCommunityReads(page)await page.goto("/c/me/machines", { waitUntil: "commit" })await expect.poll(() => scripts.blocked.length).toBeGreaterThan(0)+ expect(scripts.received).toEqual([])expect(scripts.sessionRequests()).toBe(0)await expectServerSeededRouteFrame(page, 320, 720)scripts.release()@@ -691,10 +695,10 @@ export async function runNeutralRootGeometry(const scripts = await holdApplicationScripts(page)await page.goto("/c", { waitUntil: "commit" })await expect.poll(() => scripts.blocked.length).toBeGreaterThan(0)+ expect(scripts.received).toEqual([])expect(scripts.sessionRequests()).toBe(0)- const frame = page.getByTestId(tid.initialFrame)- await expectServerSeededRouteFrame(page, width, width === 390 ? 844 : 900)+ const frame = await expectServerSeededRouteFrame(page, width, width === 390 ? 844 : 900)await expect(page.locator('[data-slot="community-shell-root"]')).toHaveCount(0)await expect(page.getByTestId(tid.initialRailPending)).toHaveCount(0)await expect(page.getByTestId(tid.dmSidebarPending)).toHaveCount(0)@@ -718,7 +722,7 @@ export async function runNeutralRootGeometry(})scripts.release()- await expect(frame).toHaveCount(0, { timeout: 30_000 })+ await expect(page.getByTestId(tid.initialFrame)).toHaveCount(0, { timeout: 30_000 })await expect.poll(() => new URL(page.url()).pathname).toBe("/c/me/machines")await expect(page.getByTestId(tid.machinePairOpen)).toBeVisible({ timeout: 30_000 })expect(await page.evaluate(() => (@@ -752,6 +756,7 @@ export async function runRouteLoadingGeometry(: nullawait page.goto(entry.pathname, { waitUntil: "commit" })await expect.poll(() => scripts.blocked.length).toBeGreaterThan(0)+ expect(scripts.received).toEqual([])expect(scripts.sessionRequests()).toBe(0)await expectServerSeededRouteFrame(page,diff --git a/src/web/src/test/e2e-ui/_fixtures/community-ssr-frame.ts b/src/web/src/test/e2e-ui/_fixtures/community-ssr-frame.tsnew file mode 100644index 000000000..75045bf48--- /dev/null+++ b/src/web/src/test/e2e-ui/_fixtures/community-ssr-frame.ts@@ -0,0 +1,33 @@+import { expect, type Page } from "@playwright/test"+import { tid } from "./testids"++export async function expectUniqueSsrInitialFrame(page: Page) {+ const frames = page.getByTestId(tid.initialFrame)+ const visibleFrame = frames.filter({ visible: true })+ let visibleCount = 0+ await expect.poll(async () => {+ visibleCount = await visibleFrame.count()+ return visibleCount+ }).toBeGreaterThan(0)+ expect(+ visibleCount,+ "SSR must have exactly one visible initial frame",+ ).toBe(1)+ const hiddenState = await frames.filter({ visible: false }).evaluateAll((elements) => ({+ readyState: document.readyState,+ nodes: elements.map((element) => {+ const stream = element.parentElement?.closest('[hidden][id^="S:"]')+ return {+ routeKind: element.getAttribute("data-community-route-kind"),+ streamId: stream?.id ?? null,+ streamDisplay: stream ? getComputedStyle(stream).display : null,+ }+ }),+ }))+ expect(+ hiddenState.nodes.filter((node) => node.streamId === null || node.streamDisplay !== "none"),+ `Unexpected hidden SSR initial frame: ${JSON.stringify(hiddenState)}`,+ ).toEqual([])+ await expect(visibleFrame).toBeVisible()+ return visibleFrame+}diff --git a/src/web/src/test/react-dom-harness.dom.test.tsx b/src/web/src/test/react-dom-harness.dom.test.tsxindex 1e9aa4c5d..c6238e5da 100644--- a/src/web/src/test/react-dom-harness.dom.test.tsx+++ b/src/web/src/test/react-dom-harness.dom.test.tsx@@ -14,7 +14,7 @@ function EffectFixture() {return <main>Harness fixture</main>}-describe.sequential("react-dom harness lifecycle", () => {+describe("react-dom harness lifecycle", { concurrent: false }, () => {it("enables the React act environment while rendering", () => {expect(reactActEnvironment.IS_REACT_ACT_ENVIRONMENT).toBe(true)render(<EffectFixture />)diff --git a/src/web/tsconfig.eslint.json b/src/web/tsconfig.eslint.jsonnew file mode 100644index 000000000..7f9aa31d6--- /dev/null+++ b/src/web/tsconfig.eslint.json@@ -0,0 +1,19 @@+{+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "allowJs": true,+ "noEmit": true,+ "rootDir": "."+ },+ "include": [+ "src/**/*",+ "src/app/.well-known/**/*.ts",+ "scripts/**/*"+ ],+ "exclude": [+ "node_modules"+ ],+ "files": [+ "src/components/community/messages/composer-accessory-rail.dom.test.tsx"+ ]+}