🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(verify): retire the /verify report pages in favour of Acceptance (#20948)
Arvin Xu0e599f57c21e
diff --git a/.agents/skills/split-micro-app/SKILL.md b/.agents/skills/split-micro-app/SKILL.mdindex 5ddf73ad891..577c5aa0bb7 100644--- a/.agents/skills/split-micro-app/SKILL.md+++ b/.agents/skills/split-micro-app/SKILL.md@@ -9,7 +9,7 @@ user-invocable: falseCanonical living examples, both extracted 2026-08 — read the real files, this skill recordsthe decisions and landmines, not copies of the code:-- **`apps/workbench`** (`/verify`, `/acceptance`) — all code in this repo, builds and deploys from OSS CI.+- **`apps/workbench`** (`/acceptance`, `/agent/:aid/docs/:docId`; `/verify` only redirects retired report links into Acceptance) — all code in this repo, builds and deploys from OSS CI.- **`apps/share`** (`/share/t/:id`, `/share/page/:id`) — renders Cloud-only surfaces, so itbuilds and deploys from **lobehub-cloud** CI. See §1b before touching it.- **`apps/auth`** (`/signin`, `/signup`, …) — the SSG variant: `ssr: false` + `prerender`, sodiff --git a/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts b/apps/desktop/src/main/core/browser/__tests__/Browser.test.tsindex 62a33068250..f95f3b5827f 100644--- a/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts+++ b/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts@@ -1142,7 +1142,7 @@ describe('Browser', () => {});it('should deny renderer-origin URLs instead of handing them to the OS', () => {- expect(windowOpenHandler({ url: 'app://renderer/verify/run-1' })).toEqual({+ expect(windowOpenHandler({ url: 'app://renderer/acceptance/acc-1' })).toEqual({action: 'deny',});expect(mockShell.openExternal).not.toHaveBeenCalled();diff --git a/apps/desktop/src/preload/routeInterceptor.test.ts b/apps/desktop/src/preload/routeInterceptor.test.tsindex 58e4b8fac4a..a567c454e46 100644--- a/apps/desktop/src/preload/routeInterceptor.test.ts+++ b/apps/desktop/src/preload/routeInterceptor.test.ts@@ -129,7 +129,7 @@ describe('setupRouteInterceptors', () => {// An absolute LobeHub URL: a different origin than `app://renderer`, but the// renderer has claimed it and will open it in the portal itself.const link = document.createElement('a');- link.href = 'https://app.lobehub.com/verify/run-1';+ link.href = 'https://app.lobehub.com/acceptance/acc-1';link.setAttribute(RENDERER_HANDLED_LINK_ATTR, 'true');document.body.append(link);diff --git a/apps/server/src/routers/lambda/verify.ts b/apps/server/src/routers/lambda/verify.tsindex 5ecd8860d4e..cba82d465d6 100644--- a/apps/server/src/routers/lambda/verify.ts+++ b/apps/server/src/routers/lambda/verify.ts@@ -16,7 +16,6 @@ import type {} from '@lobechat/types';import { verifyCheckDefinitionSchema } from '@lobechat/types';import { TRPCError } from '@trpc/server';-import { asc, eq } from 'drizzle-orm';import { z } from 'zod';import {@@ -33,14 +32,6 @@ import { VerifyEvidenceModel } from '@/database/models/verifyEvidence';import { VerifyReportModel } from '@/database/models/verifyReport';import { VerifyRubricModel } from '@/database/models/verifyRubric';import { VerifyRunModel } from '@/database/models/verifyRun';-import { WorkspaceMemberModel } from '@/database/models/workspaceMember';-import {- verifyCheckResults,- verifyEvidence,- verifyReports,- verifyRuns,-} from '@/database/schemas/verify';-import { isUuid } from '@/database/utils/uuid';import { publicProcedure, router } from '@/libs/trpc/lambda';import { serverDatabase } from '@/libs/trpc/lambda/middleware';import { markSilentTRPCErrorLog } from '@/libs/trpc/utils/errorLogger';@@ -48,7 +39,6 @@ import { FileService } from '@/server/services/file';import { GoalCriteriaGeneratorService } from '@/server/services/goal/criteriaGenerator';import {AcceptanceService,- createEvidenceFileResolver,evidenceTypeForStoredFile,finalizeVerifyRun,purgeVerifyRun,@@ -60,6 +50,7 @@ import {} from '@/server/services/verify';import { assertWorkspaceRowManageable } from './_helpers/assertWorkspaceRowManageable';+import { verifyRunReportProcedures } from './verifyRunReport';const verifierTypeSchema = z.enum(['program', 'agent', 'llm']);const onFailSchema = z.enum(['manual', 'auto_repair']);@@ -291,8 +282,6 @@ const verifyProcedure = wsCompatProcedure.use(serverDatabase).use(async (opts) =// out (read-only role) while personal mode passes through unrestricted.const verifyWriteProcedure = verifyProcedure.use(requireWorkspaceRoleWhenScoped('member'));-const publicVerifyReportProcedure = publicProcedure.use(serverDatabase);-const resolveVerifyRun = async (ctx: { runModel: VerifyRunModel }, verifyRunId: string) => {const run = await ctx.runModel.findById(verifyRunId);@@ -1216,78 +1205,5 @@ export const verifyRouter = router({await ctx.runModel.setVisibility(run.id, input.visibility);}),- /**- * One-shot payload for the standalone report viewer: the session, its report,- * and every check result with its evidence — addressed purely by verifyRunId- * (no operation / chat context required).- *- * Public like the acceptance page: a `public` run's report URL is readable by- * anyone holding the id; `private` stays gated to the owner and (for- * workspace scope) workspace members. A denied read looks exactly like a- * missing run (`null`) — existence must not leak. `isOwner` additionally- * gates what only the author may see — today the origin conversation,- * which is redacted for everyone else.- */- getReportBundle: publicVerifyReportProcedure- .input(verifyRunIdInputSchema)- .query(async ({ ctx, input }) => {- // Public entry fed by shared links: a chat autolinker can glue trailing- // CJK punctuation onto the URL, so a malformed uuid must read as absent- // instead of aborting in Postgres (22P02 → 500).- if (!isUuid(input.verifyRunId)) return null;- const found = await ctx.serverDB.query.verifyRuns.findFirst({- where: eq(verifyRuns.id, input.verifyRunId),- });- if (!found) return null;-- const isOwner = Boolean(ctx.userId) && ctx.userId === found.userId;- let canRead = isOwner || found.visibility === 'public';- if (!canRead && ctx.userId && found.workspaceId) {- const member = await new WorkspaceMemberModel(ctx.serverDB, ctx.userId).getMember(- found.workspaceId,- ctx.userId,- );- canRead = Boolean(member);- }- if (!canRead) return null;- // `origin` points at the author's private topic/agent — never hand it to a- // visitor holding nothing but the shared link.- const { origin: _origin, ...publicMetadata } = found.metadata ?? {};- const run =- isOwner || !found.metadata?.origin ? found : { ...found, metadata: publicMetadata };- const [report, results] = await Promise.all([- ctx.serverDB.query.verifyReports.findFirst({- where: eq(verifyReports.verifyRunId, input.verifyRunId),- }),- ctx.serverDB- .select()- .from(verifyCheckResults)- .where(eq(verifyCheckResults.verifyRunId, input.verifyRunId))- .orderBy(asc(verifyCheckResults.checkItemIndex)),- ]);-- // Resolve display metadata for each file-backed evidence artifact.- const resolveFileMeta = createEvidenceFileResolver(- ctx.serverDB,- run.userId,- run.workspaceId ?? undefined,- );-- const resultsWithEvidence = await Promise.all(- results.map(async (r) => {- const evidence = await ctx.serverDB- .select()- .from(verifyEvidence)- .where(eq(verifyEvidence.checkResultId, r.id))- .orderBy(asc(verifyEvidence.createdAt));- return {- ...r,- evidence: await Promise.all(- evidence.map(async (e) => ({ ...e, ...(await resolveFileMeta(e.fileId)) })),- ),- };- }),- );- return { isOwner, report: report ?? null, results: resultsWithEvidence, run };- }),+ ...verifyRunReportProcedures,});diff --git a/apps/server/src/routers/lambda/verifyRunReport.test.ts b/apps/server/src/routers/lambda/verifyRunReport.test.tsnew file mode 100644index 00000000000..d863e719a97--- /dev/null+++ b/apps/server/src/routers/lambda/verifyRunReport.test.ts@@ -0,0 +1,100 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { router } from '@/libs/trpc/lambda';++import { verifyRunReportProcedures } from './verifyRunReport';++const mocks = vi.hoisted(() => ({+ getMember: vi.fn(),+ getServerDB: vi.fn(),+}));++vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: mocks.getServerDB }));+vi.mock('@/database/models/workspaceMember', () => ({+ WorkspaceMemberModel: vi.fn(function () {+ return { getMember: mocks.getMember };+ }),+}));+vi.mock('@/server/services/verify', () => ({ createEvidenceFileResolver: vi.fn() }));++const RUN_UUID = '61a3475e-52b5-4a58-8ccc-e3ba43062c7a';+const ACCEPTANCE_UUID = '0b7f4c1e-9d2a-4e55-8a3b-1f6c2d9e7a10';++const testRouter = router(verifyRunReportProcedures);+const callerFor = (userId?: string) => testRouter.createCaller({ userId } as any);++const serveRun = (run: Record<string, unknown> | undefined) => {+ const findFirst = vi.fn(async () => run);+ mocks.getServerDB.mockResolvedValue({ query: { verifyRuns: { findFirst } } });+ return findFirst;+};++const baseRun = {+ acceptanceId: ACCEPTANCE_UUID,+ id: RUN_UUID,+ roundIndex: 3,+ userId: 'owner-user',+ visibility: 'public',+ workspaceId: null,+};++describe('verifyRunReportProcedures.getRunAcceptanceRound', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mocks.getMember.mockResolvedValue(undefined);+ });++ it('resolves a public run to its acceptance round without a session', async () => {+ serveRun(baseRun);++ expect(await callerFor().getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toEqual({+ acceptanceId: ACCEPTANCE_UUID,+ roundIndex: 3,+ });+ });++ it('reads a run outside any acceptance as null', async () => {+ serveRun({ ...baseRun, acceptanceId: null, roundIndex: null });++ expect(await callerFor().getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toBeNull();+ });++ it('reads a missing run as null', async () => {+ serveRun(undefined);++ expect(await callerFor().getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toBeNull();+ });++ it('never queries for a malformed run id', async () => {+ const findFirst = serveRun(baseRun);++ expect(+ await callerFor().getRunAcceptanceRound({ verifyRunId: `${RUN_UUID}(本轮` }),+ ).toBeNull();+ expect(findFirst).not.toHaveBeenCalled();+ });++ it('hides a private run from visitors, but not from its owner', async () => {+ serveRun({ ...baseRun, visibility: 'private' });+ expect(await callerFor().getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toBeNull();+ expect(+ await callerFor('someone-else').getRunAcceptanceRound({ verifyRunId: RUN_UUID }),+ ).toBeNull();++ expect(await callerFor('owner-user').getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toEqual({+ acceptanceId: ACCEPTANCE_UUID,+ roundIndex: 3,+ });+ });++ it('lets workspace members resolve a private workspace run', async () => {+ serveRun({ ...baseRun, visibility: 'private', workspaceId: 'ws-1' });+ mocks.getMember.mockResolvedValue({ role: 'viewer' });++ expect(await callerFor('member').getRunAcceptanceRound({ verifyRunId: RUN_UUID })).toEqual({+ acceptanceId: ACCEPTANCE_UUID,+ roundIndex: 3,+ });+ expect(mocks.getMember).toHaveBeenCalledWith('ws-1', 'member');+ });+});diff --git a/apps/server/src/routers/lambda/verifyRunReport.ts b/apps/server/src/routers/lambda/verifyRunReport.tsnew file mode 100644index 00000000000..b0f77fe7694--- /dev/null+++ b/apps/server/src/routers/lambda/verifyRunReport.ts@@ -0,0 +1,137 @@+import type { LobeChatDatabase } from '@lobechat/database';+import { asc, eq } from 'drizzle-orm';+import pMap from 'p-map';+import { z } from 'zod';++import { WorkspaceMemberModel } from '@/database/models/workspaceMember';+import {+ verifyCheckResults,+ verifyEvidence,+ verifyReports,+ verifyRuns,+} from '@/database/schemas/verify';+import { isUuid } from '@/database/utils/uuid';+import { publicProcedure } from '@/libs/trpc/lambda';+import { serverDatabase } from '@/libs/trpc/lambda/middleware';+import { createEvidenceFileResolver } from '@/server/services/verify';++const publicVerifyReportProcedure = publicProcedure.use(serverDatabase);++// A run's check results and their evidence are runtime-sized; cap the per-row reads.+const EVIDENCE_LOAD_CONCURRENCY = 5;++const verifyRunIdInputSchema = z.object({ verifyRunId: z.string() });++/**+ * Load a run through the read capability its id grants: a `public` run is+ * readable by anyone holding the id; a `private` one only by its owner and (for+ * workspace scope) members of that workspace. Missing, malformed and denied all+ * read as `null` — existence must not leak.+ */+const findReadableVerifyRun = async (+ ctx: { serverDB: LobeChatDatabase; userId?: string | null },+ verifyRunId: string,+) => {+ // Public entry fed by shared links: a chat autolinker can glue trailing+ // CJK punctuation onto the URL, so a malformed uuid must read as absent+ // instead of aborting in Postgres (22P02 → 500).+ if (!isUuid(verifyRunId)) return null;+ const run = await ctx.serverDB.query.verifyRuns.findFirst({+ where: eq(verifyRuns.id, verifyRunId),+ });+ if (!run) return null;++ const isOwner = Boolean(ctx.userId) && ctx.userId === run.userId;+ let canRead = isOwner || run.visibility === 'public';+ if (!canRead && ctx.userId && run.workspaceId) {+ const member = await new WorkspaceMemberModel(ctx.serverDB, ctx.userId).getMember(+ run.workspaceId,+ ctx.userId,+ );+ canRead = Boolean(member);+ }++ return canRead ? { isOwner, run } : null;+};++/** Public, id-addressed reads of one verify run, merged into `verifyRouter`. */+export const verifyRunReportProcedures = {+ /**+ * One-shot payload for the report viewer (chat portal, acceptance round+ * ledger): the session, its report, and every check result with its+ * evidence — addressed purely by verifyRunId (no operation / chat context+ * required).+ *+ * Public like the acceptance page — see {@link findReadableVerifyRun}.+ * `isOwner` additionally gates what only the author may see — today the+ * origin conversation, which is redacted for everyone else.+ */+ getReportBundle: publicVerifyReportProcedure+ .input(verifyRunIdInputSchema)+ .query(async ({ ctx, input }) => {+ const readable = await findReadableVerifyRun(ctx, input.verifyRunId);+ if (!readable) return null;++ const { isOwner, run: found } = readable;+ // `origin` points at the author's private topic/agent — never hand it to a+ // visitor holding nothing but the shared link.+ const { origin: _origin, ...publicMetadata } = found.metadata ?? {};+ const run =+ isOwner || !found.metadata?.origin ? found : { ...found, metadata: publicMetadata };+ const [report, results] = await Promise.all([+ ctx.serverDB.query.verifyReports.findFirst({+ where: eq(verifyReports.verifyRunId, input.verifyRunId),+ }),+ ctx.serverDB+ .select()+ .from(verifyCheckResults)+ .where(eq(verifyCheckResults.verifyRunId, input.verifyRunId))+ .orderBy(asc(verifyCheckResults.checkItemIndex)),+ ]);++ // Resolve display metadata for each file-backed evidence artifact.+ const resolveFileMeta = createEvidenceFileResolver(+ ctx.serverDB,+ run.userId,+ run.workspaceId ?? undefined,+ );++ const resultsWithEvidence = await pMap(+ results,+ async (r) => {+ const evidence = await ctx.serverDB+ .select()+ .from(verifyEvidence)+ .where(eq(verifyEvidence.checkResultId, r.id))+ .orderBy(asc(verifyEvidence.createdAt));+ return {+ ...r,+ evidence: await pMap(+ evidence,+ async (e) => ({ ...e, ...(await resolveFileMeta(e.fileId)) }),+ { concurrency: EVIDENCE_LOAD_CONCURRENCY },+ ),+ };+ },+ { concurrency: EVIDENCE_LOAD_CONCURRENCY },+ );+ return { isOwner, report: report ?? null, results: resultsWithEvidence, run };+ }),++ /**+ * Where an old `/verify/:runId` link now lands: the acceptance and round the+ * run belongs to. Same access rule as `getReportBundle` — and both fields+ * were already part of the bundle's `run` — so the redirect reveals nothing+ * the run id did not. A run outside any acceptance reads as `null`, exactly+ * like a missing or denied one.+ */+ getRunAcceptanceRound: publicVerifyReportProcedure+ .input(verifyRunIdInputSchema)+ .query(async ({ ctx, input }) => {+ const readable = await findReadableVerifyRun(ctx, input.verifyRunId);+ const acceptanceId = readable?.run.acceptanceId;+ if (!acceptanceId) return null;++ return { acceptanceId, roundIndex: readable.run.roundIndex ?? null };+ }),+};diff --git a/apps/workbench/app/components/verifyDetail.client.tsx b/apps/workbench/app/components/verifyDetail.client.tsxdeleted file mode 100644index 67e9a417a7b..00000000000--- a/apps/workbench/app/components/verifyDetail.client.tsx+++ /dev/null@@ -1 +0,0 @@-export { default } from '../../src/features/verify/VerifyDetail';diff --git a/apps/workbench/app/routes.ts b/apps/workbench/app/routes.tsindex 181bfec39ee..80c65ba543f 100644--- a/apps/workbench/app/routes.ts+++ b/apps/workbench/app/routes.ts@@ -8,9 +8,10 @@ export default [route(':acceptanceId', 'routes/acceptanceDetail.tsx'),route(':acceptanceId/check/:checkId', 'routes/acceptanceDetailCheck.tsx'),]),+ // Retired report surface: old links redirect into Acceptance.route('verify', 'layouts/verifyNamespace.tsx', [- index('routes/verifyList.tsx'),- route(':runId', 'routes/verifyDetail.tsx'),+ index('routes/verifyListRedirect.tsx'),+ route(':runId', 'routes/verifyRunRedirect.tsx'),]),route('*', 'routes/catchall.tsx'),] satisfies RouteConfig;diff --git a/apps/workbench/app/routes/verifyDetail.tsx b/apps/workbench/app/routes/verifyDetail.tsxdeleted file mode 100644index 98df1b473cd..00000000000--- a/apps/workbench/app/routes/verifyDetail.tsx+++ /dev/null@@ -1,3 +0,0 @@-import { clientOnlyRoute } from '../components/clientOnlyRoute';--export default clientOnlyRoute(() => import('../components/verifyDetail.client'));diff --git a/apps/workbench/app/routes/verifyList.tsx b/apps/workbench/app/routes/verifyList.tsxdeleted file mode 100644index 04b11b9ba90..00000000000--- a/apps/workbench/app/routes/verifyList.tsx+++ /dev/null@@ -1 +0,0 @@-export { default } from '../../src/features/verify/VerifyList';diff --git a/apps/workbench/app/routes/verifyListRedirect.tsx b/apps/workbench/app/routes/verifyListRedirect.tsxnew file mode 100644index 00000000000..a23915c8973--- /dev/null+++ b/apps/workbench/app/routes/verifyListRedirect.tsx@@ -0,0 +1,12 @@+import { redirect } from 'react-router';++import { ACCEPTANCE_LIST_PATH } from '@/features/Acceptance/roundLink';++import WorkbenchLoading from '../../src/shell/WorkbenchLoading';++// The standalone report list is gone; reports live on Acceptance.+export const loader = () => redirect(ACCEPTANCE_LIST_PATH);++export default function VerifyListRedirect() {+ return <WorkbenchLoading />;+}diff --git a/apps/workbench/app/routes/verifyRunRedirect.tsx b/apps/workbench/app/routes/verifyRunRedirect.tsxnew file mode 100644index 00000000000..206d42dc4bc--- /dev/null+++ b/apps/workbench/app/routes/verifyRunRedirect.tsx@@ -0,0 +1,31 @@+import type { LoaderFunctionArgs } from 'react-router';+import { data, redirect } from 'react-router';++import { buildAcceptanceRoundPath } from '@/features/Acceptance/roundLink';+import { extractUuid } from '@/features/Acceptance/utils';++import { VerifyReportUnavailable } from '../../src/features/verify/VerifyReportUnavailable';+import { cloudflareContext } from '../lib/cloudflareContext';+import { createServerLambdaClient } from '../lib/serverTrpc';++// The standalone report page is gone: an old `/verify/:runId` link resolves to+// the run's acceptance round under the run's own read rule (the visitor's+// cookies ride along), and only a run with nowhere to go renders here.+export const loader = async ({ context, params, request }: LoaderFunctionArgs) => {+ const verifyRunId = extractUuid(params.runId);+ const apiBase = context.get(cloudflareContext).env.WORKBENCH_API_BASE as string | undefined;+ const round = verifyRunId+ ? await createServerLambdaClient(request, apiBase).verify.getRunAcceptanceRound.query({+ verifyRunId,+ })+ : null;+ const target = buildAcceptanceRoundPath(round, new URL(request.url).search);++ if (target) throw redirect(target);++ return data(null, { status: 404 });+};++export default function VerifyRunRedirectRoute() {+ return <VerifyReportUnavailable />;+}diff --git a/apps/workbench/src/features/verify/VerifyDetail.tsx b/apps/workbench/src/features/verify/VerifyDetail.tsxdeleted file mode 100644index 9eec935dfb2..00000000000--- a/apps/workbench/src/features/verify/VerifyDetail.tsx+++ /dev/null@@ -1,64 +0,0 @@-'use client';--import { Flexbox } from '@lobehub/ui/es/Flex/index';-import Text from '@lobehub/ui/es/Text/index';-import { createStaticStyles, cssVar } from '@lobehub/ui';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { useParams } from 'react-router';--import { useVerifyReportBundle } from '@/features/Acceptance/hooks';-import ReportViewer from '@/features/Acceptance/Report/ReportViewer';-import { extractUuid } from '@/features/Acceptance/utils';--import { WorkbenchHeader } from '../../shell/WorkbenchHeader';-import SWRMutateInitializer from '../acceptance/SWRMutateInitializer';--const styles = createStaticStyles(({ css }) => ({- body: css`- overflow: hidden;- flex: 1;- min-height: 0;- `,- header: css`- flex: none;-- min-height: 48px;- padding-inline: 12px;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};-- background: ${cssVar.colorBgContainer};- `,- page: css`- width: 100%;- height: 100dvh;- background: ${cssVar.colorBgContainer};- `,-}));--const WorkbenchVerifyDetail = memo(() => {- const { t } = useTranslation('verify');- const params = useParams<{ runId: string }>();- const runId = extractUuid(params.runId);- const { data } = useVerifyReportBundle(runId ?? null);-- return (- <Flexbox className={styles.page}>- <SWRMutateInitializer />- <Flexbox className={styles.header} justify={'center'}>- <WorkbenchHeader>- <Text ellipsis strong style={{ minWidth: 0 }}>- {data?.run.title ?? t('report.titleFallback')}- </Text>- </WorkbenchHeader>- </Flexbox>- <div className={styles.body}>- <ReportViewer />- </div>- </Flexbox>- );-});--WorkbenchVerifyDetail.displayName = 'WorkbenchVerifyDetail';--export default WorkbenchVerifyDetail;diff --git a/apps/workbench/src/features/verify/VerifyList.tsx b/apps/workbench/src/features/verify/VerifyList.tsxdeleted file mode 100644index 9c256959feb..00000000000--- a/apps/workbench/src/features/verify/VerifyList.tsx+++ /dev/null@@ -1,191 +0,0 @@-'use client';--import Empty from '@lobehub/ui/es/Empty/index';-import { Center, Flexbox } from '@lobehub/ui/es/Flex/index';-import Icon from '@lobehub/ui/es/Icon/index';-import Text from '@lobehub/ui/es/Text/index';-import { createStaticStyles, cssVar } from '@lobehub/ui';-import { ClipboardCheck, Search, TriangleAlert } from 'lucide-react';-import { memo, useState } from 'react';-import { useTranslation } from 'react-i18next';-import useSWR from 'swr';--import { verifyKeys } from '@/libs/swr/keys';-import { verifyService } from '@/services/verify';--import { WorkbenchHeader } from '../../shell/WorkbenchHeader';-import VerifyRow from './VerifyRow';--const styles = createStaticStyles(({ css }) => ({- content: css`- overflow: hidden auto;- flex: 1;- min-height: 0;- `,- emptyState: css`- min-height: 280px;- padding-block: 24px;- padding-inline: 16px;- `,- header: css`- flex: none;- padding: 12px;- border-block-end: 1px solid ${cssVar.colorBorderSecondary};- `,- list: css`- display: flex;- flex-direction: column;- gap: 2px;-- padding-block: 8px 24px;- padding-inline: 8px;- `,- page: css`- width: 100%;- height: 100dvh;- background: ${cssVar.colorBgLayout};- `,- retry: css`- cursor: pointer;-- padding-block: 6px;- padding-inline: 12px;- border: 1px solid ${cssVar.colorBorder};- border-radius: ${cssVar.borderRadius};-- color: ${cssVar.colorTextSecondary};-- background: ${cssVar.colorBgContainer};- `,- search: css`- display: flex;- gap: 8px;- align-items: center;-- height: 36px;- padding-inline: 11px;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadius};-- background: ${cssVar.colorBgContainer};-- input {- width: 100%;- min-width: 0;- border: 0;-- color: ${cssVar.colorText};-- background: transparent;- outline: none;- }- `,- searchEmpty: css`- padding-block: 28px;- padding-inline: 16px;- color: ${cssVar.colorTextTertiary};- `,- skeleton: css`- height: 52px;- margin-block: 2px;- border-radius: ${cssVar.borderRadiusLG};- background: ${cssVar.colorFillTertiary};- `,- skeletonList: css`- padding-block: 8px;- padding-inline: 8px;- `,-}));--const WorkbenchVerifyList = memo(() => {- const { t } = useTranslation('verify');- const [query, setQuery] = useState('');- const trimmedQuery = query.trim();- const { data, error, isLoading, mutate } = useSWR(- verifyKeys.reportSummaries(undefined, trimmedQuery),- () =>- verifyService.listReportSummaries({- limit: 50,- q: trimmedQuery || undefined,- }),- {- revalidateIfStale: false,- revalidateOnFocus: false,- revalidateOnReconnect: false,- },- );- const items = data?.items ?? [];-- return (- <Flexbox className={styles.page}>- <Flexbox className={styles.header} gap={12}>- <WorkbenchHeader>- <Text strong style={{ fontSize: 17 }}>- {t('workspace.title')}- </Text>- </WorkbenchHeader>- <label className={styles.search}>- <Icon color={cssVar.colorTextQuaternary} icon={Search} size={15} />- <input- placeholder={t('workspace.search')}- type={'search'}- value={query}- onChange={(event) => setQuery(event.target.value)}- />- </label>- </Flexbox>-- <div className={styles.content}>- {error ? (- <Center className={styles.emptyState} gap={12}>- <Empty- description={t('workspace.loadError')}- icon={TriangleAlert}- title={t('workspace.loadErrorTitle')}- />- <button className={styles.retry} type={'button'} onClick={() => void mutate()}>- {t('workspace.retry')}- </button>- </Center>- ) : isLoading ? (- <div className={styles.skeletonList}>- {Array.from({ length: 8 }).map((_, index) => (- <div className={styles.skeleton} key={index} />- ))}- </div>- ) : items.length === 0 ? (- trimmedQuery ? (- <Flexbox className={styles.searchEmpty} gap={12}>- <span>- {t('workspace.searchEmptyPrefix')}- {trimmedQuery}- {t('workspace.searchEmptySuffix')}- </span>- <button className={styles.retry} type={'button'} onClick={() => setQuery('')}>- {t('workspace.clearSearch')}- </button>- </Flexbox>- ) : (- <Center className={styles.emptyState}>- <Empty- description={t('workspace.listEmpty')}- icon={ClipboardCheck}- title={t('workspace.listEmptyTitle')}- />- </Center>- )- ) : (- <div className={styles.list}>- {items.map((item) => (- <VerifyRow item={item} key={item.run.id} />- ))}- </div>- )}- </div>- </Flexbox>- );-});--WorkbenchVerifyList.displayName = 'WorkbenchVerifyList';--export default WorkbenchVerifyList;diff --git a/apps/workbench/src/features/verify/VerifyReportUnavailable.tsx b/apps/workbench/src/features/verify/VerifyReportUnavailable.tsxnew file mode 100644index 00000000000..3bb2f1e703b--- /dev/null+++ b/apps/workbench/src/features/verify/VerifyReportUnavailable.tsx@@ -0,0 +1,56 @@+'use client';++import Empty from '@lobehub/ui/es/Empty/index';+import { Center, Flexbox } from '@lobehub/ui/es/Flex/index';+import { createStaticStyles, cssVar } from '@lobehub/ui';+import { ClipboardX } from 'lucide-react';+import { useTranslation } from 'react-i18next';++import { WorkbenchHeader } from '../../shell/WorkbenchHeader';++const styles = createStaticStyles(({ css }) => ({+ body: css`+ flex: 1;+ min-height: 0;+ padding-block: 24px;+ padding-inline: 16px;+ `,+ header: css`+ flex: none;++ min-height: 48px;+ padding-inline: 12px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};++ background: ${cssVar.colorBgContainer};+ `,+ page: css`+ width: 100%;+ height: 100dvh;+ background: ${cssVar.colorBgContainer};+ `,+}));++/**+ * What an old `/verify/:runId` link shows when it has nowhere to go: the run is+ * missing, not shared with the visitor, or outside any acceptance — the+ * acceptance page being the only place a report is published now.+ */+export const VerifyReportUnavailable = () => {+ const { t } = useTranslation('verify');++ return (+ <Flexbox className={styles.page}>+ <Flexbox className={styles.header} justify={'center'}>+ <WorkbenchHeader />+ </Flexbox>+ <Center className={styles.body}>+ <Empty+ description={t('report.unavailable.description')}+ icon={ClipboardX}+ title={t('report.unavailable.title')}+ />+ </Center>+ </Flexbox>+ );+};diff --git a/apps/workbench/src/features/verify/VerifyRow.tsx b/apps/workbench/src/features/verify/VerifyRow.tsxdeleted file mode 100644index 7f596199644..00000000000--- a/apps/workbench/src/features/verify/VerifyRow.tsx+++ /dev/null@@ -1,162 +0,0 @@-'use client';--import type { VerifyRunStatus, VerifyVerdict } from '@lobechat/types';-import { Flexbox } from '@lobehub/ui/es/Flex/index';-import Icon from '@lobehub/ui/es/Icon/index';-import { createStaticStyles, cssVar } from '@lobehub/ui';-import dayjs from 'dayjs';-import { CircleCheck, CircleHelp, CircleX, LoaderCircle } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';-import { useNavigate } from 'react-router';--import type { VerifyReportSummary } from '@/services/verify';--const styles = createStaticStyles(({ css }) => ({- counts: css`- em {- font-style: normal;- color: ${cssVar.colorError};- }- `,- itemSub: css`- overflow: hidden;-- font-size: 12px;- line-height: 16px;- color: ${cssVar.colorTextTertiary};- text-overflow: ellipsis;- white-space: nowrap;- `,- main: css`- cursor: pointer;-- overflow: hidden;- display: flex;- gap: 10px;- align-items: center;-- width: 100%;- padding-block: 10px;- padding-inline: 10px;- border: 0;- border-radius: ${cssVar.borderRadiusLG};-- text-align: start;-- background: transparent;-- &:hover {- background: ${cssVar.colorFillTertiary};- }- `,- row: css`- display: flex;- align-items: stretch;- `,- spin: css`- animation: workbench-verify-spin 0.9s linear infinite;-- @keyframes workbench-verify-spin {- to {- transform: rotate(360deg);- }- }- `,- title: css`- overflow: hidden;-- font-size: 14px;- font-weight: 500;- line-height: 20px;- color: ${cssVar.colorText};- text-overflow: ellipsis;- white-space: nowrap;- `,-}));--type Glyph = 'ok' | 'bad' | 'unsure' | 'running';--const runningStatuses = new Set<VerifyRunStatus>(['planned', 'repairing', 'verifying']);--const glyphOf = (- status: VerifyRunStatus | null,- verdict: VerifyVerdict | null | undefined,-): Glyph => {- if (status && runningStatuses.has(status)) return 'running';- if (verdict === 'passed' || status === 'passed' || status === 'delivered') return 'ok';- if (verdict === 'failed' || status === 'failed') return 'bad';- return 'unsure';-};--const glyphMeta: Record<Glyph, { color: string; icon: typeof CircleCheck }> = {- bad: { color: cssVar.colorError, icon: CircleX },- ok: { color: cssVar.colorSuccess, icon: CircleCheck },- running: { color: cssVar.colorInfo, icon: LoaderCircle },- unsure: { color: cssVar.colorWarning, icon: CircleHelp },-};--const relativeTime = (value?: Date | string | null) => {- if (!value) return '';- const d = dayjs(value);- return dayjs().diff(d, 'day') < 7 ? d.fromNow() : d.format('MMM D');-};--interface VerifyRowProps {- item: VerifyReportSummary;-}--const VerifyRow = memo<VerifyRowProps>(({ item }) => {- const { t } = useTranslation('verify');- const navigate = useNavigate();- const status = item.run.status ?? null;- const glyph = glyphOf(status, item.report?.verdict);- const meta = glyphMeta[glyph];- const planCount = Array.isArray(item.run.plan) ? item.run.plan.length : 0;- const total = item.report?.totalChecks ?? planCount;- const passed = item.report?.passedChecks ?? 0;- const failed = item.report?.failedChecks ?? 0;- const title = item.run.title || t('reports.untitled');- const time =- glyph === 'running'- ? t('list.running')- : relativeTime(item.report?.generatedAt ?? item.run.createdAt);-- return (- <div className={styles.row}>- <button- className={styles.main}- type={'button'}- onClick={() => navigate(`/verify/${item.run.id}`)}- >- <Icon- className={glyph === 'running' ? styles.spin : undefined}- icon={meta.icon}- size={17}- style={{ color: meta.color }}- />- <span style={{ minWidth: 0 }}>- <span className={styles.title}>{title}</span>- <Flexbox horizontal className={styles.itemSub} gap={8}>- {time ? <span>{time}</span> : null}- {total > 0 && glyph !== 'running' ? (- <span className={styles.counts}>- {passed}/{total}- {failed > 0 ? (- <>- {' · '}- <em>{t('list.failedCount', { count: failed })}</em>- </>- ) : null}- </span>- ) : null}- </Flexbox>- </span>- </button>- </div>- );-});--VerifyRow.displayName = 'VerifyRow';--export default VerifyRow;diff --git a/apps/workbench/src/features/verify/VerifyRunRedirect.tsx b/apps/workbench/src/features/verify/VerifyRunRedirect.tsxnew file mode 100644index 00000000000..fb02478e1bf--- /dev/null+++ b/apps/workbench/src/features/verify/VerifyRunRedirect.tsx@@ -0,0 +1,41 @@+'use client';++import { useEffect } from 'react';+import { useLocation, useParams } from 'react-router';+import useSWR from 'swr';++import { buildAcceptanceRoundPath } from '@/features/Acceptance/roundLink';+import { extractUuid } from '@/features/Acceptance/utils';+import { verifyKeys } from '@/libs/swr/keys';+import { verifyService } from '@/services/verify';++import WorkbenchLoading from '../../shell/WorkbenchLoading';+import { VerifyReportUnavailable } from './VerifyReportUnavailable';++/**+ * Client-rendered `/verify/:runId` (the self-hosted build, which has no+ * loader): resolve the run's acceptance round and leave for it. A full+ * navigation, not a router push, because the host decides which app serves+ * `/acceptance/:id`.+ */+export const VerifyRunRedirect = () => {+ const params = useParams<{ runId: string }>();+ const runId = extractUuid(params.runId);+ const { search } = useLocation();+ const { data, error, isLoading } = useSWR(+ runId ? verifyKeys.runAcceptanceRound(runId) : null,+ () => verifyService.getRunAcceptanceRound(runId!),+ { revalidateOnFocus: false, revalidateOnReconnect: false },+ );+ const target = buildAcceptanceRoundPath(data, search);++ useEffect(() => {+ if (target) window.location.replace(target);+ }, [target]);++ // Let the route's error boundary offer a retry instead of claiming the report is gone.+ if (error) throw error;+ if (isLoading || target) return <WorkbenchLoading />;++ return <VerifyReportUnavailable />;+};diff --git a/apps/workbench/src/router.tsx b/apps/workbench/src/router.tsxindex 8911b12f8d2..78152a916e9 100644--- a/apps/workbench/src/router.tsx+++ b/apps/workbench/src/router.tsx@@ -4,6 +4,7 @@ import { lazy, Suspense, useEffect } from 'react';import type { RouteObject } from 'react-router';import { Outlet, useRouteError } from 'react-router';+import { ACCEPTANCE_LIST_PATH } from '@/features/Acceptance/roundLink';import { isChunkLoadError, notifyChunkError } from '@/utils/chunkError';import WorkbenchShell, { WorkbenchNamespace } from './shell';@@ -61,10 +62,11 @@ const WorkbenchErrorBoundary = () => {);};-const ExitWorkbench = () => {+/** Leave the Workbench for a page another app serves; the host picks which. */+const HardRedirect = ({ to }: { to: string }) => {useEffect(() => {- window.location.replace('/');- }, []);+ window.location.replace(to);+ }, [to]);return <WorkbenchLoading />;};@@ -91,7 +93,7 @@ export const workbenchRoutes: RouteObject[] = [{children: [{- element: <ExitWorkbench />,+ element: <HardRedirect to={'/'} />,index: true,},{@@ -109,10 +111,12 @@ export const workbenchRoutes: RouteObject[] = [{children: [{- element: lazyElement(() => import('./routes/verify')),+ // The standalone report list is gone; reports live on Acceptance.+ element: <HardRedirect to={ACCEPTANCE_LIST_PATH} />,index: true,},{+ // Old report links resolve to the run's acceptance round.element: lazyElement(() => import('./routes/verify/[runId]')),path: ':runId',},@@ -121,7 +125,7 @@ export const workbenchRoutes: RouteObject[] = [path: 'verify',},{- element: <ExitWorkbench />,+ element: <HardRedirect to={'/'} />,path: '*',},],diff --git a/apps/workbench/src/routes/verify/[runId]/index.tsx b/apps/workbench/src/routes/verify/[runId]/index.tsxindex 86a73d14c21..0a3230d5292 100644--- a/apps/workbench/src/routes/verify/[runId]/index.tsx+++ b/apps/workbench/src/routes/verify/[runId]/index.tsx@@ -1,3 +1,3 @@'use client';-export { default } from '../../../features/verify/VerifyDetail';+export { VerifyRunRedirect as default } from '../../../features/verify/VerifyRunRedirect';diff --git a/apps/workbench/src/routes/verify/index.tsx b/apps/workbench/src/routes/verify/index.tsxdeleted file mode 100644index ef043cb230b..00000000000--- a/apps/workbench/src/routes/verify/index.tsx+++ /dev/null@@ -1,3 +0,0 @@-'use client';--export { default } from '../../features/verify/VerifyList';diff --git a/apps/workbench/src/shell/WorkbenchHeader.test.ts b/apps/workbench/src/shell/WorkbenchHeader.test.tsindex e7868e96949..874461c85c2 100644--- a/apps/workbench/src/shell/WorkbenchHeader.test.ts+++ b/apps/workbench/src/shell/WorkbenchHeader.test.ts@@ -9,8 +9,7 @@ const brand = readFileSync(path.join(dir, 'WorkbenchBrandLink.tsx'), 'utf8');const pageFiles = ['../features/acceptance/AcceptanceDetail.tsx',- '../features/verify/VerifyDetail.tsx',- '../features/verify/VerifyList.tsx',+ '../features/verify/VerifyReportUnavailable.tsx',] as const;describe('WorkbenchHeader', () => {diff --git a/locales/en-US/electron.json b/locales/en-US/electron.jsonindex b3c73530750..1c06bbb46c1 100644--- a/locales/en-US/electron.json+++ b/locales/en-US/electron.json@@ -65,7 +65,6 @@"navigation.tasks": "Tasks","navigation.topics": "Topics","navigation.unpin": "Unpin",- "navigation.verifyReports": "Verification Reports","navigation.video": "Video","notification.finishChatGeneration": "AI message generation completed","proxy.auth": "Authentication Required",diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 8eee146e23a..1330b0f7ea8 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -797,6 +797,8 @@"report.surface.mobile": "Mobile","report.surface.web": "Web","report.titleFallback": "Verification report",+ "report.unavailable.description": "Reports now live on their acceptance. This one is not part of an acceptance, or it was never shared with you.",+ "report.unavailable.title": "This report is no longer available","report.verdict.failed": "Failed","report.verdict.notExecuted": "Not run","report.verdict.passed": "Passed",diff --git a/locales/zh-CN/electron.json b/locales/zh-CN/electron.jsonindex a990700c4cf..2a3f861f744 100644--- a/locales/zh-CN/electron.json+++ b/locales/zh-CN/electron.json@@ -65,7 +65,6 @@"navigation.tasks": "任务","navigation.topics": "话题","navigation.unpin": "取消固定",- "navigation.verifyReports": "验证报告","navigation.video": "视频","notification.finishChatGeneration": "AI 消息已生成完毕","proxy.auth": "需要认证",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex 284b0cb597d..7fc28958b9a 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -797,6 +797,8 @@"report.surface.mobile": "移动端","report.surface.web": "网页端","report.titleFallback": "验证报告",+ "report.unavailable.description": "报告现在随其验收一起查看。这份报告不属于任何验收,或未分享给你。",+ "report.unavailable.title": "该报告已不再提供","report.verdict.failed": "未通过","report.verdict.notExecuted": "未执行","report.verdict.passed": "已通过",diff --git a/packages/locales/src/default/electron.ts b/packages/locales/src/default/electron.tsindex 3bbac68c2bd..3fab9641eb2 100644--- a/packages/locales/src/default/electron.ts+++ b/packages/locales/src/default/electron.ts@@ -62,7 +62,6 @@ export default {'navigation.goals': 'Goals','navigation.topics': 'Topics','navigation.unpin': 'Unpin',- 'navigation.verifyReports': 'Verification Reports','navigation.video': 'Video','notification.finishChatGeneration': 'AI message generation completed','tab.closeCurrentTab': 'Close Tab',diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex 1bca3d18955..af28068c492 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -904,6 +904,9 @@ export default {'report.surface.mobile': 'Mobile','report.surface.web': 'Web','report.titleFallback': 'Verification report',+ 'report.unavailable.description':+ 'Reports now live on their acceptance. This one is not part of an acceptance, or it was never shared with you.',+ 'report.unavailable.title': 'This report is no longer available','report.verdict.failed': 'Failed','report.verdict.notExecuted': 'Not run','report.verdict.passed': 'Passed',diff --git a/src/features/Acceptance/hooks.test.ts b/src/features/Acceptance/hooks.test.tsindex cb8dd581980..17f0daa8e24 100644--- a/src/features/Acceptance/hooks.test.ts+++ b/src/features/Acceptance/hooks.test.ts@@ -13,24 +13,12 @@ import {useAcceptanceList,useRubrics,useVerifyReportBundle,- useVerifyReportSummariesInfinite,} from './hooks';const useSWRInfiniteMock = vi.hoisted(() => vi.fn());vi.mock('swr/infinite', () => ({ default: useSWRInfiniteMock }));-const mockInfiniteResponse = (overrides: Record<string, unknown> = {}) => ({- data: undefined,- error: undefined,- isLoading: false,- isValidating: false,- mutate: vi.fn(),- setSize: vi.fn(),- size: 1,- ...overrides,-});-const createSWRWrapper = (cache: Cache) =>function SWRTestWrapper({ children }: PropsWithChildren) {return createElement(SWRConfig, { value: { provider: () => cache } }, children);@@ -142,28 +130,4 @@ describe('Verify data hooks', () => {expect(listRubrics).not.toHaveBeenCalled();});-- it('keeps loaded reports visible while SWR revalidates after a remount', () => {- useSWRInfiniteMock.mockReturnValue(- mockInfiniteResponse({- data: [{ items: [], nextCursor: null }],- isLoading: true,- isValidating: true,- }),- );-- const { result } = renderHook(() => useVerifyReportSummariesInfinite(''));-- expect(result.current.isLoadingInitial).toBe(false);- expect(result.current.isLoadingMore).toBe(false);- });-- it('reports initial loading only before the first page is available', () => {- useSWRInfiniteMock.mockReturnValue(mockInfiniteResponse({ isLoading: true }));-- const { result } = renderHook(() => useVerifyReportSummariesInfinite(''));-- expect(result.current.isLoadingInitial).toBe(true);- expect(result.current.isLoadingMore).toBe(false);- });});diff --git a/src/features/Acceptance/hooks.ts b/src/features/Acceptance/hooks.tsindex 7b8bfa77f5d..2d80c8ed18b 100644--- a/src/features/Acceptance/hooks.ts+++ b/src/features/Acceptance/hooks.ts@@ -11,12 +11,10 @@ import type {AcceptanceListFilter,AcceptanceListPage,AcceptanceListQuery,- VerifyReportSummaryPage,} from '@/services/verify';import { verifyService } from '@/services/verify';import { useVerifyStore } from '@/store/verify';-const VERIFY_REPORT_PAGE_SIZE = 30;const ACCEPTANCE_PAGE_SIZE = 30;const VERIFY_REPORT_SWR_CONFIG = {revalidateIfStale: false,@@ -279,76 +277,6 @@ export const useAcceptanceStatuses = (ACCEPTANCE_BUNDLE_SWR_CONFIG,);-/**- * Cursor-paginated, infinite-scrolling report summaries. `q` drives a- * server-side title search (spanning the whole history, not just loaded pages);- * changing it collapses back to the first page.- */-export const useVerifyReportSummariesInfinite = (q: string) => {- const workspaceId = useActiveWorkspaceId();-- const getKey = useCallback(- (_index: number, previous: VerifyReportSummaryPage | null) => {- // Stop paging once the previous page reported no further cursor.- if (previous && previous.nextCursor === null) return null;- return verifyKeys.reportSummaries(workspaceId, q, previous?.nextCursor ?? undefined);- },- [q, workspaceId],- );-- const { data, error, isLoading, isValidating, mutate, setSize, size } = useSWRInfinite(- getKey,- ([, , query, cursor]: readonly [string, string, string, string]) =>- verifyService.listReportSummaries({- cursor: cursor || undefined,- limit: VERIFY_REPORT_PAGE_SIZE,- q: query || undefined,- }),- { ...VERIFY_REPORT_SWR_CONFIG, revalidateFirstPage: false },- );-- // A new search term starts a fresh key series; collapse size back to 1 so we- // don't cascade-fetch as many pages as the previous query had loaded.- useEffect(() => {- setSize(1);- }, [q, setSize]);-- const loadMore = useCallback(() => {- void setSize((s) => s + 1);- }, [setSize]);- const reload = useCallback(() => {- void mutate();- }, [mutate]);-- // SWR leaves a failed/pending page's slot `undefined`, so guard the holes.- const items = data?.flatMap((page) => page?.items ?? []) ?? [];- const lastLoadedPage = data?.findLast(Boolean);- const reachedEnd = lastLoadedPage ? lastLoadedPage.nextCursor === null : false;- const hasLoadedPages = data !== undefined;-- // Keep already-loaded rows visible while SWR revalidates after a focus/remount.- // A subsequent page is genuinely in flight only when the loaded page array has- // an unresolved tail slot; raw `isLoading` also covers first-load revalidation.- const isLoadingInitial = !error && isLoading && !hasLoadedPages;- const isLoadingMore =- !error && hasLoadedPages && size > 0 && typeof data[size - 1] === 'undefined';-- // Pause the sentinel while an error is showing so it can't hot-loop the failed- // page; the panel offers a manual retry (`reload`) instead.- const hasMore = !reachedEnd && !error;-- return {- error,- hasMore,- isLoadingInitial,- isLoadingMore,- isValidating,- items,- loadMore,- reload,- };-};-/** Model / token / latency for an LLM verifier judgment. Pass null to skip. */export const useVerifierTracing = (tracingId: string | null | undefined) =>useClientDataSWR(tracingId ? verifyKeys.tracing(tracingId) : null, () =>diff --git a/src/features/Acceptance/index.ts b/src/features/Acceptance/index.tsindex e1baa03724a..8ebc3578b35 100644--- a/src/features/Acceptance/index.ts+++ b/src/features/Acceptance/index.ts@@ -12,7 +12,6 @@ export {export {useAcceptanceBundle,useAcceptanceBySubject,- useVerifyReportSummariesInfinite,useVerifyResults,useVerifyState,} from './hooks';diff --git a/src/features/Acceptance/roundLink.test.ts b/src/features/Acceptance/roundLink.test.tsnew file mode 100644index 00000000000..25729ad435d--- /dev/null+++ b/src/features/Acceptance/roundLink.test.ts@@ -0,0 +1,42 @@+import { describe, expect, it } from 'vitest';++import { buildAcceptanceRoundPath } from './roundLink';++describe('buildAcceptanceRoundPath', () => {+ it('deep-links a run in an acceptance to its round', () => {+ expect(buildAcceptanceRoundPath({ acceptanceId: 'acc-1', roundIndex: 2 })).toBe(+ '/acceptance/acc-1?r=2',+ );+ });++ it('has no destination for a run outside any acceptance', () => {+ expect(buildAcceptanceRoundPath({ acceptanceId: null, roundIndex: null })).toBeNull();+ expect(buildAcceptanceRoundPath({})).toBeNull();+ expect(buildAcceptanceRoundPath(null)).toBeNull();+ expect(buildAcceptanceRoundPath(undefined)).toBeNull();+ });++ it('opens the acceptance on its default view when the round is unknown', () => {+ expect(buildAcceptanceRoundPath({ acceptanceId: 'acc-1', roundIndex: null })).toBe(+ '/acceptance/acc-1',+ );+ expect(buildAcceptanceRoundPath({ acceptanceId: 'acc-1', roundIndex: 0 })).toBe(+ '/acceptance/acc-1',+ );+ });++ it('keeps the incoming query and replaces a stale round', () => {+ expect(+ buildAcceptanceRoundPath({ acceptanceId: 'acc-1', roundIndex: 3 }, '?hl=zh-CN&r=9'),+ ).toBe('/acceptance/acc-1?hl=zh-CN&r=3');+ expect(buildAcceptanceRoundPath({ acceptanceId: 'acc-1', roundIndex: null }, '?r=9')).toBe(+ '/acceptance/acc-1',+ );+ });++ it('encodes the acceptance id as one path segment', () => {+ expect(buildAcceptanceRoundPath({ acceptanceId: 'a/b', roundIndex: 1 })).toBe(+ '/acceptance/a%2Fb?r=1',+ );+ });+});diff --git a/src/features/Acceptance/roundLink.ts b/src/features/Acceptance/roundLink.tsnew file mode 100644index 00000000000..9f46a104983--- /dev/null+++ b/src/features/Acceptance/roundLink.ts@@ -0,0 +1,38 @@+/** Where the retired `/verify` report list now sends its visitors. */+export const ACCEPTANCE_LIST_PATH = '/acceptance';++/** The two run-row columns that place a verify run inside an acceptance. */+export interface AcceptanceRoundRef {+ acceptanceId?: string | null;+ roundIndex?: number | null;+}++/**+ * The acceptance page deep-linked to the round a verify run belongs to:+ * `/acceptance/<acceptanceId>?r=<roundIndex>`. This is the only page a run's+ * report is reachable through now that the standalone `/verify/:runId` page is+ * gone, so `null` means the run has no page — it never joined an acceptance, or+ * its acceptance was deleted and left it standalone.+ *+ * `search` is the incoming query string (an old `/verify` link's `?hl=`, for+ * one); its other params survive the move. Rounds count from 1, so a missing or+ * out-of-range index opens the acceptance on its default view instead of a+ * round the page would reject.+ */+export const buildAcceptanceRoundPath = (+ ref: AcceptanceRoundRef | null | undefined,+ search = '',+): string | null => {+ if (!ref?.acceptanceId) return null;++ const params = new URLSearchParams(search);+ const { roundIndex } = ref;+ if (typeof roundIndex === 'number' && Number.isSafeInteger(roundIndex) && roundIndex > 0) {+ params.set('r', String(roundIndex));+ } else {+ params.delete('r');+ }+ const query = params.toString();++ return `${ACCEPTANCE_LIST_PATH}/${encodeURIComponent(ref.acceptanceId)}${query ? `?${query}` : ''}`;+};diff --git a/src/features/Acceptance/routeMeta.ts b/src/features/Acceptance/routeMeta.tsindex 3d429590b60..21c098baf96 100644--- a/src/features/Acceptance/routeMeta.ts+++ b/src/features/Acceptance/routeMeta.ts@@ -6,7 +6,7 @@ import { usePublishDynamicRouteMeta } from '@/features/RouteMeta/usePublishDynamimport type { DynamicRouteMetaProps } from '@/spa/router/routeMeta';import { routeMeta } from '@/spa/router/routeMeta';-import { useAcceptanceBundle, useVerifyReportBundle } from './hooks';+import { useAcceptanceBundle } from './hooks';const AcceptanceDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {const { t } = useTranslation('verify');@@ -25,34 +25,3 @@ export const acceptanceRouteMeta = routeMeta({icon: ClipboardCheckIcon,Skeleton: createSurfaceSkeleton('detail'),});--const VerifyDynamicMeta = ({ onResolve, params }: DynamicRouteMetaProps) => {- const { t } = useTranslation('verify');- const { data } = useVerifyReportBundle(params.runId ?? null);-- usePublishDynamicRouteMeta(- {- title: data?.run.title || t('report.titleFallback'),- },- onResolve,- );-- return null;-};--/**- * Standalone verification-report route (`/verify/:runId`). Drives the browser- * tab / desktop tab title off the report title via the shared route-meta layer,- * so we don't hand-roll `document.title`.- */-export const verifyRouteMeta = routeMeta({- DynamicMeta: VerifyDynamicMeta,- icon: ClipboardCheckIcon,- Skeleton: createSurfaceSkeleton('detail'),-});--export const verifyReportsRouteMeta = routeMeta({- icon: ClipboardCheckIcon,- Skeleton: createSurfaceSkeleton('list'),- titleKey: 'navigation.verifyReports',-});diff --git a/src/features/Portal/VerifyReport/Header.tsx b/src/features/Portal/VerifyReport/Header.tsxindex 4ec938cabf9..d9af1bc23c5 100644--- a/src/features/Portal/VerifyReport/Header.tsx+++ b/src/features/Portal/VerifyReport/Header.tsx@@ -12,22 +12,25 @@ import { useVerifyReportUrl } from './useReportUrl';const VerifyReportHeader = memo<{ onClose?: () => void }>(({ onClose }) => {const { t } = useTranslation('verify');- const { externalUrl } = useVerifyReportUrl();+ const { externalUrl, standalone } = useVerifyReportUrl();return (<Headertitle={<Title />}rightExtra={- <ActionIcon- disabled={!externalUrl}- icon={ExternalLink}- size={DESKTOP_HEADER_ICON_SMALL_SIZE}- title={t('report.actions.openInBrowser')}- onClick={() => {- if (!externalUrl) return;- openTrustedExternalUrl(externalUrl);- }}- />+ // A run outside any acceptance has no page to open in the browser.+ standalone ? undefined : (+ <ActionIcon+ disabled={!externalUrl}+ icon={ExternalLink}+ size={DESKTOP_HEADER_ICON_SMALL_SIZE}+ title={t('report.actions.openInBrowser')}+ onClick={() => {+ if (!externalUrl) return;+ openTrustedExternalUrl(externalUrl);+ }}+ />+ )}onClose={onClose}/>diff --git a/src/features/Portal/VerifyReport/useMoreMenu.test.ts b/src/features/Portal/VerifyReport/useMoreMenu.test.tsindex 3a3b9e4dc87..1b4a3a49d6f 100644--- a/src/features/Portal/VerifyReport/useMoreMenu.test.ts+++ b/src/features/Portal/VerifyReport/useMoreMenu.test.ts@@ -13,7 +13,10 @@ vi.mock('@/hooks/usePermission', () => ({ usePermission: () => ({ allowed: mocksvi.mock('@/libs/swr', () => ({ mutate: vi.fn() }));vi.mock('@/services/verify', () => ({ verifyService: { updateRunTitle: vi.fn() } }));vi.mock('./useReportUrl', () => ({- useVerifyReportUrl: () => ({ reportUrl: 'https://app.lobehub.com/verify/run_1', runId: 'run_1' }),+ useVerifyReportUrl: () => ({+ reportUrl: 'https://app.lobehub.com/acceptance/acc_1?r=2',+ runId: 'run_1',+ }),}));vi.mock('@/features/Acceptance/hooks', () => ({useVerifyReportBundle: () => ({@@ -40,7 +43,7 @@ describe('useVerifyReportMoreMenu', () => {expect(result.current?.rename).toBeUndefined();expect(result.current).toMatchObject({copyId: 'run_1',- copyLink: 'https://app.lobehub.com/verify/run_1',+ copyLink: 'https://app.lobehub.com/acceptance/acc_1?r=2',});});});diff --git a/src/features/Portal/VerifyReport/useMoreMenu.ts b/src/features/Portal/VerifyReport/useMoreMenu.tsindex f4f505e613c..5b06418ee07 100644--- a/src/features/Portal/VerifyReport/useMoreMenu.ts+++ b/src/features/Portal/VerifyReport/useMoreMenu.ts@@ -24,6 +24,7 @@ export const useVerifyReportMoreMenu = (): PortalMoreMenuConfig | undefined => {return {copyId: runId,+ // Only a run inside an acceptance has a page to link to.copyLink: reportUrl,refresh,rename:@@ -35,12 +36,7 @@ export const useVerifyReportMoreMenu = (): PortalMoreMenuConfig | undefined => {onSave: async (next) => {try {await verifyService.updateRunTitle(runId, next);- await Promise.all([- refresh(),- globalMutate(- (key) => Array.isArray(key) && key[0] === verifyKeys.reportSummaries.root,- ),- ]);+ await refresh();toast.success(t('workspace.renameSuccess'));} catch (error) {console.error('[verify-report:rename]', error);diff --git a/src/features/Portal/VerifyReport/useReportUrl.test.ts b/src/features/Portal/VerifyReport/useReportUrl.test.tsnew file mode 100644index 00000000000..a77cbc261c6--- /dev/null+++ b/src/features/Portal/VerifyReport/useReportUrl.test.ts@@ -0,0 +1,57 @@+import { renderHook } from '@testing-library/react';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { useVerifyReportUrl } from './useReportUrl';++const mocks = vi.hoisted(() => ({+ bundle: undefined as { run: Record<string, unknown> } | undefined,+}));++vi.mock('@/business/client/hooks/useActiveWorkspaceSlug', () => ({+ useActiveWorkspaceSlug: () => 'lobe-team',+}));+vi.mock('@/hooks/useAppOrigin', () => ({ useAppOrigin: () => 'https://app.lobehub.com' }));+vi.mock('@/store/chat', () => ({+ useChatStore: (selector: (state: unknown) => unknown) => selector({}),+}));+vi.mock('@/store/chat/selectors', () => ({+ chatPortalSelectors: { verifyReportRunId: () => 'run_1' },+}));+vi.mock('@/features/Acceptance/hooks', () => ({+ useVerifyReportBundle: () => ({ data: mocks.bundle }),+}));++describe('useVerifyReportUrl', () => {+ beforeEach(() => {+ mocks.bundle = undefined;+ });++ it('links a run in an acceptance to its round', () => {+ mocks.bundle = { run: { acceptanceId: 'acc_1', roundIndex: 2 } };+ const { result } = renderHook(() => useVerifyReportUrl());++ expect(result.current).toEqual({+ externalUrl: 'https://app.lobehub.com/acceptance/acc_1?r=2',+ reportUrl: 'https://app.lobehub.com/acceptance/acc_1?r=2',+ runId: 'run_1',+ standalone: false,+ });+ });++ it('has no link for a run outside any acceptance', () => {+ mocks.bundle = { run: { acceptanceId: null, roundIndex: null } };+ const { result } = renderHook(() => useVerifyReportUrl());++ expect(result.current).toMatchObject({+ externalUrl: undefined,+ reportUrl: undefined,+ standalone: true,+ });+ });++ it('waits for the run before deciding it is standalone', () => {+ const { result } = renderHook(() => useVerifyReportUrl());++ expect(result.current).toMatchObject({ reportUrl: undefined, standalone: false });+ });+});diff --git a/src/features/Portal/VerifyReport/useReportUrl.ts b/src/features/Portal/VerifyReport/useReportUrl.tsindex cf195ba9c85..4ea7a2acc99 100644--- a/src/features/Portal/VerifyReport/useReportUrl.ts+++ b/src/features/Portal/VerifyReport/useReportUrl.ts@@ -1,20 +1,29 @@import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';+import { useVerifyReportBundle } from '@/features/Acceptance/hooks';+import { buildAcceptanceRoundPath } from '@/features/Acceptance/roundLink';import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';import { useAppOrigin } from '@/hooks/useAppOrigin';import { useChatStore } from '@/store/chat';import { chatPortalSelectors } from '@/store/chat/selectors';-/** Web URL of the verify report the portal shows; `undefined` until a run id is known. */+/**+ * Web URL of the acceptance round the portal's report belongs to — the report's+ * only page outside the app. `undefined` until the run is loaded, and for good+ * once it turns out to be `standalone` (no acceptance, so nothing to open).+ */export const useVerifyReportUrl = () => {const appOrigin = useAppOrigin();const activeWorkspaceSlug = useActiveWorkspaceSlug();const runId = useChatStore(chatPortalSelectors.verifyReportRunId);- const reportPath = runId- ? buildWorkspaceAwarePath(`/verify/${runId}`, activeWorkspaceSlug)+ // Same SWR key as the portal's title and body, so this shares their request.+ const { data } = useVerifyReportBundle(runId ?? null);+ const roundPath = buildAcceptanceRoundPath(data?.run);+ const reportPath = roundPath+ ? buildWorkspaceAwarePath(roundPath, activeWorkspaceSlug): undefined;const reportUrl = reportPath ? `${appOrigin}${reportPath}` : undefined;// Without an origin the URL is relative — the system browser has nothing to resolve it against.const externalUrl = appOrigin && reportUrl ? reportUrl : undefined;- return { externalUrl, reportUrl, runId };+ return { externalUrl, reportUrl, runId, standalone: Boolean(data) && !roundPath };};diff --git a/src/libs/next/proxy/define-config.ts b/src/libs/next/proxy/define-config.tsindex 07c3ec730d7..b232f984ca5 100644--- a/src/libs/next/proxy/define-config.ts+++ b/src/libs/next/proxy/define-config.ts@@ -256,12 +256,14 @@ export function defineConfig() {'/market-auth-callback',// public share pages'/share(.*)',- // standalone verification report viewer — the run id in the URL is the- // read-only capability for viewing the report without a signed-in session.+ // retired standalone report links (/verify/:runId) — they now redirect to+ // the run's acceptance round, and must stay reachable without a session:+ // the run id is still the read capability, enforced by the run's own+ // `visibility` in `verify.getRunAcceptanceRound`.'/verify/(.*)',- // acceptance decision page — same shape as /verify/:id: the id is the- // capability; the tRPC layer enforces the aggregate's `visibility` (a- // private aggregate 404s for anyone but the owner / workspace members).+ // acceptance decision page — the id is the capability; the tRPC layer+ // enforces the aggregate's `visibility` (a private aggregate 404s for+ // anyone but the owner / workspace members).'/acceptance/(.*)',// messenger verify-im — page itself handles unauth (in-page sign-in CTA)// and the random_id token is the actual capability check; no need fordiff --git a/src/libs/next/workbenchRoutes.ts b/src/libs/next/workbenchRoutes.tsindex aec430d84a9..03924849040 100644--- a/src/libs/next/workbenchRoutes.ts+++ b/src/libs/next/workbenchRoutes.ts@@ -1,4 +1,5 @@const AGENT_DOCUMENT_ROUTE = /^\/agent\/[^/]+\/docs\/[^/]+\/?$/;+// Retired report links; the Workbench redirects them into Acceptance.const VERIFY_ROUTE = /^\/verify(?:\/[^/]+)?\/?$/;const pathOnly = (pathname: string) => pathname.split(/[?#]/, 1)[0]!;diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.tsindex 24328cb543b..dfaab4845d6 100644--- a/src/libs/swr/keys.ts+++ b/src/libs/swr/keys.ts@@ -767,7 +767,7 @@ export const verifyKeys = {),/*** One scroll page of the list panel. Keyed by workspace + the status split +- * the cursor, mirroring `reportSummaries` — the sibling paged feed.+ * the cursor.*/acceptancePurgePreview: def('verify:acceptancePurgePreview', (acceptanceId: string) => ['verify:acceptancePurgePreview',@@ -801,17 +801,13 @@ export const verifyKeys = {'verify:reportBundle',verifyRunId,]),- reportSummaries: def(- 'verify:reportSummaries',- (workspaceId?: string | null, q?: string, cursor?: string) => [- 'verify:reportSummaries',- workspaceId ?? '',- q ?? '',- cursor ?? '',- ],- ),results: def('verify:results', (operationId: string) => ['verify:results', operationId]),rubric: def('verify:rubric', (rubricId: string) => ['verify:rubric', rubricId]),+ /** The acceptance round an old `/verify/:runId` link redirects to. */+ runAcceptanceRound: def('verify:runAcceptanceRound', (verifyRunId: string) => [+ 'verify:runAcceptanceRound',+ verifyRunId,+ ]),rubricCriteria: def('verify:rubricCriteria', (rubricId: string) => ['verify:rubricCriteria',rubricId,diff --git a/src/proxy.ts b/src/proxy.tsindex ef05754c595..3c1a746e0f9 100644--- a/src/proxy.ts+++ b/src/proxy.ts@@ -64,6 +64,7 @@ export const config = {'/signin(.*)','/verify-email(.*)','/verify-im(.*)',+ // Retired report links: the Workbench redirects them into Acceptance.'/verify','/verify/(.*)','/reset-password(.*)',diff --git a/src/services/verify.ts b/src/services/verify.tsindex e3d0ccd9de4..ae6680bb3bd 100644--- a/src/services/verify.ts+++ b/src/services/verify.ts@@ -149,30 +149,10 @@ export interface VerifyReportBundle {run: VerifyRunItem;}-export interface VerifyReportSummary {- report: Pick<- VerifyReport,- | 'createdAt'- | 'failedChecks'- | 'generatedAt'- | 'id'- | 'overallConfidence'- | 'passedChecks'- | 'reviewedByUser'- | 'summary'- | 'totalChecks'- | 'uncertainChecks'- | 'verdict'- | 'verifyRunId'- > | null;- run: VerifyRunItem;-}--/** One cursor-paginated page of report summaries. */-export interface VerifyReportSummaryPage {- items: VerifyReportSummary[];- /** Opaque token for the next page, or `null` when this is the last page. */- nextCursor: string | null;+/** The acceptance round a verify run belongs to — where its old `/verify/:runId` link lands. */+export interface VerifyRunAcceptanceRound {+ acceptanceId: string;+ roundIndex: number | null;}export interface GenerateDraftPlanInput {@@ -446,16 +426,11 @@ export class VerifyService {}) as Promise<VerifyReportBundle | null>;/**- * One cursor-paginated page of the current user's verification sessions with- * report rollup fields. `cursor` comes from the previous page's `nextCursor`;- * `q` filters by title on the server so search spans the whole history.+ * The acceptance round a run belongs to, under the same access rule as+ * `getReportBundle`. `null` for a missing, denied or standalone run.*/- listReportSummaries = (params?: {- cursor?: string;- limit?: number;- q?: string;- }): Promise<VerifyReportSummaryPage> =>- lambdaClient.verify.listReportSummaries.query(params) as Promise<VerifyReportSummaryPage>;+ getRunAcceptanceRound = (verifyRunId: string): Promise<VerifyRunAcceptanceRound | null> =>+ lambdaClient.verify.getRunAcceptanceRound.query({ verifyRunId });deleteRun = (verifyRunId: string): Promise<unknown> =>lambdaClient.verify.deleteRun.mutate({ verifyRunId });