mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
perf(factory): show only cards on the board and in search (#30266)
**─────── TLDR ───────** > The Factory board and ⌘K search show only cards, and never ask GitHub, GitLab, Linear, Jira or incident.io for their issue or pull request lists. Fourth of four, stacked on #30271: GitLab (#30265), Jira (#30270), incident.io (#30271), then this. Every open board asked each connected provider for its open issues every 30 s, per tab, only to show the ones with no card yet ("New candidates", "Load more candidates"). The server now files every new issue as a card itself, GitHub and GitLab from events, Linear, Jira and incident.io from the 5-minute sweep, and pushes it over the board stream. So the board reads cards and nothing else. ### Behavior changed an open issue or pull request with no card ├─ **was** — greyed in Intake, or in Triage if labelled `status: auto-triaged` └─ **now** — not on the board or in ⌘K until the server files it a board left open ├─ **was** — one list call per connected provider, per tab, every 30 s └─ **now** — no provider list call; new cards arrive over the stream scrolling to the end of a long phase ├─ **was** — one more page, then stuck on "Load more" while still in view └─ **now** — keeps loading while the end is in view, stops once all listed ⌘K search ├─ **was** — cards plus live provider issues marked "not filed" └─ **now** — cards only a board whose intake routes fail to load └─ **unchanged** — an error with Retry, now shown in its Intake column ### Decisions - **the board shows only cards** — agreed with Ward: routes decide where every issue goes, the server is the only filer; reverting this PR brings the lists back - **no filing by hand of an issue the server never filed** — deployments with a `manual_intake` route lose it; an on-demand lookup by URL is a separate PR if needed - **auto-triaged issues with no card leave Triage** — that column was a label view; an intake route on the label files them into Triage as cards ### Shape changed | | | | |---|---|---| | **−** | `useBoardIntake` `useGlobalSearchIntake` | built the no-card lists | | **−** | the seven provider list hooks and their services | only those lists called them | | **−** | `Candidate*` `BoardStageCandidates` `IntakeColumnExtras` `IntakeFeedNotice` | nothing left to render | | **−** | `INTAKE_POLL_MS` `INTAKE_ERROR_POLL_MS` | no timer left | | **+** | `useBoardIntakeSetup` | the part still needed: does this board get cards, did its routes load | | **~** | `LoadMoreSentinel` | takes `loaded`, asks again after each page while in view | kept, because card details and Settings still read them single-item detail reads per provider · the five status queries ### Watch > [!WARNING] > Merge this <mark>after #30270 and #30271</mark>. Until the server files Jira and incident.io issues itself, nothing puts them on the board. on deploy: open issues with no card disappear from Intake and Triage. Issues older than the repository link (GitHub, GitLab) or outside the sweep's window (Linear, Jira) get a card when they next change at the provider. ### Not verified - [ ] any real provider — every request in the tests is answered by MSW; a local run checked the network tab only - [ ] a server sweep that keeps failing (expired Linear sign-in, revoked Jira token) — nothing on the board says so; the error is only in the server log --- > ██████████████████ **tests** `+500 −3517` — mostly tests of the removed no-card lists > ███████████ **source** `+215 −2256` — net −2041 > █ **changeset and README** `+7 −2` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> **ELI5:** The Factory board and search now show only saved cards. They no longer ask each connected service for its full list of issues and pull requests. The server adds new items to the board as cards, so the screen loads less data and does not repeat the same requests. ## Summary ### Behavior change - The Factory board and ⌘K search read only cards from Factory. - Boards and search no longer request provider issue or pull-request lists from GitHub, GitLab, Linear, Jira, or incident.io. - New issues and pull requests reach the board as server-filed cards. The server files them through the board stream. - Items without a card do not appear in Intake, Triage, or search until the server files them. ### Removed code - Provider list clients and types: `listRepositoryIssues`, `listRepositoryPullRequests`, `listGitLabIssues`, `listGitLabMergeRequests`, `listLinearIssues`, `listJiraIssues`, and `listIncidentioIssues`, with their page types. - Provider list hooks: `useProjectIssuesQuery`, `useProjectPullRequestsQuery`, `useGitLabIssuesQuery`, `useGitLabMergeRequestsQuery`, `useLinearIssuesQuery`, `useJiraIssuesQuery`, and `useIncidentioIssuesQuery`. The polling constants `INTAKE_POLL_MS` and `INTAKE_ERROR_POLL_MS` were also removed. - Candidate model and UI: `boardCandidates.ts`, `useBoardIntake`, `useGlobalSearchIntake`, `CandidateCard`, `CandidateCardRows`, `CandidateListRow`, `CandidateDetailsPanel`, `BoardStageCandidates`, `IntakeColumnExtras`, and `IntakeFeedNotice`. - Query keys and filed-from lookups: the list-related `queryKeys` builders and `workItemsFiledFrom` / `workItemsFiledFromAny`, along with `filedFromQueryOptions`. - Candidate drag payloads: `boardDrag.ts` accepts only `work-item` payloads. ### Added code - `useBoardIntakeSetup` (`useBoardIntakeSetup.ts`). It reports: - whether a board receives newly filed cards; - whether a non-default board has no intake route; - whether route loading failed. - The hook exposes a failed route query's error message and a retry callback. It reports pending while status, binding, or route queries are unresolved. - `getJiraIssue` in `jira.ts`, which fetches one Jira issue detail. ### Modified behavior - `LoadMoreSentinel` takes a new required `loaded` row count. It calls `onLoadMore` only when a next page exists and no fetch is running. It retries when it stays in view and `loaded` changes. It stops when a page adds no rows or fails. - `BoardStageCards` takes an optional `intakeFailure` (`{ message, retry }`) instead of feed props. It shows an alert with a Retry button. - `BoardContent` uses `useBoardIntakeSetup`. Displayed cards and counts come from server work-item phases. Same-stage drops are ignored. - `useBoardItems.handleDrop` accepts only existing work-item payloads. - `boardLoadingStages` no longer accepts `triagePending`. - `boardParticipants` no longer accepts `candidates`. - `BoardColumnEmptyState` no longer accepts `alreadyMaterialized`. - Global search: - `useGlobalSearchWorkItems(factoryId, typed)` reads session cards and unstarted cards directly from the server. It uses a 150 ms debounce on the trimmed input. - `WorkItemSearchResult` holds `item: WorkItem`. - `GlobalSearchWorkItemsStatus` takes one `failed` flag. - `useIntakeConfig` no longer invalidates provider issue-feed queries after intake or binding mutations. ### Tests and documentation - Deleted test files include `useFactoryData.msw.test.tsx`, `useBoardIntake.msw.test.tsx`, `boardCandidates.test.ts`, `boardLabels.test.ts`, `BoardPageIntakePaging.msw.test.tsx`, and `BoardPageIntakeFeedFailure.msw.test.tsx`. - New tests: - `BoardPageCardsOnly.msw.test.tsx` checks that unfiled provider items are not shown and that provider lists are not requested. - `useBoardIntakeSetup.msw.test.tsx` checks source bindings and pending state. - `BoardPagePagedReads.msw.test.tsx` adds phase-end paging and retry-on-failure cases. - The Changeset (`.changeset/linear-intake-reads-once.md`) is a `mastra` patch note for this behavior change. - `mastracode/factory/README.md` now says bound sources feed server-filed cards. It removes the documented 30-second browser refresh for Jira issue lists. ### Operational risks (from the PR description) - Deployments with `manual_intake` or `MASTRACODE_*_RECONCILE_ENABLED=false` may lose issues from the board. - Older issues, and issues outside a sweep window, may not get cards until they change at the provider. - A persistently failing server sweep logs errors only on the server. The author did not test this case. - The PR description says to merge this after `#30270` and `#30271`, and before the server files Jira and incident.io issues itself. ### Verification - The author did not test against a real provider. Tests used MSW stubs. A local run checked only the network tab. - CI and build results: not available. - Review finding counts: not available. ### Diff size - 70 files changed, +722 / −5775 lines. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Damien Schneider <damienschneider@damiens-MacBook-Pro.local> Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com> Co-authored-by: mastra-platform[bot] <mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
parent
8c319a86a0
commit
049b31dd2c
70 changed files with 722 additions and 5775 deletions
Loading…
Add table
Add a link
Reference in a new issue