fix(react-core): compare purity-scan entry keys with forward slashes - #7445
AlemTuzlak wants to merge 1 commit into
Conversation
esbuild keys its metafile with forward slashes on every platform, but the entry key came from path.relative, which uses backslashes on Windows. The scan then reported that the graph did not contain its own entry, so size:assert-headless and its script tests failed on every Windows checkout.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesHeadless purity module graph
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The change aligns the entry key with esbuild’s metafile paths on Windows without changing POSIX paths. No merge-blocking issue is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@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-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@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: |
|
Size Change: 0 B Total Size: 1.74 MB ℹ️ View Unchanged
|
| .relative(pkgRoot, path.resolve(pkgRoot, entryFile)) | ||
| .split(path.sep) | ||
| .join("/"); | ||
| if (!inputs.includes(entryKey) && !inputs.includes(entryFile)) { |
There was a problem hiding this comment.
inputs.includes(entryFile) never matches
Callers pass an absolute path, and absWorkingDir: pkgRoot makes the metafile keys relative to pkgRoot.
Remove that half of the condition. Use .replaceAll("\\", "/") instead of .split(path.sep).join("/") so paths with mixed separators are normalized too.
size:assert-headlessand the react-coretest:scriptspurity tests fail on every Windows checkout with "the module graph of … does not contain the entry itself … the scan measured nothing". The cause is a path separator mismatch: esbuild keys its metafile with forward slashes on every platform, but the scan built the entry key withpath.relative, which returns backslashes on Windows. This PR joins the key with/, so the scan finds its entry on Windows too.What does this PR do?
packages/react-core/scripts/assert-headless-purity.mjs: buildentryKeywith forward slashes, to match esbuild's metafile keys.Linux and macOS behavior does not change, because there
path.sepis already/.Related PRs and Issues
Checklist
Testing
Commands run (Windows 11, Node 24), on the
mme/ag-ui-1.0branch where I found it:pnpm --filter @copilotkit/react-core run test:scripts: before, 8 purity tests fail. After, all 54 pass.pnpm --filter @copilotkit/react-core run size:assert-headless: before, it fails with "the scan measured nothing". After, all four entries reportclean.I did not re-run them on this
main-based branch. The commit cherry-picks cleanly and changes one line.Manual test:
mainand runpnpm nx run @copilotkit/react-core:build.pnpm --filter @copilotkit/react-core run size:assert-headless, and see "the scan measured nothing".clean.How this PR makes testing easy: the existing
scripts/__tests__/assert-headless-purity.test.mjssuite covers the scan. It fails on Windows without this fix and passes with it.Risk / rollback
Low. The change affects only a build-time check script, and only on Windows. Revert the commit to undo it.
🤖 Generated with Claude Code
Summary by CodeRabbit