🤯 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
✨ feat(acceptance): add shared-viewer notice on the acceptance page (#19042)
Arvin Xuc485ef71cbcc
diff --git a/.agents/acceptance/common-mistakes.md b/.agents/acceptance/common-mistakes.mdindex 5acab78a77a..086ff716551 100644--- a/.agents/acceptance/common-mistakes.md+++ b/.agents/acceptance/common-mistakes.md@@ -955,6 +955,16 @@ Fetching the module through the Next origin does not reveal it either — unknowpaths fall through to the SPA HTML shell, so a `grep` for your symbol "fails" against`<!DOCTYPE html>` and reads as a stale bundle.+**Same failure, quality-gate shape.** The silent cwd reset also sends `bun run check`+and `bunx vitest run` to the MAIN checkout, where the same relative test paths exist in+their pre-change form — the run prints `lint clean · tests N passed` against files your+edits never touched, and a regression test you just added "passes" without ever+executing. The tell is the count: fewer tests reported than the file now declares —+though the number alone cannot be trusted either way, since `it.each` expands one+declaration into many executed cases. Before trusting any gate result in a worktree+session, `pwd` (or prefix the command with an explicit `cd <worktree> &&`) and+confirm the NAME of the test you just added appears in the runner's output.+**Correct approach:** invoke the script by absolute path from the worktree, and beforecapturing any evidence prove the SPA's identity rather than the server's liveness:resolve the Vite pid from its port and read its cwddiff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.mdindex b02e83c2b05..439835a2c71 100644--- a/.agents/acceptance/probe-mock-patterns.md+++ b/.agents/acceptance/probe-mock-patterns.md@@ -433,6 +433,50 @@ renders. Seed the history and the ledger, but never assert on the live window'spercentage — read it back from `agent_quota_snapshots` and report what the runactually rendered.+#### Shared-viewer (non-owner) evidence needs a second signed-in user — signed-out hits /signin++**Situation:** capturing how a page renders for someone who is NOT the owner of the+object (a shared acceptance link, a workspace-member view), on the local full stack.++**Doesn't work:** a fresh storage-empty agent-browser session. The SPA's `/acceptance`+(and the rest of the main layout) sits behind the client auth gate, so a signed-out+context redirects to `/signin` before the route mounts — `location.pathname` lands on+`/signin` and every "the notice never renders" reading is an artifact of the gate, not+the change under test.++**Works:** seed a second user directly (mirror what `seed-user` writes: a `users` row+with `onboarding` finished + an `accounts` row with a bcryptjs password hash), then+sign that user in from INSIDE the visitor session so the cookies land in it:++```js+await fetch('/api/auth/sign-in/email', {+ body: JSON.stringify({ email, password }),+ credentials: 'include',+ headers: { 'Content-Type': 'application/json' },+ method: 'POST',+});+```++Reload and assert identity with `app-probe.sh auth` before capturing. Use a+run-specific session name, never `lobehub-dev` (that one is the owner).++#### Ambient `LOBEHUB_TOPIC_ID` hijacks a local CLI ingest — strip it for fixture creation++**Situation:** creating a fixture acceptance on the LOCAL dev server with+`bun src/index.ts acceptance run ingest` while running inside a LobeHub conversation+(Claude Code sessions launched from a Topic export `LOBEHUB_TOPIC_ID` /+`LOBEHUB_AGENT_ID` / `LOBEHUB_OPERATION_ID`).++**Doesn't work:** plain ingest. The CLI auto-attaches to the ambient conversation, and+that topic id belongs to PRODUCTION — the local server answers+`topic "tpc_…" not found in the current workspace`, which reads like broken fixture+data rather than an env leak.++**Works:** strip the ambient ids only for the local fixture ingest+(`env -u LOBEHUB_TOPIC_ID -u LOBEHUB_AGENT_ID -u LOBEHUB_OPERATION_ID …`) so it lands+standalone. Keep them for the final PRODUCTION publish of the verification round —+there the auto-attach to the current conversation is exactly what you want.+### Driving the UI#### The composer's slash menu needs real key events — `keyboard type` never opens itdiff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex b4f2684f8c9..fbccd685043 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -202,6 +202,10 @@"acceptance.roundStatus.repairing": "Repairing","acceptance.roundStatus.uncertain": "Verify uncertain","acceptance.roundStatus.verifying": "In progress",+ "acceptance.sharedNotice.readOnlyDescription": "You can browse every check and its evidence, but only the author can act on this acceptance.",+ "acceptance.sharedNotice.reviewableDescription": "You can browse every check and its evidence, and review them on behalf of your workspace.",+ "acceptance.sharedNotice.title": "Shared with you",+ "acceptance.sharedNotice.titleWithName": "Shared by {{name}}","acceptance.stats.failed": "{{count}} failed","acceptance.stats.notExecuted": "{{count}} not executed","acceptance.stats.passed": "{{count}} passed",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex 5b57ac81833..ab3f6e53a19 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -202,6 +202,10 @@"acceptance.roundStatus.repairing": "修复中","acceptance.roundStatus.uncertain": "验证不确定","acceptance.roundStatus.verifying": "进行中",+ "acceptance.sharedNotice.readOnlyDescription": "你可以查看所有检查项及其证据,但只有作者可以进行验收操作。",+ "acceptance.sharedNotice.reviewableDescription": "你可以查看所有检查项及其证据,并代表你的工作区参与评审。",+ "acceptance.sharedNotice.title": "来自他人的分享",+ "acceptance.sharedNotice.titleWithName": "来自 {{name}} 的分享","acceptance.stats.failed": "{{count}} 失败","acceptance.stats.notExecuted": "{{count}} 未执行","acceptance.stats.passed": "{{count}} 通过",diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex c685c90b944..5135c93f0b9 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -234,6 +234,12 @@ export default {'acceptance.roundStatus.repairing': 'Repairing','acceptance.roundStatus.uncertain': 'Verify uncertain','acceptance.roundStatus.verifying': 'In progress',+ 'acceptance.sharedNotice.readOnlyDescription':+ 'You can browse every check and its evidence, but only the author can act on this acceptance.',+ 'acceptance.sharedNotice.reviewableDescription':+ 'You can browse every check and its evidence, and review them on behalf of your workspace.',+ 'acceptance.sharedNotice.title': 'Shared with you',+ 'acceptance.sharedNotice.titleWithName': 'Shared by {{name}}','acceptance.stats.failed': '{{count}} failed','acceptance.stats.notExecuted': '{{count}} not executed','acceptance.stats.passed': '{{count}} passed',diff --git a/src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsx b/src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsxnew file mode 100644index 00000000000..bbafad87e88--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceSharedNotice.tsx@@ -0,0 +1,50 @@+'use client';++import { Alert } from '@lobehub/ui/base-ui';+import { cssVar } from 'antd-style';+import { UsersRound } from 'lucide-react';+import type { CSSProperties } from 'react';+import { useTranslation } from 'react-i18next';++import { useAuthorInfo } from '@/business/client/hooks/useAuthorInfo';++import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceBundle } from './useAcceptanceBundle';+import { canReviewAcceptance } from './visibility';++/**+ * In-body notice for viewers who reached this acceptance through someone+ * else's shared link or workspace membership: names the author when the+ * business layer can resolve them, and states whether the viewer may review+ * or is read-only — so a page missing its owner controls never looks broken.+ */+const AcceptanceSharedNotice = ({ style }: { style?: CSSProperties }) => {+ const { t } = useTranslation('verify');+ const { acceptanceId } = useAcceptanceScope();+ const { data } = useAcceptanceBundle(acceptanceId);+ const author = useAuthorInfo(data?.acceptance.userId ?? undefined);++ if (!data || data.isOwner) return null;++ return (+ <Alert+ showIcon+ icon={UsersRound}+ style={{ borderRadius: cssVar.borderRadiusLG, ...style }}+ type={'secondary'}+ variant={'outlined'}+ description={t(+ canReviewAcceptance(data)+ ? 'acceptance.sharedNotice.reviewableDescription'+ : 'acceptance.sharedNotice.readOnlyDescription',+ )}+ title={+ author?.fullName+ ? t('acceptance.sharedNotice.titleWithName', { name: author.fullName })+ : t('acceptance.sharedNotice.title')+ }+ />+ );+};++export default AcceptanceSharedNotice;diff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsxindex 28a030f25e4..272c6d23aca 100644--- a/src/features/Acceptance/Viewer/index.tsx+++ b/src/features/Acceptance/Viewer/index.tsx@@ -16,6 +16,7 @@ import AcceptanceIdentity from './AcceptanceIdentity';import AcceptanceLedgerRail from './AcceptanceLedgerRail';import AcceptanceOriginTopic from './AcceptanceOriginTopic';import { AcceptanceBundleGate, AcceptanceScope } from './AcceptanceScope';+import AcceptanceSharedNotice from './AcceptanceSharedNotice';import AcceptanceStatusControl from './AcceptanceStatusControl';import AcceptanceViewReportLink from './AcceptanceViewReportLink';import { acceptanceScrollLayout } from './layout';@@ -70,9 +71,19 @@ const AcceptancePage = ({}}>{focused ? (- <AcceptanceFocusWorkspace />+ <>+ {/* The focused branch zeroes the frame padding, so the+ notice carries its own margins. A shared viewer needs+ the capability explanation here MOST — this is where+ the owner-only review controls are visibly absent. */}+ <AcceptanceSharedNotice+ style={{ marginBlockStart: 16, marginInline: 20, width: 'auto' }}+ />+ <AcceptanceFocusWorkspace />+ </>) : (<>+ <AcceptanceSharedNotice /><AcceptanceIdentitystatusSlot={<AcceptanceStatusControl />}topicSlot={<AcceptanceOriginTopic />}diff --git a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsxindex a296cb849cd..4a30e49b3ba 100644--- a/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx+++ b/src/features/Acceptance/Workspace/AcceptanceListPanel.tsx@@ -27,6 +27,7 @@ import isEqual from 'fast-deep-equal';import {ArrowLeft,Check,+ CircleDashed,FolderClosed,Group,ListChecks,@@ -54,6 +55,7 @@ import { acceptanceHomePath } from '../Viewer/routes';import type { AcceptanceStatusAction } from '../Viewer/statusActions';import AcceptanceBatchBar from './AcceptanceBatchBar';import {+ acceptanceListEmptyVariant,type AcceptanceListFilter,DEFAULT_ACCEPTANCE_LIST_FILTER,normalizeAcceptanceListFilter,@@ -321,6 +323,18 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(const isLoading = searching ? search.isLoading : isLoadingInitial;const mutate = searching ? search.mutate : pagedRest.mutate;+ // Deduped against the workspace shell's own `filter: 'all'` read, so this+ // probe costs no extra request — it only answers whether a zero-result+ // filter is hiding anything at all (see acceptanceListEmptyVariant).+ const allProbe = useAcceptanceList(!error && !isLoading && items.length === 0, {+ filter: 'all',+ });+ const emptyVariant = acceptanceListEmptyVariant({+ allListEmpty: allProbe.data ? allProbe.data.length === 0 : undefined,+ filter,+ searching: Boolean(trimmedQuery),+ });+const groups = groupAcceptanceList(items, groupMode);const showGroups = shouldRenderAcceptanceGroups(groupMode, groups);@@ -681,7 +695,7 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>() : isLoading ? (<SkeletonList rows={6} style={{ paddingBlock: 6, paddingInline: 8 }} />) : items.length === 0 ? (- trimmedQuery || filter !== 'all' ? (+ emptyVariant === 'filtered' ? (// A zero-result FILTER must read as "no match for this query",// never as the first-run empty state.<div className={styles.searchEmpty}>@@ -705,8 +719,12 @@ const AcceptanceListPanel = memo<AcceptanceListPanelProps>(</div>) : (<Center className={styles.emptyState}>+ {/* The dashed circle is the acceptance "awaiting" glyph+ (AcceptanceStatusPill) — the domain's own mark, not the+ generic inbox. */}<Emptydescription={t('acceptance.workspace.listEmpty')}+ icon={CircleDashed}title={t('acceptance.workspace.listEmptyTitle')}/></Center>diff --git a/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts b/src/features/Acceptance/Workspace/acceptanceListFilter.test.tsindex e241c28671f..1abb985edd3 100644--- a/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts+++ b/src/features/Acceptance/Workspace/acceptanceListFilter.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { normalizeAcceptanceListFilter } from './acceptanceListFilter';+import { acceptanceListEmptyVariant, normalizeAcceptanceListFilter } from './acceptanceListFilter';describe('normalizeAcceptanceListFilter', () => {it('falls back to the active filter for malformed persisted values', () => {@@ -8,3 +8,30 @@ describe('normalizeAcceptanceListFilter', () => {expect(normalizeAcceptanceListFilter(null)).toBe('active');});});++describe('acceptanceListEmptyVariant', () => {+ it('shows the first-run empty state when the user owns nothing, even under the active filter', () => {+ expect(+ acceptanceListEmptyVariant({ allListEmpty: true, filter: 'active', searching: false }),+ ).toBe('firstRun');+ expect(+ acceptanceListEmptyVariant({ allListEmpty: true, filter: 'active', searching: true }),+ ).toBe('firstRun');+ });++ it('keeps the filtered escape hatch when other acceptances exist or the probe has not resolved', () => {+ expect(+ acceptanceListEmptyVariant({ allListEmpty: false, filter: 'active', searching: false }),+ ).toBe('filtered');+ expect(acceptanceListEmptyVariant({ filter: 'active', searching: false })).toBe('filtered');+ expect(+ acceptanceListEmptyVariant({ allListEmpty: false, filter: 'all', searching: true }),+ ).toBe('filtered');+ });++ it('reads an unfiltered zero-result browse as first run', () => {+ expect(+ acceptanceListEmptyVariant({ allListEmpty: false, filter: 'all', searching: false }),+ ).toBe('firstRun');+ });+});diff --git a/src/features/Acceptance/Workspace/acceptanceListFilter.ts b/src/features/Acceptance/Workspace/acceptanceListFilter.tsindex d9ab360db10..155a4606b3c 100644--- a/src/features/Acceptance/Workspace/acceptanceListFilter.ts+++ b/src/features/Acceptance/Workspace/acceptanceListFilter.ts@@ -4,3 +4,27 @@ export const DEFAULT_ACCEPTANCE_LIST_FILTER: AcceptanceListFilter = 'active';export const normalizeAcceptanceListFilter = (value: unknown): AcceptanceListFilter =>value === 'all' || value === 'completed' ? value : DEFAULT_ACCEPTANCE_LIST_FILTER;++/**+ * Which empty state a zero-result list should render.+ *+ * `filtered` — "no match for this query/filter" plus a show-all escape hatch.+ * `firstRun` — the plain "no acceptances yet" state.+ *+ * A user who owns NOTHING must always read `firstRun`: the default filter is+ * `active`, so their very first visit (e.g. following a shared link) would+ * otherwise show "no active acceptances · show all" — an escape hatch whose+ * click reveals the same nothing. `allListEmpty` stays undefined while the+ * unfiltered probe has not resolved; treat that as "not confirmed empty" so+ * the state never flickers from filtered to firstRun and back.+ */+export const acceptanceListEmptyVariant = ({+ allListEmpty,+ filter,+ searching,+}: {+ allListEmpty?: boolean;+ filter: AcceptanceListFilter;+ searching: boolean;+}): 'filtered' | 'firstRun' =>+ (searching || filter !== 'all') && !allListEmpty ? 'filtered' : 'firstRun';diff --git a/src/features/Acceptance/Workspace/index.test.ts b/src/features/Acceptance/Workspace/index.test.tsindex b048bbaae92..612cd79342f 100644--- a/src/features/Acceptance/Workspace/index.test.ts+++ b/src/features/Acceptance/Workspace/index.test.ts@@ -25,4 +25,15 @@ describe('shouldShowAcceptanceOnboarding', () => {false,);});++ it('never swallows a deep-linked acceptance behind the onboarding, even with an empty own list', () => {+ expect(+ shouldShowAcceptanceOnboarding({+ data: [],+ enabled: true,+ hasDeepLink: true,+ isLoading: false,+ }),+ ).toBe(false);+ });});diff --git a/src/features/Acceptance/Workspace/index.tsx b/src/features/Acceptance/Workspace/index.tsxindex e3330b8e3dc..409b9c91cae 100644--- a/src/features/Acceptance/Workspace/index.tsx+++ b/src/features/Acceptance/Workspace/index.tsx@@ -62,6 +62,12 @@ interface AcceptanceOnboardingState {data?: unknown[];enabled: boolean;error?: unknown;+ /**+ * A deep-linked `:acceptanceId` must render even when the viewer's own list+ * is empty — a shared link is often the very first acceptance a user opens,+ * and the install onboarding would swallow it entirely.+ */+ hasDeepLink?: boolean;isLoading: boolean;}@@ -69,13 +75,15 @@ export const shouldShowAcceptanceOnboarding = ({data,enabled,error,+ hasDeepLink,isLoading,-}: AcceptanceOnboardingState) => enabled && !isLoading && !error && data?.length === 0;+}: AcceptanceOnboardingState) =>+ enabled && !hasDeepLink && !isLoading && !error && data?.length === 0;const AcceptanceWorkspace = memo(() => {const { t } = useTranslation('verify');const panel = useReportPanelExpand();- const { checkId } = useParams<{ checkId: string }>();+ const { acceptanceId, checkId } = useParams<{ acceptanceId: string; checkId: string }>();const [searchParams] = useSearchParams();const hasFocusedCheck = Boolean(checkId || searchParams.get('check'));const showList = !hasFocusedCheck;@@ -90,6 +98,7 @@ const AcceptanceWorkspace = memo(() => {data: allAcceptances,enabled: showList,error,+ hasDeepLink: Boolean(acceptanceId),isLoading,});