Repository navigation
feat!: remove graphql and the v1-only helpers from shared, and drop the deps v1 freed - #8103
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/markdown-renderer
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/runtime
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: -6.64 kB (-0.33%) Total Size: 2.01 MB 📦 View Changed
ℹ️ View Unchanged
|
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-10-30 06:59:21 PDT — 0 finding(s). |
11498e7 to
dba3ecd
Compare
…lient-gql version check CopilotKitError extended GraphQLError, so every app that installed @copilotkit/shared, browser bundles included, pulled in graphql. It now extends Error and keeps the same `extensions` object. CopilotKitVersionMismatchError and getPossibleVersionMismatch compared versions with @copilotkit/runtime-client-gql, which 2.0 removed. Refs: PE-1072, PE-1101 BREAKING CHANGE: CopilotKitError extends Error, not GraphQLError. `error.extensions` keeps the same fields. CopilotKitVersionMismatchError and getPossibleVersionMismatch are removed. They have no replacement. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t the uuid package Only v1 used the condition evaluator, the console styling helpers, dataToUUID, and isValidUUID. randomUUID and randomId now use crypto.randomUUID(), and build the UUID from crypto.getRandomValues() where randomUUID does not exist (React Native's Hermes). Refs: PE-1101 BREAKING CHANGE: @copilotkit/shared no longer exports executeConditions, the condition types, ConsoleColors, ConsoleStyles, logStyled, styledConsole, logCopilotKitPlatformMessage, publicApiKeyRequired, dataToUUID, or isValidUUID. For v5 UUIDs or validation, use the uuid package. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- shared: remove graphql and uuid. zod-to-json-schema is used only in tests, so it moves to devDependencies. - runtime: remove openai (dependency and peer), which nothing imports. ws and @copilotkit/channels-intelligence are used only in tests, so they move to devDependencies. - react-core: rxjs is used only in tests, so it moves to devDependencies. Refs: PE-1101 BREAKING CHANGE: @copilotkit/runtime no longer lists openai as a dependency or peer. If your app imports openai, add it to your own dependencies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… in 2.0 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… peer Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runtime loads it with a dynamic import when it starts managed Channels. The packed runtime check failed without it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dba3ecd to
e8e5ed2
Compare
…or breaks (#8202) Most react-core slot tests passed with slot overrides switched off. This PR rewrites them so that they fail when a slot breaks. It also deletes tests that guard nothing. No production code changes. Part of PE-1086. v1 and the GraphQL runtime are already gone from `2.0.0` (#8084, #8103), so nothing in react-core was skipped for pending removal. ## What does this PR do? The rot came from four patterns: 1. `expect(container.querySelector(...)).toBeDefined()`. `querySelector` and `queryBy*` return `null`, and `null` is defined, so the check always passes. 2. `if (el) { expect(...) }`. When the element is missing, the test asserts nothing. 3. Tests with no assertion, or that assert on the test's own mock. 4. The same slot matrix repeated in the popup, sidebar, chat view and message view files. ### How I measured it I applied each mutation locally, ran the tests, and reverted it. Nothing from the mutations is committed. - **M-slots-off:** `renderSlotElement` in `lib/slots.tsx` always renders the default component, so every slot override is ignored. - **M-resolve:** `resolveSlotComponent` in `CopilotChatMessageView.tsx` always returns the default. The message view resolves the assistant and user message slots with this function, not with `renderSlot`. Before this PR, **341 of 427** tests in the slot files and `lib/__tests__` passed under M-slots-off. ### Per file "Survive" = the test still passes under M-slots-off + M-resolve. After this PR, every survivor tests something that is not a slot override: positioning, children render props, labels, root `className`, or width. | File | Before (tests / survive) | After (tests / survive) | Notes | |---|---|---|---| | `CopilotChatInput.slots.e2e` | 48 / 42 | 36 / 10 | Buttons now render (transcribe mode, `toolsMenu`). Duplicates of `CopilotChatInput.test.tsx` removed. | | `CopilotChatView.slots.e2e` | 44 / 32 | 34 / 2 | New helper scrolls the view so the scroll-to-bottom button renders. Before, its tests never saw the button. | | `CopilotChatMessageView.slots.e2e` | 42 / 42 | 15 / 1 | All 42 survived. The sub-button matrix moved to the assistant and user message files. Thumbs are covered by `CopilotChat.raw-event-feedback.test.tsx`. | | `CopilotChatAssistantMessage.slots.e2e` | 26 / 18 | 18 / 2 | `markdownRenderer` never forwards `data-testid`, so that test now checks an object `className`. The `toolCallsView` string-slot test is deleted: `CopilotChatToolCallsView` ignores `className`, so nothing is observable. | | `CopilotChatUserMessage.slots.e2e` | 28 / 17 | 26 / 6 | The only home for user message slots. It now covers all 5 slots in each form with `it.each`. | | `CopilotChatSuggestionView.slots.e2e` | 24 / 14 | 23 / 10 | The loading test only counted buttons. It now checks that only the loading pill is busy and disabled. | | `CopilotModalHeader.slots.e2e` | 24 / 16 | 19 / 8 | The custom close-button test asserted the test's own handler. It now checks that the bound `onClick` closes the modal. | | `CopilotPopupView.slots.e2e` | 33 / 28 | 16 / 7 | The width and height tests checked only that the style named the CSS variable, which the default also sets. They now check the value. | | `CopilotSidebarView.slots.e2e` | 25 / 20 | 12 / 3 | Same width fix. The inherited chat view matrix is now one forwarding test. | | `CopilotChat.slots.e2e` | 23 / 18 | 8 / 1 | Deleted the `container.firstChild` smoke tests (they pass when `CopilotChat` renders nothing), a test that asserted its own mock was not called, and a test with no assertion. | | `CopilotChatView.onClick.e2e` | 29 / 19 | 17 / 3 | The submit test looked for a `<form>` that does not exist, so it never asserted. The add-menu click never fired because the button is disabled without menu items. | | `CopilotChatAssistantMessage.test` | `toBeDefined` on DOM queries | `not.toBeNull()` | Class-slot tests: 0 of 4 failed under M-slots-off before, 3 of 4 after. The 4th tests the root `className` prop. | | `CopilotChatInput.test`, `CopilotChatToolRendering.e2e` | `toBeDefined` on DOM queries | `not.toBeNull()` / `getByTestId` | `waitFor(() => expect(queryByTestId(..)).toBeDefined())` resolved at once. It now waits for the element. | | `use-frontend-tool.e2e` | 2 hollow tests | fixed | The wildcard result check never ran: `testId("tc1")` was called twice, so the result never matched the call. The forwarded-tools test accepted an empty array. Mutation `addTool` → no-op: the old test passes, the new one fails. | | `lib/__tests__/renderSlot.test` | 3 conditional tests + 1 tautology | fixed | The memo test counted two separate renders. It now rerenders with equal props and expects 1 render. Mutation "memo comparator returns false": the old test passes, the new one fails. | Typed props replace most `as any` casts in the rewritten tests. ## Related PRs and Issues - PE-1086 (Linear) - Related: PE-1076 (mutation-testing baseline). This PR does not add Stryker config. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [ ] If the PR changes or adds functionality, I have updated the relevant documentation (not applicable: tests only) - [ ] If the PR contains a breaking change, the title has `!` (not applicable) - [ ] "Allow edits by maintainers" is checked ## Testing **Commands run** - `nx run @copilotkit/react-core:test`: 197 files and 2369 tests pass, 35 skipped (unchanged `skipIf` gates). - `nx run @copilotkit/react-core:check-types --exclude-task-dependencies`: passes. - `oxfmt` and the oxlint gate on every changed file: pass. - Each mutation above, applied and reverted locally. **Manual test** 1. In `packages/react-core/src/lib/slots.tsx`, add `return React.createElement(DefaultComponent, props);` as the first line of `renderSlotElement`. 2. Run `pnpm vitest run src/components/chat/__tests__/CopilotChatInput.slots.e2e.test.tsx` in `packages/react-core`. 3. On `2.0.0`, 42 of 48 tests pass. On this branch, 26 of 36 fail. 4. Revert the line. **How this PR makes testing easy** The changes are tests only. The mutation steps above reproduce the numbers in the table. ## Risk / rollback Low. Only test files change. If a rewritten test turns out to be flaky, revert this PR or that one commit. Each commit covers one group of files. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…o that check nothing (#8204) Three runtime tests passed only because any `Response` passed. None of them reached the code it names. This PR makes them reach it and assert the status. It also deletes two tests that check nothing. No production code changes. Part of PE-1086. v1 and the GraphQL runtime are already gone from `2.0.0` (#8084, #8103), so nothing in runtime was skipped for pending removal. ## What does this PR do? ### Rewritten | Test | What was wrong | Evidence | |---|---|---| | `fetch-handler.test.ts` › "returns 500 JSON error for unhandled errors" | The body had no `messages`, so the request got a **400** from validation. The agent never ran. The test only checked `toBeInstanceOf(Response)`. | The probe showed a 400 `Invalid request body`. Mutation **M-A** (the "Failed to run agent" response in `handle-run.ts` returns 200 instead of 500): the old test passes, the new one fails. | | `fetch-handler-validation.test.ts` › "CORS headers present on 500 error responses" | Same body problem: it got a 400, not a 500. | Mutation **M-A**: the old test passes, the new one fails. | | `code-review-fixes.test.ts` › "single-route agent/run works after onBeforeHandler replaces request" | The test's own hook built `new Request(..., { body: stream })` without `duplex`, and that throws in Node. The handler returned a **500** `internal_error` and `agent/run` never ran. | `onError` showed `TypeError: RequestInit: duplex option is required`. Mutation **M-B** (single-route dispatch sends `{}` instead of `methodCall.body` for `agent/run`): the old test passes, the new one fails. | Each rewritten test now sends a valid run body and asserts the status it names: 500 with `{"error":"Failed to run agent","message":"boom"}`, 500 with CORS headers, or 200 with `text/event-stream`. ### Deleted | Test | Why | |---|---| | `mcp-clients.test.ts` › "type compatibility: @ai-sdk/mcp MCPClient satisfies MCPClientProvider" | It cast `tools()` with `as unknown as` and ended with `expect(true).toBe(true)`, so it checked nothing at runtime or compile time. Without the cast, `tsc` rejects the claim (see below). | | `mcp-apps-middleware-integration.test.ts` › "can be created with mcpServers config pointing at MCPMock URL" | It asserted that `new MCPAppsMiddleware(...)` is an instance of `MCPAppsMiddleware`. That is always true. The other tests in the file use the middleware. | ### Finding for a follow-up (not fixed here) An `@ai-sdk/mcp` `MCPClient` is **not** assignable to `MCPClientProvider`. Its `tools()` returns MCP tools whose `inputSchema` is `FlexibleSchema<unknown>`, and that does not fit the `ai` `ToolSet`. A user who passes a real `MCPClient` to `mcpClients` gets a type error. The deleted test hid this with a cast. This PR changes tests only, so the type stays as it is. ## Related PRs and Issues - PE-1086 (Linear) - react-core part: #8202 ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [ ] If the PR changes or adds functionality, I have updated the relevant documentation (not applicable: tests only) - [ ] If the PR contains a breaking change, the title has `!` (not applicable) - [ ] "Allow edits by maintainers" is checked ## Testing **Commands run** - `nx run @copilotkit/runtime:test`: 184 files and 3013 tests pass, 4 skipped. - `nx run @copilotkit/runtime:check-types --exclude-task-dependencies`: passes. - `oxfmt` and the oxlint gate on every changed file: pass. - Mutations M-A and M-B, applied and reverted locally. Nothing from them is committed. **Manual test** 1. In `packages/runtime/src/runtime/handlers/handle-run.ts`, change `status: 500` in the "Failed to run agent" response to `status: 200`. 2. Run `pnpm vitest run src/runtime/__tests__/fetch-handler.test.ts` in `packages/runtime`. 3. On `2.0.0`, all tests pass. On this branch, "returns 500 JSON error for unhandled errors" fails. 4. Revert the change. **How this PR makes testing easy** The changes are tests only. The mutation steps above reproduce the evidence. ## Risk / rollback Low. Only test files change. To undo, revert the PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Apps on 2.0 no longer install
graphqloruuidthrough@copilotkit/shared. Browser bundles no longer includegraphqleither. #8084 removed v1. This PR removes what v1 left behind inshared,runtime, andreact-core.What does this PR do?
CopilotKitErrorextendsError, notGraphQLError.error.extensionskeeps the same fields. This was the only reasonshareddepended ongraphql.CopilotKitVersionMismatchErrorandgetPossibleVersionMismatchcompared versions with@copilotkit/runtime-client-gql, which 2.0 removed.sharedare removed. These are the condition evaluator, the console styling helpers,dataToUUID, andisValidUUID. No package, example, or doc uses them.randomUUIDandrandomIdno longer use theuuidpackage. They usecrypto.randomUUID(). IfrandomUUIDdoes not exist (React Native's Hermes), they build the UUID fromcrypto.getRandomValues().sharedgraphqlanduuid. Movezod-to-json-schema(tests only) to devDependencies.runtimeopenai(dependency and peer). Nothing imports it. Movews(tests only) to devDependencies.react-corerxjs(tests only) to devDependencies.Kept on purpose:
@segment/analytics-nodeandshared/telemetry. PE-1114 must decide what happens to the Segment data first.@scarf/scarf. It counts installs and is never imported, by design.@copilotkit/channels-coreinruntime. The runtime imports it.@copilotkit/channels-intelligenceinruntime. The runtime loads it with a dynamicimport()to start managed Channels. The packed runtime check (pnpm run verify:runtime-package) fails without it.A new migration page,
migrate/shared-2.0.mdx, tells users what to do for each change: theinstanceof CopilotKitErrorcheck, each removed helper, and the packages they must now install themselves. It also gives the namespace that reproducesdataToUUIDIDs withuuid.BREAKING CHANGE: CopilotKitError extends Error, not GraphQLError. error.extensions keeps the same fields.
CopilotKitVersionMismatchError and getPossibleVersionMismatch are removed. They have no replacement.
@copilotkit/shared no longer exports executeConditions and the condition types, ConsoleColors,
ConsoleStyles, logStyled, styledConsole, logCopilotKitPlatformMessage, publicApiKeyRequired,
dataToUUID, or isValidUUID. For v5 UUIDs or UUID validation, use the uuid package directly.
@copilotkit/runtime no longer depends on openai. If your app imports openai, add it to your dependencies.
Guide: https://docs.copilotkit.ai/migrate/shared-2.0
Related PRs and Issues
Checklist
!(for examplefeat(react-core)!: ...) and the description has aBREAKING CHANGE:line with migration steps. See VERSIONING.mdThe documentation box covers the new migration page. No other docs or examples use the removed exports. PE-1088 owns the final structure of the 2.0 migration guide. The branch is in this repo, so the maintainer-edits box does not apply.
Testing
Commands run
pnpm run verify:runtime-package: passed. The packed runtime installs@copilotkit/channels-intelligenceand loads it through ESM and CJS.npx vitest run scripts/release: 276 tests passed, including the public API manifest check.nx run-many -t build check-typeson all projects. Every package passed. Two example apps fail for reasons outside this PR:agent-langgraph-interrupthas two@langchain/coreversions, andangular-demo-serverusestoReversedwith an oldlibtarget.nx run-many -t testonshared,runtime,react-core,react-native,core,sdk-js,vue,angular,web-inspector, anda2ui-renderer. All passed. Tworeact-corechart tests timed out under parallel load. They pass when they run alone (28/28).test-packageshook was skipped (LEFTHOOK_EXCLUDE=test-packages) because of a flakychannels-teamstest.ingress-auth.test.tsfails a different case on each run, andchannels-teamsuses none of the changed exports. Lint, the lockfile sync, and commitlint ran.Manual test
pnpm install, thenpnpm nx run @copilotkit/shared:build.pnpm why graphql --filter @copilotkit/shared. Make sure that it prints nothing.pnpm nx run @copilotkit/shared:test. Make sure thaterrors.test.tsandrandom-id.test.tspass.How this PR makes testing easy
shared/src/utils/__tests__/errors.test.tschecks thatCopilotKitErroris a plainErrorwith the sameextensions, and that subclasses keepinstanceof.showcase/shell-docs/src/content/docs/migrate/shared-2.0.mdxhas before and after code for each change.shared/src/utils/__tests__/random-id.test.tschecks thecrypto.randomUUID()path, thegetRandomValuesfallback, and the error when no crypto exists.Risk / rollback
error instanceof GraphQLErrorno longer matches aCopilotKitError. No code in this repo does that, and the migration page covers it.migrate/meta.jsonon the same line. Whichever merges second needs a one-line conflict fix.crypto.getRandomValuespolyfill now gets a clear error fromrandomUUID. Before, the error came fromuuid.Public API change
Before
After
🤖 Generated with Claude Code