Repository navigation
ci(quality): gate PRs on React Doctor errors in changed lines - #7931
tylerslaton wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Size Change: 0 B Total Size: 1.83 MB ℹ️ View Unchanged
|
eced05a to
c7c9ed4
Compare
marthakelly
left a comment
There was a problem hiding this comment.
The changed-lines scoping, the merge-queue wiring and the network opt-outs all check out. Eight comments inline. The first two need fixing before react-doctor becomes a required check: example-only PRs and auto-formatted PRs would never get a status. The last three are optional.
| @@ -11,6 +11,9 @@ on: | |||
| paths-ignore: | |||
There was a problem hiding this comment.
PRs that only change examples/ or README.md can't merge once react-doctor is required
The pull_request trigger keeps paths-ignore for README.md and examples/**, so those PRs never start static / quality. A required check from a workflow that never ran stays at "Expected — Waiting for status to be reported", and the PR can't enter the merge queue. Move the react-doctor job into its own workflow without paths-ignore.
| - name: Run oxlint check | ||
| run: pnpm run lint | ||
|
|
||
| react-doctor: |
There was a problem hiding this comment.
PRs fixed by the auto-format job lose their react-doctor status
The format job pushes "style: auto-fix formatting" using GITHUB_TOKEN (line 211), and GitHub doesn't start workflows for pushes made with that token. The new head commit gets no react-doctor run, so once the check is required, the PR stays blocked until someone pushes another commit. Push the formatting fix with a GitHub App token, so the new commit starts static / quality.
| engines: {node: ^18.19.0 || >=20.6.0} | ||
| deprecated: Use @opentelemetry/sdk-trace package | ||
| peerDependencies: | ||
| '@opentelemetry/api': '>=1.3.0 <1.10.0' |
There was a problem hiding this comment.
The lockfile now pairs OpenTelemetry packages with an API version they don't support
Adding React Doctor moves @opentelemetry/api from 1.9.0 to 1.10.0, but @opentelemetry/[email protected] and its sibling packages declare >=1.3.0 <1.10.0. Packages such as packages/runtime now run their tests against that unsupported pair, while the description says the shifted peers stay inside their range. Pin @opentelemetry/api to 1.9.0 with a pnpm.overrides entry and regenerate the lockfile.
| "oxfmt": "^0.36.0", | ||
| "oxlint": "^1.51.0", | ||
| "publint": "^0.3.17", | ||
| "react-doctor": "0.9.18", |
There was a problem hiding this comment.
The pre-commit hook runs React Doctor on Node versions it doesn't support
React Doctor 0.9.18 declares engines: ^20.19.0 || >=22.13.0, but the repo's engines.node allows >=20, and there is no engine-strict setting to stop an install. Contributors on Node 20.0 through 20.18 therefore run the new hook on every commit that stages a file under packages/. Raise the root engines.node to ^20.19.0 || >=22.13.0.
| - **Nx monorepo** — always run tasks through `nx` (`nx run`, `nx run-many`, `nx affected`), never the underlying tooling directly. | ||
| - **Flat package structure** — all packages live directly under `packages/` (no `v1/` or `v2/` subdirectories). Every package uses the `@copilotkit/` scope. | ||
| - **Simplicity** — prefer the simplest correct solution. For non-trivial changes, consider if there's a cleaner approach before committing. | ||
| - **React Doctor** — React Doctor errors block PRs that touch the React packages listed in `doctor.config.jsonc` (the required `react-doctor` check in `static / quality`), and the lefthook pre-commit hook runs the same check on staged lines. Only lines you add or change count: errors block, warnings don't. Run `pnpm run react-doctor` before pushing and fix what it reports rather than adding disable comments. |
There was a problem hiding this comment.
Agents are told react-doctor is required before it is
The new bullet in CLAUDE.md and AGENTS.md calls it "the required react-doctor check", but it only becomes required after the ruleset change listed under "After merge". Until then, agents will describe and treat a check that isn't enforced as if it were. Call it "the react-doctor check" until the ruleset change lands.
| "lint": "oxlint .", | ||
| "format": "oxfmt --write .", | ||
| "check-format": "oxfmt --check .", | ||
| "react-doctor": "react-doctor . --scope lines --base origin/main --no-telemetry", |
There was a problem hiding this comment.
pnpm run react-doctor can flag lines the developer never touched
The script diffs against origin/main as of the last fetch. After gh pr checkout of a branch that's based on a newer main, lines that landed on main since that fetch count as changed, and React Doctor reports errors in them. Fetch origin/main in the script before the scan.
| "oxfmt": "^0.36.0", | ||
| "oxlint": "^1.51.0", | ||
| "publint": "^0.3.17", | ||
| "react-doctor": "0.9.18", |
There was a problem hiding this comment.
Every CI job now installs React Doctor's dependencies
React Doctor is a root devDependency, so every pnpm install in CI adds about 92 packages, including playwright-core, @sentry/node and a second oxlint. Only the react-doctor job and the pre-commit hook use them. Run React Doctor with pnpm dlx [email protected] in the job and the hook, instead of installing it at the root.
| "share": false, | ||
| "ignore": { | ||
| "files": [ | ||
| "**/v1-deprecated/**", |
There was a problem hiding this comment.
v1 code is checked in react-ui but skipped in react-core
ignore.files skips **/v1-deprecated/**, but projects includes @copilotkit/react-ui and @copilotkit/react-textarea, which are v1 packages. An edit to a v1 hook in react-core passes, while the same kind of edit in react-ui is blocked. Remove **/v1-deprecated/** from ignore.files, so v1 code is checked the same way everywhere.
Adds a react-doctor job to static / quality that runs React Doctor 0.9.18 over the React packages listed in doctor.config.jsonc, scoped to lines the PR adds or changes. Errors fail the job; warnings are printed only. React Doctor installs from tools/react-doctor/ with its own lockfile. Adding it to the root lockfile re-resolved @opentelemetry/api and @babel/core peers across the workspace. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The lefthook pre-commit hook now runs React Doctor on staged lines, so agents hit errors while they build rather than after CI. It takes about a second and only runs when staged files are under packages/. static / quality now also triggers on merge_group so react-doctor can be a required check. The other jobs skip merge_group events, so they run exactly as before. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Moves React Doctor 0.9.18 from its own install in tools/react-doctor/ into the root devDependencies (exact pin). Root devDependencies are never published, so packages and their consumers are unaffected. It also drops the extra install step from the script, the pre-commit hook and CI, the second lockfile and .npmrc, and the note telling agents not to run `react-doctor install`. The root lockfile adds React Doctor's dependency tree. No workspace package's direct dependency versions change. Some peers resolve to different versions: - @opentelemetry/api goes from 1.9.0 to 1.10.0. - lightningcss goes from 1.32.0 to 1.33.0 under Vite. - Babel 7 plugins, and Next's optional @babel/core peer, now resolve @babel/core 7.28.5 (inside their ^7 range) instead of 8.0.1. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- static / quality runs on every PR. The README/examples path filter would have left the required react-doctor check waiting forever on PRs that only touch those paths. - doctor.config.jsonc checks only the non-deprecated React packages: it drops react-ui (whose only v2 export is CSS) and react-textarea. - Inline react-doctor-disable comments are ignored (respectInlineDisables: false), so the only way past an error is to fix it. The agent docs say so, and no longer call the check "required" before the ruleset change lands. - Pin @opentelemetry/api to 1.9.0. React Doctor's install had moved it to 1.10.0, outside the <1.10.0 peer range of the OpenTelemetry 2.x SDK packages. - Raise engines.node to React Doctor's range (^20.19.0 || >=22.13.0). - `pnpm run react-doctor` fetches origin/main first, so a stale local ref can't make it report lines the branch never touched. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
c7c9ed4 to
cfd7018
Compare
@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/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
## What does this PR do? Removes the `format` job from `static / quality`. That job ran oxfmt and ruff on PR-changed files and pushed a "style: auto-fix formatting" commit back to the branch using `GITHUB_TOKEN`. GitHub doesn't start workflows for pushes made with that token. So the pushed commit never got its required checks (`Intelligence runtime conformance` today, and `react-doctor` once #7931 is required), and the PR stayed blocked until someone pushed again. Formatting is still applied locally: the lefthook pre-commit `lint-fix` hook runs oxfmt (and ruff for Python) on staged files. CI no longer checks formatting. Removing the job also drops the workflow's only `contents: write` permission and its `GITHUB_TOKEN` push. A comment about the job is removed from `.github/zizmor.yml` too. ## Testing - `actionlint` passes on `static_quality.yml`. - Nothing else references the job: no other workflow, and no doc apart from the removed zizmor comment. ## Related PRs and Issues - Stacked on #7935, which is stacked on #7931. Merge this before making `react-doctor` a required check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What does this PR do?
Adds React Doctor as a quality gate for CopilotKit's non-deprecated React packages, so agents can't land the React bugs it detects (conditional hooks, writing
ref.currentduring render, missing effect cleanup, and so on). Agents hit it while they build, not only in CI.react-doctorjob instatic / quality(PRs and the merge queue)origin/mainpnpm run react-doctor(local; fetchesorigin/mainfirst)origin/mainWarnings are printed but never block. Existing findings on lines a PR doesn't touch are ignored, so unrelated PRs aren't blocked. Main currently has 71 errors in scope, and #7935 (stacked on this PR) fixes all of them.
Details
doctor.config.jsoncchecksreact-core,react-native,a2ui-renderer,channels,channels-coreandchannels-ui. Deprecated code is out:react-ui(whose only v2 export is CSS),react-textarea, andreact-core'sv1-deprecated/. Tests and mocks are also excluded.respectInlineDisables: false, soreact-doctor-disablecomments are ignored and the only way past an error is to fix it. The pre-commit hook and CI enforce this the same way.adoptExistingLintConfig: false, because the oxlint job already enforces.oxlintrc.json.@opentelemetry/apiis pinned to 1.9.0 with an override. The install would otherwise move it to 1.10.0, outside the<1.10.0peer range of the OpenTelemetry 2.x SDK packages.lightningcss1.32.0 → 1.33.0 under Vite andjitisettling on 2.7.0.engines.noderises to React Doctor's range (^20.19.0 || >=22.13.0).static / qualityno longer skipsREADME.mdandexamples/**. Without that, a required check would never report on PRs that only touch those paths.static / qualityalso triggers onmerge_group. Onlyreact-doctorruns there; the other jobs skip it.CLAUDE.mdandAGENTS.mddescribe the check and say inline disables are ignored.After the stack merges: make it required
The
PROTECT_OUR_MAINruleset only requiresIntelligence runtime conformancetoday. Addreact-doctorafter this PR and #7941 (which removes the CI auto-formatter) have merged. Until then, the check doesn't exist on main, and a formatter push would leave a PR without the check.Testing
react-doctor-disable-next-linecomment on it, both in the CI mode and in the pre-commit mode.test,publintandattwpass with the new lockfile.actionlintpasses.Related PRs and Issues
🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Documentation