diff --git a/.changeset/factory-card-draft-panel.md b/.changeset/factory-card-draft-panel.md new file mode 100644 index 00000000000..e881d184b80 --- /dev/null +++ b/.changeset/factory-card-draft-panel.md @@ -0,0 +1,5 @@ +--- +'mastra': patch +--- + +Opening a Factory card that has no session yet now shows the session panel, as the card's sessions do. Before you send the first message, it lists the card's source, its pull request, its description, the pull requests it links to and the stages it has moved through. The page also drops its **New session** title, matching a card's session page. diff --git a/mastracode/factory-ui/src/ui/domains/factory/components/CardOverview.tsx b/mastracode/factory-ui/src/ui/domains/factory/components/CardOverview.tsx new file mode 100644 index 00000000000..d94335e6aa3 --- /dev/null +++ b/mastracode/factory-ui/src/ui/domains/factory/components/CardOverview.tsx @@ -0,0 +1,114 @@ +import { useClock } from '@mastra/playground-ui/hooks/use-clock'; + +import type { InstalledBoardInfo } from '../../../../api/types'; +import { useFactoryQuery } from '../../../../hooks/useFactories'; +import type { WorkspaceSlot } from '../../workspace-viewer/context/WorkspacePanelContext'; +import type { LinkedRepositoryPayload } from '../../workspaces/services/github'; +import { boardOf } from '../boardFlow'; +import { cardProjectRepositoryId } from '../boardRepository'; +import { changeRequestsNoun } from '../changeRequestState'; +import { ownChangeRequest, sessionChangeRequests } from '../sessionChangeRequests'; +import type { PullRequestSubscription } from '../services/githubSubscriptions'; +import { relatedWorkItemIndex } from '../services/relationships'; +import { genericExternalWorkItemUrl } from '../services/workItemPresentation'; +import type { WorkItem } from '../services/workItems'; +import { toMinute } from '../stageStays'; +import { CardDescription } from './CardDescription'; +import { CardSourceRow } from './CardSourceRow'; +import { ChangeRequestLink } from './ChangeRequestLink'; +import { ChangeRequestList } from './ChangeRequestList'; +import { MovesGraph } from './MovesGraph'; +import { RelatedCards } from './RelatedCards'; +import { SectionLoadError } from './SectionLoadError'; + +export const overviewSectionClass = 'flex flex-col gap-3 p-1.5 pb-3'; + +export function CardOverview({ + item, + sessionItems, + factoryId, + boards, + boardsFailed, + repository, + repositoryFailed, + subscriptions, + pullRequestsFailed, + workspace, +}: { + item: WorkItem; + sessionItems: readonly WorkItem[]; + factoryId: string; + boards: readonly InstalledBoardInfo[] | undefined; + boardsFailed: boolean; + repository: LinkedRepositoryPayload | undefined; + repositoryFailed: boolean; + subscriptions: readonly PullRequestSubscription[]; + pullRequestsFailed: boolean; + workspace?: WorkspaceSlot; +}) { + const factoryQuery = useFactoryQuery(factoryId); + const now = useClock(toMinute); + const provider = repository?.provider ?? 'github'; + const related = relatedWorkItemIndex(sessionItems)(item); + const ownRequest = ownChangeRequest(item, repository?.slug, subscriptions); + const ownRequestLink = ownRequest ? ( + + ) : undefined; + const sourceUrl = genericExternalWorkItemUrl(item); + const requests = sessionChangeRequests({ + item, + subscriptions, + provider, + shownElsewhere: [sourceUrl, ownRequest?.url], + }); + const requestsNoun = changeRequestsNoun(repository ? [provider] : requests.map(request => request.provider)); + const moved = item.stageHistory.some(entry => entry.exitedAt); + const showsPhases = related.length > 0 || moved; + + return ( + <> +
+ {workspace ? null : ownRequestLink} + + +
+ {workspace?.({ + repository: repository && { slug: repository.slug, provider }, + changeRequest: ownRequestLink, + })} + {pullRequestsFailed || requests.length > 0 || showsPhases ? ( +
+ + {pullRequestsFailed ? ( + + {requests.length > 0 + ? `Couldn't load the session's ${requestsNoun}, so this list may be out of date.` + : `Couldn't load ${requestsNoun}.`} + + ) : null} + + {boardsFailed && showsPhases ? ( + Couldn't load the board, so phases aren't shown. + ) : moved ? ( + + ) : null} +
+ ) : null} + + ); +} diff --git a/mastracode/factory-ui/src/ui/domains/factory/components/SessionPanelOverview.tsx b/mastracode/factory-ui/src/ui/domains/factory/components/SessionPanelOverview.tsx index cbd635e2e91..cab72d5fe92 100644 --- a/mastracode/factory-ui/src/ui/domains/factory/components/SessionPanelOverview.tsx +++ b/mastracode/factory-ui/src/ui/domains/factory/components/SessionPanelOverview.tsx @@ -1,37 +1,21 @@ -import { useClock } from '@mastra/playground-ui/hooks/use-clock'; -import type { ReactNode } from 'react'; import { useParams } from 'react-router'; import { SkeletonRows } from '../../../ui/SkeletonRows'; -import { useFactoryQuery } from '../../../../hooks/useFactories'; -import type { WorkspaceSectionSlots } from '../../workspace-viewer/context/WorkspacePanelContext'; -import { cardProjectRepositoryId } from '../boardRepository'; +import type { WorkspaceSlot } from '../../workspace-viewer/context/WorkspacePanelContext'; import { changeRequestsHeading, changeRequestsNoun } from '../changeRequestState'; import { useSessionCard } from '../hooks/useSessionCard'; import { useSessionSubscriptions } from '../hooks/useSessionSubscriptions'; -import { ownChangeRequest, sessionChangeRequests } from '../sessionChangeRequests'; -import { relatedWorkItemIndex } from '../services/relationships'; -import { genericExternalWorkItemUrl } from '../services/workItemPresentation'; -import { toMinute } from '../stageStays'; -import { CardDescription } from './CardDescription'; -import { CardSourceRow } from './CardSourceRow'; -import { ChangeRequestLink } from './ChangeRequestLink'; +import { sessionChangeRequests } from '../sessionChangeRequests'; +import { CardOverview, overviewSectionClass } from './CardOverview'; import { ChangeRequestList } from './ChangeRequestList'; -import { MovesGraph } from './MovesGraph'; -import { RelatedCards } from './RelatedCards'; import { SectionLoadError } from './SectionLoadError'; -const sectionClass = 'flex flex-col gap-3 p-1.5 pb-3'; - // Must render inside `ChatSessionBoundary`: the subscriptions follow the chat session. -export function SessionPanelOverview({ workspace }: { workspace: (slots?: WorkspaceSectionSlots) => ReactNode }) { +export function SessionPanelOverview({ workspace }: { workspace: WorkspaceSlot | undefined }) { const { factoryId } = useParams<{ factoryId: string }>(); const { session, links } = useSessionSubscriptions(); const { repository, provider } = session; - const workspaceRepository = repository && { slug: repository.slug, provider }; - const factoryQuery = useFactoryQuery(factoryId); const card = useSessionCard(); - const now = useClock(toMinute); const pullRequestsFailed = session.failed || links.failed; // All at once: a section arriving late would push down the ones under it. @@ -45,13 +29,13 @@ export function SessionPanelOverview({ workspace }: { workspace: (slots?: Worksp return ( <> {card.failed ? ( -
+
Couldn't load the card.
) : null} - {workspace({ repository: workspaceRepository })} + {workspace?.({ repository: repository && { slug: repository.slug, provider } })} {pullRequestsFailed || requests.length > 0 ? ( -
+
{pullRequestsFailed ? ( {`Couldn't load ${changeRequestsNoun(providers)}.`} ) : ( @@ -63,65 +47,18 @@ export function SessionPanelOverview({ workspace }: { workspace: (slots?: Worksp ); } - const item = card.item; - const related = relatedWorkItemIndex(card.sessionItems)(item); - const ownRequest = ownChangeRequest(item, repository?.slug, links.subscriptions); - const sourceUrl = genericExternalWorkItemUrl(item); - const requests = sessionChangeRequests({ - item, - subscriptions: links.subscriptions, - provider, - shownElsewhere: [sourceUrl, ownRequest?.url], - }); - const requestsNoun = changeRequestsNoun(repository ? [provider] : requests.map(request => request.provider)); - const moved = item.stageHistory.some(entry => entry.exitedAt); - const showsPhases = related.length > 0 || moved; - return ( - <> -
- - -
- {workspace({ - repository: workspaceRepository, - changeRequest: ownRequest ? ( - - ) : undefined, - })} - {pullRequestsFailed || requests.length > 0 || showsPhases ? ( -
- - {pullRequestsFailed ? ( - - {requests.length > 0 - ? `Couldn't load the session's ${requestsNoun}, so this list may be out of date.` - : `Couldn't load ${requestsNoun}.`} - - ) : null} - - {card.boardsFailed && showsPhases ? ( - Couldn't load the board, so phases aren't shown. - ) : moved ? ( - - ) : null} -
- ) : null} - + ); } diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/PanelFrame.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/PanelFrame.tsx new file mode 100644 index 00000000000..ee456db02f5 --- /dev/null +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/PanelFrame.tsx @@ -0,0 +1,10 @@ +import type { ReactNode } from 'react'; + +export function PanelFrame({ subject, children }: { subject: ReactNode; children: ReactNode }) { + return ( +
+
{subject}
+ {children} +
+ ); +} diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesContent.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesContent.tsx index a3fb9cd5d71..65e69e6f46b 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesContent.tsx +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesContent.tsx @@ -3,7 +3,9 @@ import { useParams } from 'react-router'; import { useRouteSessionId } from '../../../../hooks/useRouteSessionId'; import { workspacePanelKey } from '../context/WorkspacePanelContext'; import { useWorkspacePanel } from '../context/useWorkspacePanel'; +import { overviewClass } from '../layout'; import type { WorkspacePanelSize } from '../layout'; +import { PanelFrame } from './PanelFrame'; import { WorkspaceViewerPanel } from './WorkspaceViewerPanel'; export function WorkspaceFilesContent({ @@ -17,20 +19,27 @@ export function WorkspaceFilesContent({ const { workspacePath, threadId, readsChanges, page } = panel; const { factoryId } = useParams<{ factoryId: string }>(); const sessionId = useRouteSessionId(); - if (!workspacePath || !threadId) return null; + if (workspacePath && threadId) { + return ( +
+ +
+ ); + } + if (!page) return null; return ( -
- -
+ +
{page.overview(undefined)}
+
); } diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesToggle.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesToggle.tsx index d89f9e7e8aa..db45435c28f 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesToggle.tsx +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceFilesToggle.tsx @@ -10,10 +10,10 @@ import { WorkspaceFilesContent } from './WorkspaceFilesContent'; import { IconSidebarSimpleRightWide } from '@mastra/playground-ui/icons/central/IconSidebarSimpleRightWide'; export function WorkspaceFilesToggle() { - const { open, setOpen, workspacePath, canDock } = useWorkspacePanel(); + const { open, setOpen, hasContent, canDock } = useWorkspacePanel(); const [size, setSize] = useState('compact'); - if (!workspacePath) return null; + if (!hasContent) return null; const setPopoverOpen = (next: boolean) => { if (next) setSize('compact'); diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspacePanelDock.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspacePanelDock.tsx index 0960e1554fe..77cdc2b2660 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspacePanelDock.tsx +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspacePanelDock.tsx @@ -18,11 +18,11 @@ function measureCapsule(capsule: HTMLDivElement) { export function WorkspacePanelDock({ children }: { children: ReactNode }) { const panel = useWorkspacePanel(); - const Dock = panel.workspacePath ? 'aside' : 'div'; + const Dock = panel.hasContent ? 'aside' : 'div'; return ( {children} - {panel.workspacePath && } + {panel.hasContent && } ); } diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceViewerPanel.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceViewerPanel.tsx index b66aae9dd91..80de1d9e5ca 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceViewerPanel.tsx +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/components/WorkspaceViewerPanel.tsx @@ -1,6 +1,5 @@ import { Button } from '@mastra/playground-ui/components/Button'; import { Tab, TabContent, TabList, Tabs } from '@mastra/playground-ui/components/Tabs'; -import { cn } from '@mastra/playground-ui/utils/cn'; import { memo, useState } from 'react'; import type { ReactNode } from 'react'; import type { UseQueryResult } from '@tanstack/react-query'; @@ -10,9 +9,10 @@ import { useWorkspaceChanges, useWorkspaceFile } from '../../../../hooks/use-fs' import { useFactoryQuery } from '../../../../hooks/useFactories'; import { useUserSessionQuery } from '../../../../hooks/useWorkspaces'; import type { WorkspacePanelPage, WorkspaceSectionSlots } from '../context/WorkspacePanelContext'; -import { overviewScrollClass } from '../layout'; +import { overviewClass } from '../layout'; import type { WorkspacePanelSize } from '../layout'; import type { RepositoryProviders } from './changes/tree/change-tree'; +import { PanelFrame } from './PanelFrame'; import { PanelSubject } from './PanelSubject'; import { RecreateSandboxAction } from './RecreateSandboxAction'; import { WorkspaceChangesPanel } from './WorkspaceChangesPanel'; @@ -151,14 +151,9 @@ export const WorkspaceViewerPanel = memo(function WorkspaceViewerPanel({ ); return ( -
-
- {page ? page.subject(back) : } -
+ }> {view.type === 'overview' ? ( -
- {page ? page.overview(workspace) : workspace()} -
+
{page ? page.overview(workspace) : workspace()}
) : null} {view.type === 'changes' || view.type === 'files' ? (
) : null} - + ); }); diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/context/WorkspaceFilesProvider.tsx b/mastracode/factory-ui/src/ui/domains/workspace-viewer/context/WorkspaceFilesProvider.tsx index 74fef160ee5..8b73e89abd6 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/context/WorkspaceFilesProvider.tsx +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/context/WorkspaceFilesProvider.tsx @@ -38,13 +38,14 @@ export function WorkspaceFilesProvider({ page, children }: { page?: WorkspacePan const readsChanges = panelToggle?.open === true || (Boolean(workspacePath) && awakeWorkspace === workspacePath); const setOpen = (next: boolean) => setToggled({ layoutRevision, open: next }); - const docked = open && canDock && Boolean(workspacePath); + const hasContent = Boolean(workspacePath) || page !== undefined; + const docked = open && canDock && hasContent; const hasDocked = canDock || layoutRevision > 0; const moved = layoutRevision > 0 || toggled !== undefined; return (
ReactNode; + export interface WorkspacePanelPage { subject: (lead: ReactNode | undefined) => ReactNode; - overview: (workspace: (slots?: WorkspaceSectionSlots) => ReactNode) => ReactNode; + overview: (workspace: WorkspaceSlot | undefined) => ReactNode; } export interface WorkspacePanelApi { open: boolean; setOpen: (open: boolean) => void; + hasContent: boolean; workspacePath?: string; threadId?: string; canDock: boolean; diff --git a/mastracode/factory-ui/src/ui/domains/workspace-viewer/layout.ts b/mastracode/factory-ui/src/ui/domains/workspace-viewer/layout.ts index 433379b5466..4a0d957c97d 100644 --- a/mastracode/factory-ui/src/ui/domains/workspace-viewer/layout.ts +++ b/mastracode/factory-ui/src/ui/domains/workspace-viewer/layout.ts @@ -67,7 +67,7 @@ export const popoverSizeClass: Record = { export const treeRowContainmentClass = '[content-visibility:auto] [contain-intrinsic-size:auto_1.75rem]'; -export const overviewScrollClass = 'flex min-h-0 w-full min-w-0 grow flex-col overflow-y-auto'; +export const overviewClass = 'flex min-h-0 w-full min-w-0 grow flex-col divide-y divide-border overflow-y-auto'; /** Read through descendant selectors: a variable or `group-*` variant on this box would restyle the whole transcript. */ export const panelStateAttributes = (docked: boolean, moved: boolean) => ({ diff --git a/mastracode/factory-ui/src/ui/pages/CardDraftPage.tsx b/mastracode/factory-ui/src/ui/pages/CardDraftPage.tsx index 6f979292ac3..d872efa9f01 100644 --- a/mastracode/factory-ui/src/ui/pages/CardDraftPage.tsx +++ b/mastracode/factory-ui/src/ui/pages/CardDraftPage.tsx @@ -24,6 +24,7 @@ import { useGlobalShortcuts } from '../domains/chat/hooks/useGlobalShortcuts'; import { boardOf } from '../domains/factory/boardFlow'; import { currentItemStage } from '../domains/factory/boardStages'; import { CardDraftActions } from '../domains/factory/components/CardDraftActions'; +import { CardOverview } from '../domains/factory/components/CardOverview'; import { CardStageBar } from '../domains/factory/components/CardStageBar'; import { useCardSessionRepository } from '../domains/factory/hooks/useCardSessionRepository'; import { useStartCardSessionFromDraft } from '../domains/factory/hooks/useStartCardSessionFromDraft'; @@ -31,8 +32,12 @@ import type { WorkItem } from '../domains/factory/services/workItems'; import { settingsSectionPath } from '../domains/settings/settingsSections'; import { factoryHomePath, threadPath } from '../domains/workspaces/services/factoryPaths'; import type { FactoryProject } from '../domains/workspaces/services/github'; - -const DRAFT_TITLE = 'New session'; +import { PanelSubject } from '../domains/workspace-viewer/components/PanelSubject'; +import { WorkspaceFilesToggle } from '../domains/workspace-viewer/components/WorkspaceFilesToggle'; +import { WorkspacePanelDock } from '../domains/workspace-viewer/components/WorkspacePanelDock'; +import { WorkspaceFilesProvider } from '../domains/workspace-viewer/context/WorkspaceFilesProvider'; +import type { WorkspacePanelPage } from '../domains/workspace-viewer/context/WorkspacePanelContext'; +import { SkeletonRows } from '../ui/SkeletonRows'; export function CardDraftPage() { const { @@ -64,7 +69,7 @@ function CardDraftContent({ if (card.isLoadingError) { return ( - +
+
+
@@ -117,17 +122,59 @@ function CardDraftContent({ const session = cardThreadSession(item, board?.phases, currentItemStage(item, board) ?? ''); if (session) return ; + const panel: WorkspacePanelPage = { + subject: lead => , + overview: () => ( + + ), + }; + return ( - } - > - {guards.missingModel || guards.missingCredential ? ( - - ) : ( - - )} - + + } + headerActions={} + dockActions={actions => {actions}} + > + {guards.missingModel || guards.missingCredential ? ( + + ) : ( + + )} + + + ); +} + +function CardDraftOverview({ + factory, + item, + boards, + boardsFailed, +}: { + factory: FactoryProject; + item: WorkItem; + boards: readonly InstalledBoardInfo[] | undefined; + boardsFailed: boolean; +}) { + const lookup = useCardSessionRepository(factory.id, item); + if (lookup.isPending) return ; + + const resolved = lookup.data?.status === 'resolved' ? lookup.data : undefined; + const repository = + resolved && factory.repositories.find(linked => linked.projectRepositoryId === resolved.projectRepositoryId); + return ( + ); } diff --git a/mastracode/factory-ui/src/ui/pages/ThreadPage.tsx b/mastracode/factory-ui/src/ui/pages/ThreadPage.tsx index 09c3064a4be..4f7c560127e 100644 --- a/mastracode/factory-ui/src/ui/pages/ThreadPage.tsx +++ b/mastracode/factory-ui/src/ui/pages/ThreadPage.tsx @@ -57,7 +57,7 @@ export function ThreadPage() { return ( - + diff --git a/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx b/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx index 217eeb7882a..c46ac1259fb 100644 --- a/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx +++ b/mastracode/factory-ui/src/ui/pages/__tests__/CardDraftPage.msw.test.tsx @@ -2,7 +2,7 @@ import { screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { http, HttpResponse } from 'msw'; import { createMemoryRouter, RouterProvider } from 'react-router'; -import { describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; import { server } from '../../../../e2e/ui/msw-server'; import { renderWithProviders, TEST_BASE_URL, waitForMutationsIdle } from '../../../../e2e/ui/render'; @@ -34,6 +34,22 @@ const linearCard = { }, }; +const PULL_REQUEST_NUMBER = 30647; +const PULL_REQUEST_URL = `https://github.com/acme/app/pull/${PULL_REQUEST_NUMBER}`; +const PULL_REQUEST_BODY = 'Stops the unhandled rejection when a stream aborts.'; +const pullRequestCard = { + ...linearCard, + title: 'fix(core): stop the unhandled rejection', + externalSource: { + integrationId: 'github', + type: 'pull-request', + externalId: String(PULL_REQUEST_NUMBER), + url: PULL_REQUEST_URL, + }, + metadata: { githubPullRequestNumber: PULL_REQUEST_NUMBER, number: PULL_REQUEST_NUMBER, state: 'open' }, + workItem: null, +}; + function stubCard(metadata: Record = linearCard.metadata) { const runStarts: unknown[] = []; server.use( @@ -63,13 +79,20 @@ function renderAt(path: string) { return { router, ...renderWithProviders(, createQueryClient()) }; } +function stubPageWidth(width: number) { + vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(() => new DOMRect(0, 0, width, 800)); +} + describe('a card without a session', () => { + afterEach(() => vi.restoreAllMocks()); + it('opens on a draft titled after the card that creates nothing until the first prompt', async () => { const route = stubDraftRoute(); const runStarts = stubCard(); const { router } = renderAt(`/factories/${FACTORY_ID}/cards/${CARD_ID}`); expect(await screen.findByRole('heading', { level: 2, name: linearCard.title })).toBeInTheDocument(); + expect(screen.queryByRole('heading', { level: 1, name: 'New session' })).not.toBeInTheDocument(); expect(router.state.location.pathname).toMatch( new RegExp(`^/factories/${FACTORY_ID}/cards/${CARD_ID}/new/[0-9a-f-]{36}$`), ); @@ -78,6 +101,31 @@ describe('a card without a session', () => { expect(runStarts).toEqual([]); }); + it("shows the card's pull request and description in the session panel before any session exists", async () => { + stubPageWidth(1200); + const route = stubDraftRoute(); + stubCard(); + server.use( + http.get(`${TEST_BASE_URL}/web/factory/projects/${FACTORY_ID}/work-items`, () => + HttpResponse.json({ workItems: [pullRequestCard] }), + ), + http.get(`${TEST_BASE_URL}/web/github/projects/:repository/prs/:number`, ({ params }) => + HttpResponse.json({ number: Number(params.number), description: PULL_REQUEST_BODY }), + ), + ); + renderAt(`/factories/${FACTORY_ID}/cards/${CARD_ID}/new/${DRAFT_SESSION_ID}`); + + const panel = await screen.findByRole('complementary', { name: 'Session panel' }); + const card = await within(panel).findByRole('region', { name: 'Card' }); + expect(await within(card).findByRole('link', { name: `Open PR #${PULL_REQUEST_NUMBER}` })).toHaveAttribute( + 'href', + PULL_REQUEST_URL, + ); + expect(await within(card).findByText(PULL_REQUEST_BODY)).toBeInTheDocument(); + expect(within(panel).queryByRole('region', { name: 'Workspace' })).not.toBeInTheDocument(); + expect(route.createBodies).toEqual([]); + }); + it("offers the card's next step on the draft and moves the card into it", async () => { stubDraftRoute(); const runStarts = stubCard();