fix(web): stop offering the Start here workspace twice on Home (UF-052)

"Pick up where you left off" listed every recent workspace, including the
one the Start here card already offers. The list now leaves it out and
hides when nothing else is left.
This commit is contained in:
shumeiko.it
2026-10-27 12:54:54 +01:00
parent b3b61e14c9
commit ef99f04c5b
3 changed files with 41 additions and 2 deletions

View File

@@ -796,6 +796,10 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
// payload has no sub — derive an honest one from the workspace + recency).
const wsById = new Map(recentWorkspaces.map(w => [w.id, w]));
const startHereMove = buildStartHereMove(briefing, wsById);
// Start here already offers its workspace; the list below shows the others (UF-052).
const otherRecentWorkspaces = startHereMove
? recentWorkspaces.filter(w => w.id !== startHereMove.workspaceId)
: recentWorkspaces;
const subForAction = (a: SuggestedAction): string | undefined => {
const w = wsById.get(a.workspaceId);
if (!w) return undefined;
@@ -951,11 +955,11 @@ const HomeCockpit = ({ onContinue, onOpenWorkspaceDesktop, onCreateWorkspace, us
<DreamDiaryCard />
</RevealSection>
{recentWorkspaces.length > 0 && (
{otherRecentWorkspaces.length > 0 && (
<RevealSection>
<RecentWorkspacesPanel
onWorkspaceChanged={() => { void load(); }}
cards={recentWorkspaces}
cards={otherRecentWorkspaces}
onContinue={onContinue}
onOpenDesktop={onOpenWorkspaceDesktop}
/>

View File

@@ -157,6 +157,7 @@ describe('HomeCockpit (P2)', () => {
it('scopes recent workspace card transitions to explicit properties', async () => {
await renderHome(briefing({
recentWorkspaces: [
{ id: 'board', name: 'Board Update', group: 'Finance', summary: 'Variance narrative is half drafted.', lastActive: RAW_ISO, pendingCount: 5 },
{ id: 'launch', name: 'Launch Plan', group: 'Marketing', summary: 'Three decisions still need review.', lastActive: RAW_ISO, pendingCount: 3 },
],
}));
@@ -205,6 +206,30 @@ describe('HomeCockpit (P2)', () => {
fireEvent.click(screen.getByTestId('home-cockpit-start-primary'));
expect(onContinue).toHaveBeenCalledWith('launch', 'launch-session');
});
it('UF-052: does not offer the Start here workspace again in the recent list', async () => {
await renderHome(briefing({
recentWorkspaces: [
{ id: 'eng', name: 'Eng', group: 'Product', summary: 'Sprint notes.', lastActive: RAW_ISO, pendingCount: 0 },
{ id: 'quiet', name: 'Quiet Research', group: 'Research', summary: 'Archived notes.', lastActive: '2026-06-09T09:00:00.000Z', pendingCount: 0 },
],
}));
expect(screen.getByTestId('home-cockpit-start-here').textContent).toContain('Continue Eng');
expect(screen.queryByTestId('home-cockpit-ws-eng')).not.toBeInTheDocument();
expect(screen.getByTestId('home-cockpit-ws-quiet')).toBeInTheDocument();
});
it('UF-052: hides the recent list when Start here already covers the only workspace', async () => {
await renderHome(briefing({
recentWorkspaces: [
{ id: 'eng', name: 'Eng', group: 'Product', summary: 'Sprint notes.', lastActive: RAW_ISO, pendingCount: 0 },
],
}));
expect(screen.getByTestId('home-cockpit-start-here')).toBeInTheDocument();
expect(screen.queryByTestId('home-cockpit-recent')).not.toBeInTheDocument();
});
});
// ── Workspace Desktop: error-state branching (P1b error contract) ──────────