Skip to content

🤯 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.

✨ feat: polish acceptance review experience (#18843)

Arvin Xu4b9ed7659e1a
diff --git a/apps/cli/src/utils/rasterDimensions.test.ts b/apps/cli/src/utils/rasterDimensions.test.ts
new file mode 100644
index 00000000000..41a1888ce1a
--- /dev/null
+++ b/apps/cli/src/utils/rasterDimensions.test.ts
@@ -0,0 +1,18 @@
+import { describe, expect, it } from 'vitest';
+
+import { rasterDimensions } from './rasterDimensions';
+
+describe('rasterDimensions', () => {
+ it('reads PNG dimensions used to reserve Acceptance evidence height', () => {
+ const png = Buffer.alloc(24);
+ Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).copy(png);
+ png.writeUInt32BE(1920, 16);
+ png.writeUInt32BE(1080, 20);
+
+ expect(rasterDimensions(png)).toEqual({ height: 1080, width: 1920 });
+ });
+
+ it('ignores non-image content', () => {
+ expect(rasterDimensions(Buffer.from('acceptance report'))).toBeUndefined();
+ });
+});
diff --git a/apps/cli/src/utils/rasterDimensions.ts b/apps/cli/src/utils/rasterDimensions.ts
new file mode 100644
index 00000000000..b7f75990498
--- /dev/null
+++ b/apps/cli/src/utils/rasterDimensions.ts
@@ -0,0 +1,62 @@
+export interface RasterDimensions {
+ height: number;
+ width: number;
+}
+
+const valid = (width: number, height: number): RasterDimensions | undefined =>
+ width > 0 && height > 0 ? { height, width } : undefined;
+
+/** Read common raster dimensions without pulling a native image dependency into the CLI. */
+export const rasterDimensions = (buffer: Buffer): RasterDimensions | undefined => {
+ if (
+ buffer.length >= 24 &&
+ buffer.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
+ ) {
+ return valid(buffer.readUInt32BE(16), buffer.readUInt32BE(20));
+ }
+
+ if (buffer.length >= 10 && ['GIF87a', 'GIF89a'].includes(buffer.toString('ascii', 0, 6))) {
+ return valid(buffer.readUInt16LE(6), buffer.readUInt16LE(8));
+ }
+
+ if (
+ buffer.length >= 30 &&
+ buffer.toString('ascii', 0, 4) === 'RIFF' &&
+ buffer.toString('ascii', 8, 12) === 'WEBP'
+ ) {
+ const format = buffer.toString('ascii', 12, 16);
+ if (format === 'VP8X') return valid(buffer.readUIntLE(24, 3) + 1, buffer.readUIntLE(27, 3) + 1);
+ if (format === 'VP8L' && buffer[20] === 0x2f) {
+ const bits = buffer.readUInt32LE(21);
+ return valid((bits & 0x3fff) + 1, ((bits >> 14) & 0x3fff) + 1);
+ }
+ if (format === 'VP8 ' && buffer.subarray(23, 26).equals(Buffer.from([0x9d, 0x01, 0x2a])))
+ return valid(buffer.readUInt16LE(26) & 0x3fff, buffer.readUInt16LE(28) & 0x3fff);
+ }
+
+ if (buffer.length >= 4 && buffer[0] === 0xff && buffer[1] === 0xd8) {
+ let offset = 2;
+ while (offset + 8 < buffer.length) {
+ if (buffer[offset] !== 0xff) {
+ offset += 1;
+ continue;
+ }
+ const marker = buffer[offset + 1]!;
+ if (marker === 0xd8 || marker === 0xd9) {
+ offset += 2;
+ continue;
+ }
+ const length = buffer.readUInt16BE(offset + 2);
+ if (length < 2 || offset + length + 2 > buffer.length) return;
+ if (
+ (marker >= 0xc0 && marker <= 0xc3) ||
+ (marker >= 0xc5 && marker <= 0xc7) ||
+ (marker >= 0xc9 && marker <= 0xcb) ||
+ (marker >= 0xcd && marker <= 0xcf)
+ ) {
+ return valid(buffer.readUInt16BE(offset + 7), buffer.readUInt16BE(offset + 5));
+ }
+ offset += length + 2;
+ }
+ }
+};
diff --git a/apps/cli/src/utils/uploadLocalFile.test.ts b/apps/cli/src/utils/uploadLocalFile.test.ts
new file mode 100644
index 00000000000..b448d816643
--- /dev/null
+++ b/apps/cli/src/utils/uploadLocalFile.test.ts
@@ -0,0 +1,31 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { uploadFileBuffer } from './uploadLocalFile';
+
+describe('uploadFileBuffer', () => {
+ it('stores image dimensions in file metadata for stable evidence layout', async () => {
+ const png = Buffer.alloc(24);
+ Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).copy(png);
+ png.writeUInt32BE(1600, 16);
+ png.writeUInt32BE(900, 20);
+ const createFile = vi.fn().mockResolvedValue({ id: 'file-1' });
+ const client = {
+ file: {
+ checkFileHash: { mutate: vi.fn().mockResolvedValue({ isExist: true, url: 'files/x.png' }) },
+ createFile: { mutate: createFile },
+ },
+ } as unknown as Parameters<typeof uploadFileBuffer>[0];
+
+ await uploadFileBuffer(
+ client,
+ { buffer: png, fileName: 'evidence.png', fileType: 'image/png' },
+ {},
+ );
+
+ expect(createFile).toHaveBeenCalledWith(
+ expect.objectContaining({
+ metadata: expect.objectContaining({ height: 900, width: 1600 }),
+ }),
+ );
+ });
+});
diff --git a/apps/cli/src/utils/uploadLocalFile.ts b/apps/cli/src/utils/uploadLocalFile.ts
index 4789f46ffd8..5fbfa74a6af 100644
--- a/apps/cli/src/utils/uploadLocalFile.ts
+++ b/apps/cli/src/utils/uploadLocalFile.ts
@@ -5,6 +5,7 @@ import path from 'node:path';
import { resolveMimeType } from '@lobechat/utils/mimeType';
import type { TrpcClient } from '../api/client';
+import { rasterDimensions } from './rasterDimensions';
export interface UploadLocalFileOptions {
knowledgeBaseId?: string;
@@ -26,7 +27,7 @@ export interface UploadFileBufferInput {
*
* @returns the created file record (`{ id, url, ... }`)
*/
-const uploadFileBuffer = async (
+export const uploadFileBuffer = async (
client: TrpcClient,
{ buffer, fileName, fileType }: UploadFileBufferInput,
options: UploadLocalFileOptions = {},
@@ -36,6 +37,7 @@ const uploadFileBuffer = async (
const ext = path.extname(fileName).toLowerCase().slice(1);
const date = new Date().toLocaleDateString('en-CA'); // YYYY-MM-DD
+ const dimensions = fileType.startsWith('image/') ? rasterDimensions(buffer) : undefined;
// 1. Dedup: if the same bytes are already stored (and the object still
// exists), skip the S3 upload entirely and reuse the existing url.
@@ -73,6 +75,7 @@ const uploadFileBuffer = async (
dirname: '',
filename: fileName,
path: pathname,
+ ...dimensions,
},
name: fileName,
parentId: options.parentId,
diff --git a/apps/server/src/routers/lambda/acceptance.ts b/apps/server/src/routers/lambda/acceptance.ts
index cc261162a1f..0521a988a11 100644
--- a/apps/server/src/routers/lambda/acceptance.ts
+++ b/apps/server/src/routers/lambda/acceptance.ts
@@ -496,8 +496,16 @@ export const acceptanceRouter = router({
* cannot merge into.
*/
list: acceptanceProcedure
- .input(z.object({ limit: z.number().int().min(1).max(200) }).optional())
- .query(async ({ ctx, input }) => ctx.acceptanceService.listWithSubjects(input?.limit)),
+ .input(
+ z
+ .object({
+ filter: z.enum(['active', 'all', 'completed']).optional(),
+ limit: z.number().int().min(1).max(200).optional(),
+ q: z.string().max(200).optional(),
+ })
+ .optional(),
+ )
+ .query(async ({ ctx, input }) => ctx.acceptanceService.listWithSubjects(input)),
/**
* Fold one acceptance into another: the source's verification rounds (and
diff --git a/apps/server/src/services/verify/__tests__/acceptanceListSearch.test.ts b/apps/server/src/services/verify/__tests__/acceptanceListSearch.test.ts
new file mode 100644
index 00000000000..09fd6240761
--- /dev/null
+++ b/apps/server/src/services/verify/__tests__/acceptanceListSearch.test.ts
@@ -0,0 +1,79 @@
+// @vitest-environment node
+import { describe, expect, it, vi } from 'vitest';
+
+import { AcceptanceService } from '../acceptanceService';
+
+const mocks = vi.hoisted(() => ({
+ resolveDocuments: vi.fn(),
+ resolveTasks: vi.fn(),
+ resolveTopics: vi.fn(),
+}));
+
+vi.mock('@/database/models/document', () => ({
+ DocumentModel: class {
+ findByIds = mocks.resolveDocuments;
+ },
+}));
+vi.mock('@/database/models/task', () => ({
+ TaskModel: class {
+ resolveMany = mocks.resolveTasks;
+ },
+}));
+vi.mock('@/database/models/topic', () => ({
+ TopicModel: class {
+ findByIds = mocks.resolveTopics;
+ },
+}));
+
+describe('AcceptanceService.listWithSubjects', () => {
+ it('searches the complete owned set before applying the result limit', async () => {
+ const rows = [
+ {
+ createdAt: new Date(),
+ id: 'recent',
+ status: 'delivered',
+ subjectId: 'recent',
+ subjectType: 'task',
+ },
+ {
+ createdAt: new Date(0),
+ id: 'older',
+ status: 'delivered',
+ subjectId: 'older',
+ subjectType: 'topic',
+ },
+ ];
+ const query = vi.fn().mockResolvedValue(rows);
+ mocks.resolveTasks.mockResolvedValue([
+ { id: 'recent', identifier: 'T-1', name: 'Recent report' },
+ ]);
+ mocks.resolveTopics.mockResolvedValue([{ id: 'older', title: 'Needle report' }]);
+ mocks.resolveDocuments.mockResolvedValue([]);
+ const service = new AcceptanceService({} as any, 'user-1') as any;
+ service.acceptanceModel = { query };
+ service.latestCheckCounts = vi.fn().mockResolvedValue(new Map());
+ service.resolveProjects = vi.fn().mockResolvedValue(new Map());
+
+ const result = await service.listWithSubjects({ filter: 'active', limit: 1, q: 'needle' });
+
+ expect(query).toHaveBeenCalledWith({
+ limit: undefined,
+ statuses: [
+ 'pending',
+ 'planned',
+ 'verifying',
+ 'repairing',
+ 'delivered',
+ 'rejected',
+ 'errored',
+ ],
+ unbounded: true,
+ });
+ expect(mocks.resolveTasks).toHaveBeenCalledOnce();
+ expect(mocks.resolveTasks).toHaveBeenCalledWith(['recent']);
+ expect(mocks.resolveTopics).toHaveBeenCalledOnce();
+ expect(mocks.resolveTopics).toHaveBeenCalledWith(['older']);
+ expect(mocks.resolveDocuments).toHaveBeenCalledOnce();
+ expect(result.map(({ id }: { id: string }) => id)).toEqual(['older']);
+ });
+});
diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.ts
index a6a0068cad9..fe23066ca7f 100644
--- a/apps/server/src/services/verify/acceptanceService.ts
+++ b/apps/server/src/services/verify/acceptanceService.ts
@@ -981,6 +981,72 @@ export class AcceptanceService {
};
};
+ /** Resolve list subjects in one query per entity type, regardless of history size. */
+ private resolveSubjects = async (
+ acceptances: AcceptanceItem[],
+ ): Promise<Map<string, AcceptanceSubjectSummary>> => {
+ const result = new Map<string, AcceptanceSubjectSummary>();
+ const idsByType = new Map<AcceptanceSubjectType, string[]>();
+ for (const acceptance of acceptances) {
+ const type = acceptance.subjectType as AcceptanceSubjectType;
+ const ids = idsByType.get(type) ?? [];
+ ids.push(acceptance.subjectId);
+ idsByType.set(type, ids);
+ }
+
+ try {
+ const [tasks, topics, documents] = await Promise.all([
+ new TaskModel(this.db, this.userId, this.workspaceId).resolveMany(
+ idsByType.get('task') ?? [],
+ ),
+ new TopicModel(this.db, this.userId, this.workspaceId).findByIds(
+ idsByType.get('topic') ?? [],
+ ),
+ new DocumentModel(this.db, this.userId, this.workspaceId).findByIds(
+ idsByType.get('document') ?? [],
+ ),
+ ]);
+ const taskTitles = new Map<string, string | null>();
+ for (const task of tasks) {
+ const title = task.name ?? task.identifier;
+ taskTitles.set(task.id, title);
+ taskTitles.set(task.identifier, title);
+ }
+ const topicTitles = new Map(topics.map((topic) => [topic.id, topic.title ?? null]));
+ const documentTitles = new Map(
+ documents.map((document) => [document.id, document.title ?? null]),
+ );
+
+ for (const acceptance of acceptances) {
+ const type = acceptance.subjectType as AcceptanceSubjectType;
+ const override = acceptance.metadata?.title;
+ const overrideTitle =
+ typeof override === 'string' && override.trim() ? override.trim() : null;
+ const title =
+ overrideTitle ??
+ (type === 'task'
+ ? taskTitles.get(acceptance.subjectId)
+ : type === 'topic'
+ ? topicTitles.get(acceptance.subjectId)
+ : type === 'document'
+ ? documentTitles.get(acceptance.subjectId)
+ : null) ??
+ null;
+ result.set(acceptance.id, { id: acceptance.subjectId, title, type });
+ }
+ } catch (error) {
+ log('resolveSubjects failed (non-fatal): %O', error);
+ for (const acceptance of acceptances) {
+ result.set(acceptance.id, {
+ id: acceptance.subjectId,
+ title: typeof acceptance.metadata?.title === 'string' ? acceptance.metadata.title : null,
+ type: acceptance.subjectType as AcceptanceSubjectType,
+ });
+ }
+ }
+ return result;
+ };
+
/** Resolve the projects referenced directly by acceptances in one bounded read. */
private resolveProjects = async (
acceptances: AcceptanceItem[],
@@ -1042,24 +1108,58 @@ export class AcceptanceService {
/**
* Recent aggregates with their subject headers — the list-panel payload.
- * Titles resolve in parallel per row (bounded by the list limit); a deleted
+ * Titles resolve in batches by subject type; a deleted
* subject degrades to a null title instead of dropping the row. Each row also
* carries the latest round's check count for the panel's at-a-glance line.
*/
- listWithSubjects = async (limit = 50) => {
- const rows = await this.acceptanceModel.query(limit);
+ listWithSubjects = async (
+ options: {
+ filter?: 'active' | 'all' | 'completed';
+ limit?: number;
+ q?: string;
+ } = {},
+ ) => {
+ const { filter = 'all', limit = 50, q } = options;
+ const statuses: AcceptanceStatus[] | undefined =
+ filter === 'active'
+ ? ['pending', 'planned', 'verifying', 'repairing', 'delivered', 'rejected', 'errored']
+ : filter === 'completed'
+ ? ['accepted', 'closed']
+ : undefined;
+ const normalizedQuery = q?.trim().toLocaleLowerCase();
+
+ // A title search must span the complete owned set. Subject titles live in
+ // their source entities (task/topic/document), so resolve them before
+ // applying the result cap instead of searching only the latest page.
+ const candidates = await this.acceptanceModel.query({
+ limit: normalizedQuery ? undefined : limit,
+ statuses,
+ unbounded: Boolean(normalizedQuery),
+ });
+ const subjects = await this.resolveSubjects(candidates);
+ const withSubjects = candidates.map((row) => ({
+ row,
+ subject: subjects.get(row.id)!,
+ }));
+ const matched = normalizedQuery
+ ? withSubjects
+ .filter(({ row, subject }) =>
+ (subject.title || row.subjectId).toLocaleLowerCase().includes(normalizedQuery),
+ )
+ .slice(0, limit)
+ : withSubjects;
+ const rows = matched.map(({ row }) => row);
const [checkCounts, projects] = await Promise.all([
this.latestCheckCounts(rows.map((row) => row.id)),
this.resolveProjects(rows),
]);
- return Promise.all(
- rows.map(async (row) => ({
- ...row,
- checkCount: checkCounts.get(row.id) ?? null,
- project: projects.get(row.id) ?? null,
- subject: await this.resolveSubject(row),
- })),
- );
+
+ return matched.map(({ row, subject }) => ({
+ ...row,
+ checkCount: checkCounts.get(row.id) ?? null,
+ project: projects.get(row.id) ?? null,
+ subject,
+ }));
};
/**
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 416dd4ff4a4..102a616baa6 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -29,9 +29,6 @@
"acceptance.bar.progressDone": "All {{total}} checks confirmed — ready to accept",
"acceptance.bar.progressZero": "{{total}} checks awaiting your review",
"acceptance.bar.rejectComment": "Reject with comment",
- "acceptance.bar.rerun": "Fix",
- "acceptance.bar.rerunDrafted": "Drafted into your composer — review and send it.",
- "acceptance.bar.rerunSent": "Sent to the origin conversation — the repair round is starting.",
"acceptance.checkCreate.add": "Add checks",
"acceptance.checkCreate.addToScope": "Add to acceptance scope",
"acceptance.checkCreate.empty": "All checks in this rubric are already in scope.",
@@ -292,6 +289,23 @@
"acceptance.workspace.merge.success": "{{count}} checks merged",
"acceptance.workspace.merge.title": "Merge acceptance",
"acceptance.workspace.merge.windowHint": "Only the {{count}} most recent acceptances are listed here.",
+ "acceptance.workspace.onboarding.agent.description": "Copy this prompt to your coding agent and let it complete the setup.",
+ "acceptance.workspace.onboarding.agent.prompt": "Read https://lobehub.com/acceptance/skill.md and follow the instructions to install Acceptance.",
+ "acceptance.workspace.onboarding.agent.title": "Install with an Agent",
+ "acceptance.workspace.onboarding.description": "Add the Acceptance skill to your project, then start a review from your coding agent.",
+ "acceptance.workspace.onboarding.enable.description": "Run this from your project root.",
+ "acceptance.workspace.onboarding.enable.title": "Enable Acceptance",
+ "acceptance.workspace.onboarding.example.command": "/acceptance Review the current changes, focusing on the core flow, empty states, and error states",
+ "acceptance.workspace.onboarding.example.description": "After installation, send this example to your coding agent to create the first review.",
+ "acceptance.workspace.onboarding.example.title": "Try your first acceptance",
+ "acceptance.workspace.onboarding.install.description": "Install the CLI once on this device.",
+ "acceptance.workspace.onboarding.install.title": "Install the LobeHub CLI",
+ "acceptance.workspace.onboarding.installSection": "Install Acceptance",
+ "acceptance.workspace.onboarding.manual.description": "Run both commands yourself from the project root.",
+ "acceptance.workspace.onboarding.manual.title": "Install manually",
+ "acceptance.workspace.onboarding.run.description": "Enter this in your coding agent chat.",
+ "acceptance.workspace.onboarding.run.title": "Start an acceptance run",
+ "acceptance.workspace.onboarding.title": "Set up Acceptance",
"acceptance.workspace.project.add": "Add to project",
"acceptance.workspace.project.addSuccess": "Added to the project",
"acceptance.workspace.project.create": "New project with this delivery",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 3ac71b4e63d..78309ed65d8 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -29,9 +29,6 @@
"acceptance.bar.progressDone": "{{total}} 项验证项已全部确认,可以接受交付",
"acceptance.bar.progressZero": "共 {{total}} 项等待你的验收",
"acceptance.bar.rejectComment": "评论并打回",
- "acceptance.bar.rerun": "打回重跑",
- "acceptance.bar.rerunDrafted": "已填入对话框,检查后发送。",
- "acceptance.bar.rerunSent": "已发送到源会话,修复轮次启动中。",
"acceptance.checkCreate.add": "添加检查项",
"acceptance.checkCreate.addToScope": "加入验收范围",
"acceptance.checkCreate.empty": "这个 Rubric 中的检查项都已在验收范围内。",
@@ -292,6 +289,23 @@
"acceptance.workspace.merge.success": "已合并 {{count}} 项验收项",
"acceptance.workspace.merge.title": "合并验收",
"acceptance.workspace.merge.windowHint": "这里只列出最近 {{count}} 条验收。",
+ "acceptance.workspace.onboarding.agent.description": "复制这段提示词发送给编程 Agent,由它完成安装。",
+ "acceptance.workspace.onboarding.agent.prompt": "阅读 https://lobehub.com/acceptance/skill.md,并按照说明安装 Acceptance。",
+ "acceptance.workspace.onboarding.agent.title": "使用 Agent 安装",
+ "acceptance.workspace.onboarding.description": "将 Acceptance Skill 安装到项目中,再从编程 Agent 发起验收。",
+ "acceptance.workspace.onboarding.enable.description": "在项目根目录执行。",
+ "acceptance.workspace.onboarding.enable.title": "启用 Acceptance",
+ "acceptance.workspace.onboarding.example.command": "/acceptance 验收当前改动,重点检查核心流程、空状态和错误状态",
+ "acceptance.workspace.onboarding.example.description": "安装完成后,将这个示例发送给编程 Agent,创建第一次验收。",
+ "acceptance.workspace.onboarding.example.title": "试试第一次验收",
+ "acceptance.workspace.onboarding.install.description": "在当前设备安装一次即可。",
+ "acceptance.workspace.onboarding.install.title": "安装 LobeHub CLI",
+ "acceptance.workspace.onboarding.installSection": "安装 Acceptance",
+ "acceptance.workspace.onboarding.manual.description": "在项目根目录依次执行下面两条命令。",
+ "acceptance.workspace.onboarding.manual.title": "手动安装",
+ "acceptance.workspace.onboarding.run.description": "在编程 Agent 对话中输入。",
+ "acceptance.workspace.onboarding.run.title": "发起验收",
+ "acceptance.workspace.onboarding.title": "开始使用 Acceptance",
"acceptance.workspace.project.add": "添加到项目",
"acceptance.workspace.project.addSuccess": "已添加到项目",
"acceptance.workspace.project.create": "新建项目并添加",
diff --git a/packages/database/src/models/acceptance.ts b/packages/database/src/models/acceptance.ts
index 6f8c0b4d72d..28476cee2de 100644
--- a/packages/database/src/models/acceptance.ts
+++ b/packages/database/src/models/acceptance.ts
@@ -189,12 +189,19 @@ export class AcceptanceModel {
return (await this.findBySubject(subjectType, subjectId))!;
};
- /** Recent acceptances for the current user/workspace, newest first. */
- query = async (limit = 50) => {
+ /** Acceptances for the current user/workspace, newest first. */
+ query = async (
+ options: { limit?: number; statuses?: AcceptanceStatus[]; unbounded?: boolean } = {},
+ ) => {
+ const { statuses, unbounded } = options;
+ const limit = unbounded ? undefined : (options.limit ?? 50);
return this.db.query.acceptances.findMany({
limit,
orderBy: [desc(acceptances.createdAt)],
- where: this.ownership(),
+ where:
+ statuses && statuses.length > 0
+ ? and(this.ownership(), inArray(acceptances.status, statuses))
+ : this.ownership(),
});
};
diff --git a/packages/database/src/models/task.ts b/packages/database/src/models/task.ts
index 27b9c650a3c..292497191a4 100644
--- a/packages/database/src/models/task.ts
+++ b/packages/database/src/models/task.ts
@@ -307,6 +307,20 @@ export class TaskModel {
.where(and(inArray(tasks.id, ids), this.ownership()));
}
+ async resolveMany(idsOrIdentifiers: string[]): Promise<TaskItem[]> {
+ if (idsOrIdentifiers.length === 0) return [];
+ const identifiers = idsOrIdentifiers.map((value) => value.toUpperCase());
+ return this.db
+ .select()
+ .from(tasks)
+ .where(
+ and(
+ or(inArray(tasks.id, idsOrIdentifiers), inArray(tasks.identifier, identifiers)),
+ this.ownership(),
+ ),
+ );
+ }
+
// Resolve id or identifier (e.g. 'T-1') to a task
async resolve(idOrIdentifier: string): Promise<TaskItem | null> {
if (idOrIdentifier.startsWith('task_')) return this.findById(idOrIdentifier);
diff --git a/packages/database/src/models/topic.ts b/packages/database/src/models/topic.ts
index b0c3417a08d..d339688c697 100644
--- a/packages/database/src/models/topic.ts
+++ b/packages/database/src/models/topic.ts
@@ -645,6 +645,13 @@ export class TopicModel {
});
};
+ findByIds = async (ids: string[]): Promise<TopicItem[]> => {
+ if (ids.length === 0) return [];
+ return this.db.query.topics.findMany({
+ where: and(inArray(topics.id, ids), this.ownership()),
+ });
+ };
+
/**
* Minimal creator projection for router-level workspace row checks on
* batch-by-ids operations (batch delete / move).
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 0957f5e83f5..5df3ecbf401 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -38,9 +38,6 @@ export default {
'acceptance.bar.progressDone': 'All {{total}} checks confirmed — ready to accept',
'acceptance.bar.progressZero': '{{total}} checks awaiting your review',
'acceptance.bar.rejectComment': 'Reject with comment',
- 'acceptance.bar.rerun': 'Fix',
- 'acceptance.bar.rerunDrafted': 'Drafted into your composer — review and send it.',
- 'acceptance.bar.rerunSent': 'Sent to the origin conversation — the repair round is starting.',
'acceptance.checks.allAccepted.desc': 'Nice work — every acceptance check has been signed off.',
'acceptance.checks.allAccepted.title': 'All checks accepted 🎉',
'acceptance.checks.copied': 'Copied',
@@ -319,6 +316,29 @@ export default {
'acceptance.workspace.listEmpty':
'Ingest a verification report with the CLI and its acceptance will show up here.',
'acceptance.workspace.listEmptyTitle': 'No acceptances yet',
+ 'acceptance.workspace.onboarding.description':
+ 'Add the Acceptance skill to your project, then start a review from your coding agent.',
+ 'acceptance.workspace.onboarding.agent.description':
+ 'Copy this prompt to your coding agent and let it complete the setup.',
+ 'acceptance.workspace.onboarding.agent.prompt':
+ 'Read https://lobehub.com/acceptance/skill.md and follow the instructions to install Acceptance.',
+ 'acceptance.workspace.onboarding.agent.title': 'Install with an Agent',
+ 'acceptance.workspace.onboarding.enable.description': 'Run this from your project root.',
+ 'acceptance.workspace.onboarding.enable.title': 'Enable Acceptance',
+ 'acceptance.workspace.onboarding.install.description': 'Install the CLI once on this device.',
+ 'acceptance.workspace.onboarding.install.title': 'Install the LobeHub CLI',
+ 'acceptance.workspace.onboarding.installSection': 'Install Acceptance',
+ 'acceptance.workspace.onboarding.manual.description':
+ 'Run both commands yourself from the project root.',
+ 'acceptance.workspace.onboarding.manual.title': 'Install manually',
+ 'acceptance.workspace.onboarding.example.command':
+ '/acceptance Review the current changes, focusing on the core flow, empty states, and error states',
+ 'acceptance.workspace.onboarding.example.description':
+ 'After installation, send this example to your coding agent to create the first review.',
+ 'acceptance.workspace.onboarding.example.title': 'Try your first acceptance',
+ 'acceptance.workspace.onboarding.run.description': 'Enter this in your coding agent chat.',
+ 'acceptance.workspace.onboarding.run.title': 'Start an acceptance run',
+ 'acceptance.workspace.onboarding.title': 'Set up Acceptance',
'acceptance.workspace.project.add': 'Add to project',
'acceptance.workspace.project.addSuccess': 'Added to the project',
'acceptance.workspace.project.create': 'New project with this delivery',
diff --git a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx
index ef575d6f3b2..2695dedd680 100644
--- a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx
@@ -11,7 +11,7 @@ import { useSearchParams } from 'react-router';
import { useSingleton } from '@/hooks/useSingleton';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from './AcceptanceScope';
@@ -252,7 +252,7 @@ const AcceptanceCheckInventory = ({
predictionId: input.predictionId,
});
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
}
: undefined
}
@@ -265,14 +265,14 @@ const AcceptanceCheckInventory = ({
id: data.acceptance.id,
});
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
return true;
}}
onReview={async (input) => {
if (!canReview) return false;
await verifyService.reviewChecks({ id: data.acceptance.id, ...input });
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
return true;
}}
onToggleGroup={(key) =>
diff --git a/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx b/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx
index 3770a19e53d..b61227d8482 100644
--- a/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceCheckOwnerToolbar.tsx
@@ -6,7 +6,7 @@ import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from './AcceptanceScope';
@@ -35,7 +35,7 @@ const AcceptanceCheckOwnerToolbar = () => {
const saveStanding = async (checklist: typeof standing) => {
await verifyService.saveAcceptanceChecklist(data.subject.type, data.subject.id, checklist);
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
toast.success(t('acceptance.checkCreate.saved'));
};
diff --git a/src/features/Acceptance/Viewer/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/AcceptanceDecision.tsx
index d1aa96796e3..f688368614d 100644
--- a/src/features/Acceptance/Viewer/AcceptanceDecision.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceDecision.tsx
@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next';
import { useIsHydrated } from '@/hooks/useIsHydrated';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from './AcceptanceScope';
@@ -20,21 +20,16 @@ import { openAcceptModal, openGroupFeedbackModal, openRejectModal } from './moda
import { useAcceptanceBundle } from './useAcceptanceBundle';
import { formatAcceptanceCountsText, LIVE_ACCEPTANCE_STATUSES } from './verdict';
-interface AcceptanceDecisionProps {
- onDraftToComposer?: (text: string) => boolean;
-}
-
-const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {
+const AcceptanceDecision = () => {
const { t } = useTranslation('verify');
const hydrated = useIsHydrated();
- const { acceptanceId, embedded } = useAcceptanceScope();
+ const { acceptanceId } = useAcceptanceScope();
const { data, mutate } = useAcceptanceBundle(acceptanceId);
const [pending, setPending] = useState(false);
- const [rerunPending, setRerunPending] = useState(false);
const [feedbackOpen, setFeedbackOpen] = useState(false);
if (!data?.isOwner || data.acceptance.status === 'closed') return null;
- const { acceptance, checks, origin, rounds } = data;
+ const { acceptance, checks, rounds } = data;
const currentRound = rounds.at(-1);
const acceptedCount = checks.filter((check) => checkFilterState(check) === 'accepted').length;
const needsFixCount = checks.filter((check) => checkFilterState(check) === 'needsFix').length;
@@ -139,7 +134,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {
try {
await action();
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
return true;
} finally {
setPending(false);
@@ -152,14 +147,11 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {
<>
<DecisionBar
acceptedCount={acceptedCount}
- embedded={embedded}
feedbackCount={feedbackEntries.filter((entry) => !entry.stale).length}
ignoredCount={ignoredCount}
needsFixCount={needsFixCount}
pending={pending}
repairing={acceptance.status === 'repairing'}
- rerunAvailable={embedded || Boolean(origin?.topic)}
- rerunPending={rerunPending}
state={barState}
statusText={barTexts.statusText}
subText={barTexts.subText}
@@ -202,39 +194,6 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {
runAction(() => verifyService.rejectDelivery(acceptance.id, comment)),
})
}
- onRerun={async () => {
- if (embedded) {
- if (onDraftToComposer?.(repairPrompt)) {
- toast.success({
- placement: 'bottom',
- style: { marginBlockEnd: 88 },
- title: t('acceptance.bar.rerunDrafted'),
- });
- }
- return;
- }
- if (!origin?.topic) return;
- setRerunPending(true);
- try {
- await verifyService.dispatchAcceptanceRepair({
- agentId: origin.agent?.id,
- content: repairPrompt,
- topicId: origin.topic.id,
- });
- await verifyService.markAcceptanceRepairing(acceptance.id);
- await mutate();
- void globalMutate(verifyKeys.acceptances());
- toast.success({
- placement: 'bottom',
- style: { marginBlockEnd: 88 },
- title: t('acceptance.bar.rerunSent'),
- });
- } catch (cause) {
- toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));
- } finally {
- setRerunPending(false);
- }
- }}
/>
<Flexbox style={{ height: 8 }} />
<FeedbackDrawer
diff --git a/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx b/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx
index 187437ce872..d8252325b12 100644
--- a/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceFocusWorkspace.tsx
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
import { useNavigate, useParams } from 'react-router';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import AcceptanceFocusReview from './AcceptanceFocusReview';
@@ -45,7 +45,7 @@ const AcceptanceFocusWorkspace = () => {
const saveStanding = async (checklist: typeof standing) => {
await verifyService.saveAcceptanceChecklist(data.subject.type, data.subject.id, checklist);
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
toast.success(t('acceptance.checkCreate.saved'));
};
@@ -103,7 +103,7 @@ const AcceptanceFocusWorkspace = () => {
onReview={async (input) => {
await verifyService.reviewChecks({ id: data.acceptance.id, ...input });
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
return true;
}}
/>
diff --git a/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx b/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx
index 63d6945aeda..01203d855b2 100644
--- a/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceGoalEdit.tsx
@@ -5,7 +5,7 @@ import { PencilLine } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from './AcceptanceScope';
@@ -30,7 +30,7 @@ const AcceptanceGoalEdit = () => {
throw cause;
}
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
},
});
};
diff --git a/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx b/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx
index 04abe638c6d..e3da14699ea 100644
--- a/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceStatusControl.tsx
@@ -7,7 +7,7 @@ import { CircleCheck, RotateCcw, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { mutate as globalMutate } from '@/libs/swr';
-import { verifyKeys } from '@/libs/swr/keys';
+import { isAcceptanceListKey } from '@/libs/swr/keys';
import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from './AcceptanceScope';
@@ -25,7 +25,7 @@ const AcceptanceStatusControl = () => {
try {
await verifyService.updateAcceptanceStatus(data.acceptance.id, status);
await mutate();
- void globalMutate(verifyKeys.acceptances());
+ void globalMutate(isAcceptanceListKey);
toast.success(t('acceptance.workspace.statusSuccess'));
} catch {
toast.error(t('acceptance.workspace.statusError'));
diff --git a/src/features/Acceptance/Viewer/CheckList.test.ts b/src/features/Acceptance/Viewer/CheckList.test.ts
index b56d8cc182c..1c0abe9c698 100644
--- a/src/features/Acceptance/Viewer/CheckList.test.ts
+++ b/src/features/Acceptance/Viewer/CheckList.test.ts
@@ -15,8 +15,10 @@ import {
import {
canDismissRejectModal,
CHECK_REJECT_MODAL_SIZE,
+ checkRejectModalSize,
mergeRejectComments,
rejectModalTitle,
+ TEXT_REJECT_MODAL_WIDTH,
} from './CheckRejectModal';
const check = (id: string, category: string | null, surface: AcceptanceCheck['surface']) =>
@@ -144,6 +146,11 @@ describe('check reject modal presentation', () => {
expect(CHECK_REJECT_MODAL_SIZE).toEqual({ height: '98dvh', width: '98vw' });
});
+ it('keeps a text-only rejection compact', () => {
+ expect(checkRejectModalSize(0)).toEqual({ height: 'auto', width: TEXT_REJECT_MODAL_WIDTH });
+ expect(checkRejectModalSize(1)).toEqual(CHECK_REJECT_MODAL_SIZE);
+ });
+
it('shows the acceptance item description below its title', () => {
expect(
rejectModalTitle(
diff --git a/src/features/Acceptance/Viewer/CheckList.tsx b/src/features/Acceptance/Viewer/CheckList.tsx
index 9ff82cd564f..f633e1ef416 100644
--- a/src/features/Acceptance/Viewer/CheckList.tsx
+++ b/src/features/Acceptance/Viewer/CheckList.tsx
@@ -256,6 +256,9 @@ const styles = createStaticStyles(({ css }) => ({
groupCard: css`
background: ${cssVar.colorBgContainer};
`,
+ groupedCard: css`
+ padding-inline: 12px;
+ `,
groupHeader: css`
cursor: pointer;
padding-block: 10px;
@@ -1827,7 +1830,7 @@ const CheckList = memo<CheckListProps>(
}
return (
- <Flexbox className={styles.groupCard}>
+ <Flexbox className={cx(styles.groupCard, styles.groupedCard)}>
{groups.map(({ checks: groupChecks_, key, label, rows }, groupIndex) => {
const passed = groupChecks_.filter((check) => check.state === 'passed').length;
const collapsed = collapsedGroups.has(key);
diff --git a/src/features/Acceptance/Viewer/CheckRejectModal.tsx b/src/features/Acceptance/Viewer/CheckRejectModal.tsx
index 431e3efce64..21487091910 100644
--- a/src/features/Acceptance/Viewer/CheckRejectModal.tsx
+++ b/src/features/Acceptance/Viewer/CheckRejectModal.tsx
@@ -185,6 +185,12 @@ const readDraft = (key: string | undefined): RejectDraft | null => {
const ZOOM_STEPS = [0.5, 0.75, 1, 1.5, 2, 3, 4];
export const CHECK_REJECT_MODAL_SIZE = { height: '98dvh', width: '98vw' } as const;
+export const TEXT_REJECT_MODAL_WIDTH = 'min(560px, calc(100vw - 32px))';
+
+export const checkRejectModalSize = (evidenceCount: number) =>
+ evidenceCount > 0
+ ? CHECK_REJECT_MODAL_SIZE
+ : ({ height: 'auto', width: TEXT_REJECT_MODAL_WIDTH } as const);
export const rejectModalTitle = (title: string, description?: string) => ({
description: description?.trim() || undefined,
@@ -449,8 +455,8 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
return (
<div className={styles.modalBody}>
- <Flexbox flex={1} gap={12} padding={hasEvidence ? 16 : 20} style={{ minHeight: 0 }}>
- {activeEvidence ? (
+ {activeEvidence && (
+ <Flexbox flex={1} gap={12} padding={16} style={{ minHeight: 0 }}>
<Flexbox gap={12} height={'100%'} style={{ minHeight: 0 }}>
{thumbnails}
<div className={styles.fullscreenBody} style={{ position: 'relative' }}>
@@ -499,12 +505,8 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
</div>
</div>
</Flexbox>
- ) : (
- <Text fontSize={13} type={'secondary'}>
- {translate('acceptance.review.rejectDescription', { title: checkTitle })}
- </Text>
- )}
- </Flexbox>
+ </Flexbox>
+ )}
<div className={styles.modalFooter}>{footer}</div>
</div>
);
@@ -516,6 +518,7 @@ CheckRejectModalContent.displayName = 'AcceptanceCheckRejectModalContent';
/** Per-check reject modal — media gets a near-fullscreen annotation surface without losing context. */
export const openCheckRejectModal = (options: CheckRejectModalProps) => {
const modalTitle = rejectModalTitle(options.checkTitle, options.checkDescription);
+ const modalSize = checkRejectModalSize(options.evidence.length);
return createModal({
classNames: { popup: styles.modalPopup },
@@ -528,8 +531,8 @@ export const openCheckRejectModal = (options: CheckRejectModalProps) => {
popup: {
display: 'flex',
flexDirection: 'column',
- height: CHECK_REJECT_MODAL_SIZE.height,
- maxWidth: CHECK_REJECT_MODAL_SIZE.width,
+ height: modalSize.height,
+ maxWidth: modalSize.width,
},
},
title: (
@@ -542,6 +545,6 @@ export const openCheckRejectModal = (options: CheckRejectModalProps) => {
)}
</Flexbox>
),
- width: CHECK_REJECT_MODAL_SIZE.width,
+ width: modalSize.width,
});
};
diff --git a/src/features/Acceptance/Viewer/DecisionBar.test.ts b/src/features/Acceptance/Viewer/DecisionBar.test.ts
index 2eb76912c7d..9e3b1edea13 100644
--- a/src/features/Acceptance/Viewer/DecisionBar.test.ts
+++ b/src/features/Acceptance/Viewer/DecisionBar.test.ts
@@ -3,8 +3,7 @@ import { describe, expect, it } from 'vitest';
import verify from '../../../../packages/locales/src/default/verify';
describe('DecisionBar copy', () => {
- it('keeps the copy prompt action and uses Fix for rerunning the repair', () => {
+ it('uses the copy prompt as the repair handoff', () => {
expect(verify['acceptance.bar.copyReview']).toBe('Copy review prompt');
- expect(verify['acceptance.bar.rerun']).toBe('Fix');
});
});
diff --git a/src/features/Acceptance/Viewer/DecisionBar.tsx b/src/features/Acceptance/Viewer/DecisionBar.tsx
index 4cb11c7fee4..ece7ba6fe38 100644
--- a/src/features/Acceptance/Viewer/DecisionBar.tsx
+++ b/src/features/Acceptance/Viewer/DecisionBar.tsx
@@ -129,13 +129,6 @@ ProgressRing.displayName = 'AcceptanceProgressRing';
interface DecisionBarProps {
/** Checks the user has signed off, of `totalCount` reviewable ones. */
acceptedCount: number;
- /**
- * Rendered as the in-chat portal embed. The send-back there drafts the repair
- * prompt straight into the composer sitting beside it, which makes "copy the
- * review" a redundant second way to move the same text — drop it and leave
- * one send-back path.
- */
- embedded?: boolean;
/** Active (not-yet-consumed) feedback recorded this round. */
feedbackCount: number;
/** Checks removed from the acceptance scope by the reviewer. */
@@ -150,15 +143,10 @@ interface DecisionBarProps {
onOpenFeedback: () => void;
/** Open the aggregate reject dialog (comment required). */
onRejectComment: () => void;
- /** Dispatch the repair prompt straight into the origin agent conversation. */
- onRerun: () => void;
pending: boolean;
/** A live round that is a dispatched repair — coloured as an in-progress task
(warning), not a neutral verify, to match the system's task-process cue. */
repairing?: boolean;
- /** The origin conversation is known — the rerun dispatch has a target. */
- rerunAvailable: boolean;
- rerunPending: boolean;
state: BarState;
/** The state line, prepared by the page (status + counts wording). */
statusText: string;
@@ -170,14 +158,13 @@ interface DecisionBarProps {
* The floating decision strip (P-12): review progress, the feedback
* clearing-list opener, and the closing actions. What the actions are follows
* the review state — feedback queued for the next round turns the bar into a
- * repair dispatcher (copy the prompt / send it back to the origin agent);
+ * repair handoff (copy the review prompt);
* a clean review offers reject-with-comment and accept, with accept gaining
* primary weight only once every check is signed off.
*/
const DecisionBar = memo<DecisionBarProps>(
({
acceptedCount,
- embedded,
feedbackCount,
ignoredCount,
needsFixCount,
@@ -186,11 +173,8 @@ const DecisionBar = memo<DecisionBarProps>(
onCopyReview,
onOpenFeedback,
onRejectComment,
- onRerun,
pending,
repairing,
- rerunAvailable,
- rerunPending,
state,
statusText,
subText,
@@ -291,11 +275,14 @@ const DecisionBar = memo<DecisionBarProps>(
<div style={{ flex: 1, minWidth: 8 }} />
- {/* A dispatched send-back (repairing) keeps the copy entry alive —
- the reviewer may still hand the prompt to another agent. Embedded,
- the composer beside it already receives the draft. */}
- {state === 'live' && hasFeedback && !embedded && (
- <Button disabled={pending} style={{ flex: 'none' }} type={'fill'} onClick={onCopyReview}>
+ {/* Copy is the universal repair handoff across standalone and embedded views. */}
+ {state === 'live' && hasFeedback && (
+ <Button
+ disabled={pending}
+ style={{ flex: 'none' }}
+ type={'primary'}
+ onClick={onCopyReview}
+ >
{t('acceptance.bar.copyReview')}
</Button>
)}
@@ -305,16 +292,6 @@ const DecisionBar = memo<DecisionBarProps>(
// Feedback is queued — the delivery isn't being accepted now; the
// bar's job is getting the repair round started.
<>
- {!embedded && (
- <Button
- disabled={pending}
- style={{ flex: 'none' }}
- type={'fill'}
- onClick={onCopyReview}
- >
- {t('acceptance.bar.copyReview')}
- </Button>
- )}
{/* Last words before the repair leaves — a global note the next
round reads, for what the queued per-check feedback missed. */}
<Button
@@ -326,17 +303,14 @@ const DecisionBar = memo<DecisionBarProps>(
>
{t('acceptance.bar.addComment')}
</Button>
- {rerunAvailable && (
- <Button
- disabled={pending}
- loading={rerunPending}
- style={{ flex: 'none' }}
- type={'primary'}
- onClick={onRerun}
- >
- {t('acceptance.bar.rerun')}
- </Button>
- )}
+ <Button
+ disabled={pending}
+ style={{ flex: 'none' }}
+ type={'primary'}
+ onClick={onCopyReview}
+ >
+ {t('acceptance.bar.copyReview')}
+ </Button>
</>
) : (
// Clean review — accept carries primary weight only once every
diff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsx
index 2619209adae..fc96d3adf86 100644
--- a/src/features/Acceptance/Viewer/index.tsx
+++ b/src/features/Acceptance/Viewer/index.tsx
@@ -38,13 +38,9 @@ const styles = createStaticStyles(({ css }) => ({
interface AcceptancePageProps {
acceptanceId?: string;
- onDraftToComposer?: (text: string) => boolean;
}
-const AcceptancePage = ({
- acceptanceId: explicitAcceptanceId,
- onDraftToComposer,
-}: AcceptancePageProps) => {
+const AcceptancePage = ({ acceptanceId: explicitAcceptanceId }: AcceptancePageProps) => {
const params = useParams<{ acceptanceId: string; checkId: string }>();
const acceptanceId = explicitAcceptanceId ?? extractUuid(params.acceptanceId);
const embedded = Boolean(explicitAcceptanceId);
@@ -83,7 +79,7 @@ const AcceptancePage = ({
reportSlot={<AcceptanceViewReportLink />}
/>
<AcceptanceCheckInventory canReview toolbar={<AcceptanceCheckOwnerToolbar />} />
- <AcceptanceDecision onDraftToComposer={onDraftToComposer} />
+ <AcceptanceDecision />
</>
)}
</Flexbox>
diff --git a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
index ad630a70bd2..e6044665199 100644
--- a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
+++ b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx
@@ -13,6 +13,7 @@ import {
} from '@lobehub/ui';
import type { DropdownItem } from '@lobehub/ui/base-ui';
import { ActionIcon, DropdownMenu, Text } from '@lobehub/ui/base-ui';
+import { useDebounce } from 'ahooks';
import { createStaticStyles, cssVar } from 'antd-style';
import isEqual from 'fast-deep-equal';
import {
@@ -21,7 +22,6 @@ import {
FolderClosed,
ListFilter,
PanelLeftClose,
- ScrollText,
Search,
TriangleAlert,
} from 'lucide-react';
@@ -40,7 +40,6 @@ import { acceptanceHomePath } from '../Viewer/routes';
import {
type AcceptanceListFilter,
DEFAULT_ACCEPTANCE_LIST_FILTER,
- filterAcceptanceList,
normalizeAcceptanceListFilter,
} from './acceptanceListFilter';
import AcceptanceRow from './AcceptanceRow';
@@ -189,11 +188,10 @@ const styles = createStaticStyles(({ css }) => ({
`,
groupTitle: css`
display: inline-flex;
- gap: 6px;
+ gap: 8px;
align-items: center;
- font-size: 12px;
- font-weight: 500;
+ font-size: 14px;
color: ${cssVar.colorTextSecondary};
`,
emptyState: css`
@@ -244,10 +242,6 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
const navigate = useNavigate();
const { acceptanceId } = useParams<{ acceptanceId: string }>();
- const { data, error, isLoading, mutate } = useAcceptanceList(true);
-
- // Client-side filter: the list endpoint returns the caller's full recent set
- // (bounded, no pagination), so filtering the loaded rows IS filtering the set.
const [query, setQuery] = useState('');
const [storedFilter, setStoredFilter] = useLocalStorageState<AcceptanceListFilter>(
ACCEPTANCE_LIST_FILTER_STORAGE_KEY,
@@ -257,8 +251,13 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
// mount — the project a delivery was just filed into — must come in open.
const [collapsedGroups, setCollapsedGroups] = useState<string[]>([]);
const filter = normalizeAcceptanceListFilter(storedFilter);
- const filtered = filterAcceptanceList(data ?? [], filter, query);
- const groups = groupAcceptanceList(filtered);
+ const debouncedQuery = useDebounce(query.trim(), { wait: 300 });
+ const { data, error, isLoading, mutate } = useAcceptanceList(true, {
+ filter,
+ q: debouncedQuery || undefined,
+ });
+ const items = data ?? [];
+ const groups = groupAcceptanceList(items);
const showGroups = hasProjectAcceptanceGroups(groups);
const trimmedQuery = query.trim();
@@ -371,7 +370,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
</Center>
) : isLoading ? (
<SkeletonList rows={6} style={{ paddingBlock: 6, paddingInline: 8 }} />
- ) : filtered.length === 0 ? (
+ ) : items.length === 0 ? (
trimmedQuery || filter !== 'all' ? (
// A zero-result FILTER must read as "no match for this query",
// never as the first-run empty state.
@@ -398,7 +397,6 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
<Center className={styles.emptyState}>
<Empty
description={t('acceptance.workspace.listEmpty')}
- icon={ScrollText}
title={t('acceptance.workspace.listEmptyTitle')}
/>
</Center>
@@ -426,8 +424,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
<span className={styles.groupTitle}>
<Icon icon={FolderClosed} size={14} />
<span>
- {group.projectName ?? t('acceptance.workspace.groups.ungrouped')} ·{' '}
- {group.items.length}
+ {group.projectName ?? t('acceptance.workspace.groups.ungrouped')}
</span>
</span>
}
@@ -446,7 +443,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(
))}
</Accordion>
) : (
- filtered.map((item) => (
+ items.map((item) => (
<AcceptanceRow
active={item.id === acceptanceId}
item={item}
diff --git a/src/features/Acceptance/Workspace/AcceptanceOnboarding.tsx b/src/features/Acceptance/Workspace/AcceptanceOnboarding.tsx
new file mode 100644
index 00000000000..33ffd8b3310
--- /dev/null
+++ b/src/features/Acceptance/Workspace/AcceptanceOnboarding.tsx
@@ -0,0 +1,264 @@
+'use client';
+
+import { CopyButton, Flexbox, Icon } from '@lobehub/ui';
+import { Button, TabsIndicator, TabsList, TabsRoot, TabsTab } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { ArrowLeft, Bot, ClipboardCheck, Terminal } from 'lucide-react';
+import { memo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router';
+
+import CommandLine from '@/components/CommandLine';
+import { CLI_INSTALL_COMMAND } from '@/features/Apps/const';
+
+import { acceptanceHomePath } from '../Viewer/routes';
+
+const styles = createStaticStyles(({ css }) => ({
+ description: css`
+ max-width: 520px;
+
+ font-size: 14px;
+ line-height: 1.6;
+ color: ${cssVar.colorTextSecondary};
+ text-align: start;
+ `,
+ container: css`
+ overflow: auto;
+
+ width: 100%;
+ height: 100%;
+ border: 1px solid ${cssVar.colorBorder};
+ border-radius: ${cssVar.borderRadius};
+
+ background: ${cssVar.colorBgContainer};
+ `,
+ content: css`
+ width: 100%;
+ max-width: 960px;
+ margin: auto;
+ padding-block: 12px 16px;
+ padding-inline: 24px;
+
+ @media (width <= 680px) {
+ padding-block: 8px 16px;
+ padding-inline: 16px;
+ }
+ `,
+ icon: css`
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+
+ width: 40px;
+ height: 40px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorBgContainer};
+ `,
+ method: css`
+ min-width: 0;
+ padding: 16px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+ `,
+ methodDescription: css`
+ font-size: 13px;
+ line-height: 1.55;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ methodIcon: css`
+ color: ${cssVar.colorTextTertiary};
+ `,
+ methodTitle: css`
+ font-size: 15px;
+ font-weight: 600;
+ color: ${cssVar.colorText};
+ `,
+ step: css`
+ display: grid;
+ grid-template-columns: 24px minmax(0, 1fr);
+ gap: 10px;
+
+ min-width: 0;
+ padding: 12px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+ `,
+ stepIndex: css`
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+
+ font-size: 12px;
+ font-weight: 500;
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorFillSecondary};
+ `,
+ steps: css`
+ display: grid;
+ grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 0.9fr);
+ gap: 10px;
+
+ @media (width <= 680px) {
+ grid-template-columns: 1fr;
+ }
+ `,
+ tab: css`
+ flex: 1;
+ justify-content: center;
+ `,
+ tabList: css`
+ width: 100%;
+ `,
+ tabs: css`
+ width: 100%;
+ `,
+ page: css`
+ width: 100%;
+ min-width: 0;
+ height: 100dvh;
+ padding: 8px;
+
+ background: ${cssVar.colorBgLayout};
+ `,
+ prompt: css`
+ flex: 1;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 13px;
+ line-height: 1.65;
+ color: ${cssVar.colorText};
+ overflow-wrap: anywhere;
+ `,
+ promptBox: css`
+ padding: 12px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+ background: ${cssVar.colorFillQuaternary};
+ `,
+ sectionTitle: css`
+ font-size: 14px;
+ font-weight: 600;
+ color: ${cssVar.colorText};
+ `,
+ title: css`
+ font-size: 22px;
+ font-weight: 600;
+ line-height: 1.25;
+ color: ${cssVar.colorText};
+ text-align: start;
+ letter-spacing: -0.02em;
+ `,
+}));
+
+const AcceptanceOnboarding = memo(() => {
+ const { t } = useTranslation('verify');
+ const navigate = useNavigate();
+ const [mode, setMode] = useState<'agent' | 'manual'>('agent');
+
+ return (
+ <Flexbox className={styles.page}>
+ <Flexbox className={styles.container}>
+ <Flexbox horizontal align={'center'} padding={16}>
+ <Button icon={ArrowLeft} type={'text'} onClick={() => navigate(acceptanceHomePath())}>
+ {t('back', { ns: 'common' })}
+ </Button>
+ </Flexbox>
+ <Flexbox className={styles.content} gap={16}>
+ <Flexbox horizontal align={'center'} gap={12}>
+ <span className={styles.icon}>
+ <Icon icon={ClipboardCheck} size={20} />
+ </span>
+ <Flexbox gap={4}>
+ <span className={styles.title}>{t('acceptance.workspace.onboarding.title')}</span>
+ <span className={styles.description}>
+ {t('acceptance.workspace.onboarding.description')}
+ </span>
+ </Flexbox>
+ </Flexbox>
+
+ <Flexbox gap={12}>
+ <span className={styles.sectionTitle}>
+ {t('acceptance.workspace.onboarding.installSection')}
+ </span>
+ <TabsRoot
+ className={styles.tabs}
+ value={mode}
+ onValueChange={(key) => setMode(key as 'agent' | 'manual')}
+ >
+ <TabsList className={styles.tabList}>
+ <TabsIndicator />
+ <TabsTab className={styles.tab} value={'agent'}>
+ <Icon icon={Bot} size={16} />
+ {t('acceptance.workspace.onboarding.agent.title')}
+ </TabsTab>
+ <TabsTab className={styles.tab} value={'manual'}>
+ <Icon icon={Terminal} size={16} />
+ {t('acceptance.workspace.onboarding.manual.title')}
+ </TabsTab>
+ </TabsList>
+ </TabsRoot>
+
+ {mode === 'agent' ? (
+ <Flexbox className={styles.method} gap={12}>
+ <span className={styles.methodDescription}>
+ {t('acceptance.workspace.onboarding.agent.description')}
+ </span>
+ <Flexbox horizontal align={'flex-start'} className={styles.promptBox} gap={8}>
+ <span className={styles.prompt}>
+ {t('acceptance.workspace.onboarding.agent.prompt')}
+ </span>
+ <CopyButton
+ content={t('acceptance.workspace.onboarding.agent.prompt')}
+ size={'small'}
+ />
+ </Flexbox>
+ </Flexbox>
+ ) : (
+ <div className={styles.steps}>
+ {[
+ {
+ command: CLI_INSTALL_COMMAND,
+ description: t('acceptance.workspace.onboarding.install.description'),
+ title: t('acceptance.workspace.onboarding.install.title'),
+ },
+ {
+ command: 'lh acceptance install',
+ description: t('acceptance.workspace.onboarding.enable.description'),
+ title: t('acceptance.workspace.onboarding.enable.title'),
+ },
+ {
+ command: '/acceptance',
+ description: t('acceptance.workspace.onboarding.run.description'),
+ title: t('acceptance.workspace.onboarding.run.title'),
+ },
+ ].map((step, index) => (
+ <div className={styles.step} key={step.title}>
+ <span className={styles.stepIndex}>{index + 1}</span>
+ <Flexbox gap={6}>
+ <span className={styles.methodTitle}>{step.title}</span>
+ <span className={styles.methodDescription}>{step.description}</span>
+ <CommandLine command={step.command} />
+ </Flexbox>
+ </div>
+ ))}
+ </div>
+ )}
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+AcceptanceOnboarding.displayName = 'AcceptanceOnboarding';
+
+export default AcceptanceOnboarding;
diff --git a/src/features/Acceptance/Workspace/AcceptanceRow.tsx b/src/features/Acceptance/Workspace/AcceptanceRow.tsx
index 2c1ff0fcab7..d6853c3b2f4 100644
--- a/src/features/Acceptance/Workspace/AcceptanceRow.tsx
+++ b/src/features/Acceptance/Workspace/AcceptanceRow.tsx
@@ -1,7 +1,7 @@
'use client';
import type { AcceptanceStatus } from '@lobechat/types';
-import { Flexbox, Icon } from '@lobehub/ui';
+import { Icon } from '@lobehub/ui';
import type { DropdownItem } from '@lobehub/ui/base-ui';
import { ActionIcon, confirmModal, DropdownMenu, toast } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
@@ -40,12 +40,9 @@ const styles = createStaticStyles(({ css }) => ({
padding-block: 4px;
padding-inline: 4px;
`,
- itemSub: css`
- display: flex;
- gap: 8px;
-
- margin-block-start: 2px;
-
+ itemTime: css`
+ flex: none;
+ padding-inline-start: 8px;
font-size: 12px;
color: ${cssVar.colorTextTertiary};
`,
@@ -375,15 +372,8 @@ const AcceptanceRow = memo<{
/>
</DropdownMenu>
}
- description={
- <Flexbox horizontal className={styles.itemSub} gap={8}>
- <span>
- {item.checkCount != null
- ? t('acceptance.workspace.checkCount', { count: item.checkCount })
- : t(`acceptance.status.${item.status}` as any)}
- </span>
- <span>{relativeTime(item.updatedAt ?? item.createdAt)}</span>
- </Flexbox>
+ extra={
+ <span className={styles.itemTime}>{relativeTime(item.updatedAt ?? item.createdAt)}</span>
}
icon={
<Icon
diff --git a/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts b/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts
index f462441d00d..e241c28671f 100644
--- a/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts
+++ b/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts
@@ -1,50 +1,6 @@
import { describe, expect, it } from 'vitest';
-import type { AcceptanceListItem } from '@/services/verify';
-
-import { filterAcceptanceList, normalizeAcceptanceListFilter } from './acceptanceListFilter';
-
-const item = (
- id: string,
- status: AcceptanceListItem['status'],
- title: string,
-): AcceptanceListItem =>
- ({
- id,
- status,
- subject: { title },
- subjectId: id,
- }) as AcceptanceListItem;
-
-const acceptances = [
- item('active', 'delivered', 'Needs review'),
- item('completed', 'accepted', 'Signed off'),
- item('closed', 'closed', 'No longer needed'),
- item('failed', 'rejected', 'Needs repair'),
-];
-
-describe('filterAcceptanceList', () => {
- it('hides completed acceptances by default', () => {
- expect(filterAcceptanceList(acceptances, 'active', '').map(({ id }) => id)).toEqual([
- 'active',
- 'failed',
- ]);
- });
-
- it('can show only completed acceptances', () => {
- expect(filterAcceptanceList(acceptances, 'completed', '').map(({ id }) => id)).toEqual([
- 'completed',
- 'closed',
- ]);
- });
-
- it('combines status filtering with title search', () => {
- expect(filterAcceptanceList(acceptances, 'all', 'signed').map(({ id }) => id)).toEqual([
- 'completed',
- ]);
- expect(filterAcceptanceList(acceptances, 'active', 'signed')).toEqual([]);
- });
-});
+import { normalizeAcceptanceListFilter } from './acceptanceListFilter';
describe('normalizeAcceptanceListFilter', () => {
it('falls back to the active filter for malformed persisted values', () => {
diff --git a/src/features/Acceptance/Workspace/acceptanceListFilter.ts b/src/features/Acceptance/Workspace/acceptanceListFilter.ts
index a0266561c08..d9ab360db10 100644
--- a/src/features/Acceptance/Workspace/acceptanceListFilter.ts
+++ b/src/features/Acceptance/Workspace/acceptanceListFilter.ts
@@ -1,30 +1,6 @@
-import type { AcceptanceStatus } from '@lobechat/types';
-
-import type { AcceptanceListItem } from '@/services/verify';
-
export type AcceptanceListFilter = 'active' | 'all' | 'completed';
export const DEFAULT_ACCEPTANCE_LIST_FILTER: AcceptanceListFilter = 'active';
export const normalizeAcceptanceListFilter = (value: unknown): AcceptanceListFilter =>
value === 'all' || value === 'completed' ? value : DEFAULT_ACCEPTANCE_LIST_FILTER;
-
-export const filterAcceptanceList = (
- items: AcceptanceListItem[],
- filter: AcceptanceListFilter,
- query: string,
-) => {
- const normalizedQuery = query.trim().toLowerCase();
-
- return items.filter((item) => {
- const status = item.status as AcceptanceStatus;
- const completed = status === 'accepted' || status === 'closed';
- if (filter === 'active' && completed) return false;
- if (filter === 'completed' && !completed) return false;
-
- return (
- !normalizedQuery ||
- (item.subject.title || item.subjectId).toLowerCase().includes(normalizedQuery)
- );
- });
-};
diff --git a/src/features/Acceptance/Workspace/index.test.ts b/src/features/Acceptance/Workspace/index.test.ts
new file mode 100644
index 00000000000..b048bbaae92
--- /dev/null
+++ b/src/features/Acceptance/Workspace/index.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from 'vitest';
+
+import { shouldShowAcceptanceOnboarding } from './index';
+
+describe('shouldShowAcceptanceOnboarding', () => {
+ it('uses the full-page onboarding only after the complete list resolves empty', () => {
+ expect(shouldShowAcceptanceOnboarding({ data: [], enabled: true, isLoading: false })).toBe(
+ true,
+ );
+ expect(shouldShowAcceptanceOnboarding({ data: [{}], enabled: true, isLoading: false })).toBe(
+ false,
+ );
+ expect(shouldShowAcceptanceOnboarding({ data: [], enabled: true, isLoading: true })).toBe(
+ false,
+ );
+ expect(
+ shouldShowAcceptanceOnboarding({
+ data: [],
+ enabled: true,
+ error: new Error('network'),
+ isLoading: false,
+ }),
+ ).toBe(false);
+ expect(shouldShowAcceptanceOnboarding({ data: [], enabled: false, isLoading: false })).toBe(
+ false,
+ );
+ });
+});
diff --git a/src/features/Acceptance/Workspace/index.tsx b/src/features/Acceptance/Workspace/index.tsx
index f0f4099b92a..e3330b8e3dc 100644
--- a/src/features/Acceptance/Workspace/index.tsx
+++ b/src/features/Acceptance/Workspace/index.tsx
@@ -9,7 +9,9 @@ import { Outlet, useParams, useSearchParams } from 'react-router';
import { RouteMetaBridge } from '@/features/RouteMeta';
+import { useAcceptanceList } from '../hooks';
import AcceptanceListPanel from './AcceptanceListPanel';
+import AcceptanceOnboarding from './AcceptanceOnboarding';
import AcceptanceProjectActions from './AcceptanceProjectActions';
import { useReportPanelExpand } from './useReportPanelExpand';
@@ -56,6 +58,20 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
+interface AcceptanceOnboardingState {
+ data?: unknown[];
+ enabled: boolean;
+ error?: unknown;
+ isLoading: boolean;
+}
+
+export const shouldShowAcceptanceOnboarding = ({
+ data,
+ enabled,
+ error,
+ isLoading,
+}: AcceptanceOnboardingState) => enabled && !isLoading && !error && data?.length === 0;
+
const AcceptanceWorkspace = memo(() => {
const { t } = useTranslation('verify');
const panel = useReportPanelExpand();
@@ -63,6 +79,28 @@ const AcceptanceWorkspace = memo(() => {
const [searchParams] = useSearchParams();
const hasFocusedCheck = Boolean(checkId || searchParams.get('check'));
const showList = !hasFocusedCheck;
+ const {
+ data: allAcceptances,
+ error,
+ isLoading,
+ } = useAcceptanceList(showList, {
+ filter: 'all',
+ });
+ const isFirstUse = shouldShowAcceptanceOnboarding({
+ data: allAcceptances,
+ enabled: showList,
+ error,
+ isLoading,
+ });
+
+ if (isFirstUse) {
+ return (
+ <>
+ <RouteMetaBridge />
+ <AcceptanceOnboarding />
+ </>
+ );
+ }
return (
<Flexbox horizontal height={'100dvh'} style={{ overflow: 'hidden' }} width={'100%'}>
diff --git a/src/features/Acceptance/hooks.ts b/src/features/Acceptance/hooks.ts
index 226db8ffacf..b8a8de41419 100644
--- a/src/features/Acceptance/hooks.ts
+++ b/src/features/Acceptance/hooks.ts
@@ -85,18 +85,27 @@ export const useAcceptanceBySubject = (
* panel. `limit` widens the recency window for surfaces that must reach further
* back than the panel does (the merge target picker).
*
- * A widened window is its own SWR key, and the list's invalidations
- * (`mutate(verifyKeys.acceptances())`) target the panel's key — so a surface
- * that opens on demand asks for `revalidateOnMount` rather than deciding from a
- * cache nothing refreshes.
+ * A widened window is its own SWR key. Mutations invalidate the whole
+ * `verify:acceptances` key family so every filter / limit / search variant
+ * revalidates together.
*/
export const useAcceptanceList = (
enabled: boolean,
- options?: { limit?: number; revalidateOnMount?: boolean },
+ options?: {
+ filter?: 'active' | 'all' | 'completed';
+ limit?: number;
+ q?: string;
+ revalidateOnMount?: boolean;
+ },
) =>
useClientDataSWR(
- enabled ? verifyKeys.acceptances(options?.limit) : null,
- () => verifyService.listAcceptances({ limit: options?.limit }),
+ enabled ? verifyKeys.acceptances(options?.limit, options?.q, options?.filter) : null,
+ () =>
+ verifyService.listAcceptances({
+ filter: options?.filter,
+ limit: options?.limit,
+ q: options?.q,
+ }),
{
...VERIFY_REPORT_SWR_CONFIG,
...(options?.revalidateOnMount ? { revalidateOnMount: true } : {}),
diff --git a/src/features/Portal/Acceptance/Body.test.tsx b/src/features/Portal/Acceptance/Body.test.tsx
index 572e8ef1682..880dbb2cb0a 100644
--- a/src/features/Portal/Acceptance/Body.test.tsx
+++ b/src/features/Portal/Acceptance/Body.test.tsx
@@ -1,12 +1,10 @@
import { render } from '@testing-library/react';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
-
-import { draftToMainComposer, useComposerDraftBus } from '@/features/Conversation/composerDraftBus';
+import { describe, expect, it, vi } from 'vitest';
import Body from './Body';
const mocks = vi.hoisted(() => ({
- captured: { onDraftToComposer: undefined as undefined | ((text: string) => boolean) },
+ acceptanceId: undefined as string | undefined,
}));
vi.mock('@/store/chat', () => ({
@@ -30,11 +28,8 @@ vi.mock('@/features/Conversation/store', () => ({
}));
vi.mock('@/features/Acceptance', () => ({
- AcceptanceViewer: (props: {
- initialCheckId?: string;
- onDraftToComposer?: (text: string) => boolean;
- }) => {
- mocks.captured.onDraftToComposer = props.onDraftToComposer;
+ AcceptanceViewer: (props: { acceptanceId?: string }) => {
+ mocks.acceptanceId = props.acceptanceId;
return null;
},
OriginConversationProvider: ({ children }: { children?: React.ReactNode }) => children,
@@ -42,33 +37,9 @@ vi.mock('@/features/Acceptance', () => ({
vi.mock('@/features/Acceptance/Viewer/TopicPanel', () => ({ default: () => null }));
-describe('Portal Acceptance Body — draftToComposer via the global bus', () => {
- beforeEach(() => {
- useComposerDraftBus.setState({ attached: false, draft: null });
- });
-
+describe('Portal Acceptance Body', () => {
it('renders outside ConversationProvider without touching the context store', () => {
expect(() => render(<Body />)).not.toThrow();
- // The poster is the plain bus function — no context-store closure involved.
- expect(mocks.captured.onDraftToComposer).toBe(draftToMainComposer);
- });
-
- it('posts the draft to the bus when a receiver is attached', () => {
- useComposerDraftBus.setState({ attached: true });
- render(<Body />);
-
- const ok = mocks.captured.onDraftToComposer?.('please fix X');
-
- expect(ok).toBe(true);
- expect(useComposerDraftBus.getState().draft).toEqual({ text: 'please fix X' });
- });
-
- it('reports failure (so the caller skips its toast) when no composer is listening', () => {
- render(<Body />);
-
- const ok = mocks.captured.onDraftToComposer?.('please fix X');
-
- expect(ok).toBe(false);
- expect(useComposerDraftBus.getState().draft).toBeNull();
+ expect(mocks.acceptanceId).toBe('acc-1');
});
});
diff --git a/src/features/Portal/Acceptance/Body.tsx b/src/features/Portal/Acceptance/Body.tsx
index 8ca20b1506d..1555dead7bc 100644
--- a/src/features/Portal/Acceptance/Body.tsx
+++ b/src/features/Portal/Acceptance/Body.tsx
@@ -2,21 +2,15 @@ import { memo } from 'react';
import { AcceptanceViewer, OriginConversationProvider } from '@/features/Acceptance';
import TopicPanel from '@/features/Acceptance/Viewer/TopicPanel';
-import { draftToMainComposer } from '@/features/Conversation/composerDraftBus';
import { useChatStore } from '@/store/chat';
import { chatPortalSelectors } from '@/store/chat/selectors';
const Body = memo(() => {
const acceptanceId = useChatStore(chatPortalSelectors.acceptancePortalId);
- // The portal pane is a layout SIBLING of the conversation column, not a
- // descendant of its ConversationProvider — reading useConversationStore here
- // throws ("no zustand provider as an ancestor") and blanks the page. Drafts
- // go through the global composerDraftBus; ComposerDraftReceiver applies them
- // inside the provider (setDocument + inputMessage sync + focus).
return (
<OriginConversationProvider TopicPanel={TopicPanel}>
- <AcceptanceViewer acceptanceId={acceptanceId} onDraftToComposer={draftToMainComposer} />
+ <AcceptanceViewer acceptanceId={acceptanceId} />
</OriginConversationProvider>
);
});
diff --git a/src/libs/swr/keys.test.ts b/src/libs/swr/keys.test.ts
index 1b69030e130..704062145d7 100644
--- a/src/libs/swr/keys.test.ts
+++ b/src/libs/swr/keys.test.ts
@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest';
import {
agentBuilderKeys,
documentCommentKeys,
+ isAcceptanceListKey,
isDocumentCommentKeyForEvent,
recentKeys,
resourceKeys,
@@ -62,6 +63,16 @@ describe('recentKeys', () => {
});
});
+describe('isAcceptanceListKey', () => {
+ it('matches every Acceptance list variant without matching detail keys', () => {
+ expect(isAcceptanceListKey(['verify:acceptances', '', '', 'active'])).toBe(true);
+ expect(isAcceptanceListKey(['verify:acceptances', '100', 'needle', 'all', 'workspace-1'])).toBe(
+ true,
+ );
+ expect(isAcceptanceListKey(['verify:acceptanceBundle', 'acceptance-1'])).toBe(false);
+ });
+});
+
describe('workKeys', () => {
it('keeps the Resources Private and Workspace galleries in separate cache entries', () => {
expect(workKeys.workspace('workspace-1', 'all', null, 'private')).not.toEqual(
diff --git a/src/libs/swr/keys.ts b/src/libs/swr/keys.ts
index 3935597f01b..15c2b317964 100644
--- a/src/libs/swr/keys.ts
+++ b/src/libs/swr/keys.ts
@@ -1028,10 +1028,12 @@ export const verifyKeys = {
[...subjectIds].sort().join(','),
],
),
- /** `limit` is part of the key: the merge picker asks for a wider window than the panel. */
- acceptances: def('verify:acceptances', (limit?: number) => [
+ /** Query inputs are part of the key so server-side list filtering never reuses stale rows. */
+ acceptances: def('verify:acceptances', (limit?: number, q?: string, filter?: string) => [
'verify:acceptances',
String(limit ?? ''),
+ q ?? '',
+ filter ?? '',
]),
criteria: def('verify:criteria', () => ['verify:criteria']),
instruction: def('verify:instruction', (documentId: string) => [
@@ -1062,6 +1064,10 @@ export const verifyKeys = {
tracing: def('verify:tracing', (tracingId: string) => ['verify:tracing', tracingId]),
};
+/** Match every parameterized Acceptance list key (filter / limit / search variants). */
+export const isAcceptanceListKey = (key: unknown): boolean =>
+ Array.isArray(key) && key[0] === verifyKeys.acceptances.root;
+
// ---- inbox / notifications ----------------------------------------------
export const inboxKeys = {
navigationCounts: def('inbox:navigationCounts', (workspaceId: string | null) => [
diff --git a/src/services/verify.ts b/src/services/verify.ts
index 511b45a949f..8027f63b9e5 100644
--- a/src/services/verify.ts
+++ b/src/services/verify.ts
@@ -168,12 +168,14 @@ export class VerifyService {
) => lambdaClient.acceptance.saveGoal.mutate({ requirement, subjectId, subjectType });
listAcceptances = (options?: {
+ filter?: 'active' | 'all' | 'completed';
/** Widen the recency window (server-capped) — the merge picker asks for more. */
limit?: number;
+ q?: string;
quiet?: boolean;
}): Promise<AcceptanceListItem[]> =>
lambdaClient.acceptance.list.query(
- options?.limit ? { limit: options.limit } : undefined,
+ options ? { filter: options.filter, limit: options.limit, q: options.q } : undefined,
options?.quiet ? { context: { showNotification: false } } : undefined,
);