-
-
Notifications
You must be signed in to change notification settings - Fork 638
Trigger generator tests when TypeScript files change #2208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #2205 When TypeScript files in packages/react-on-rails/ change, the CI change detector now triggers generator tests. This is important because generator tests do a full build, which catches TypeScript compilation errors that might otherwise slip through until npm publish time. The issue arose when PR #2125 changed TypeScript types but the resulting compilation error wasn't caught until the release script ran. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Warning Rate limit exceeded@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 27 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
✨ Finishing touches🧪 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 |
Code Review - PR #2208SummaryThis PR fixes a critical gap in CI coverage by ensuring generator tests run when TypeScript files change in ✅ What's Good
🔍 Observations & Questions1. Verification StrategyThe test plan mentions verifying the script correctly detects changes, but I don't see automated tests for Suggestion: Consider adding a test suite for this critical script, especially since it controls CI behavior. Example structure: # test/ci-changes-detector.bats or similar
test_typescript_changes_trigger_generators() {
# Mock git diff output
# Run script
# Assert run_generators=true
}This would prevent future regressions and make verification repeatable. 2. Performance ImpactGenerator tests are among the heaviest CI jobs (full builds, multiple examples). With this change, every TypeScript change in Questions:
Current logic: JS changes already trigger dummy tests (line 266), so you're adding generators on top. This seems appropriate given the issue - generator tests caught the type error that other checks missed. 3. Pro Package ConsistencyI notice there's a Question: Should Pro JS changes also trigger Pro generator tests? Or are Pro generators tested separately via If Pro has separate generator tests, consider documenting that in a comment to explain the asymmetry. 🐛 Potential IssuesMinor: Comment PrecisionLine 270-271 says "generators do a full build which catches TypeScript compilation errors." Clarification: The generators themselves don't build - they generate example apps that then get built as part of the test. Consider rewording: # JS changes trigger generator tests because generator tests perform full builds
# of generated examples, which catches TypeScript compilation errors (see issue #2205)This makes the mechanism clearer (generates → builds examples → catches TS errors). 🔒 Security & Performance
📋 Test CoverageCurrent state: Manual verification only ("Verify the script correctly detects TypeScript changes"). Recommendations:
✨ Additional Suggestions
🎯 VerdictLGTM with minor suggestions ✅ This is a solid fix that addresses a real gap in CI coverage. The change is minimal, well-documented, and follows existing patterns. The suggestions above are mostly about future-proofing and documentation, not blockers. Recommended next steps:
Great work tracking down the root cause and implementing a targeted fix! 🚀 |
Code Review - PR #2208SummaryThis PR fixes issue #2205 by ensuring TypeScript changes trigger generator tests, which perform full builds and catch compilation errors. The fix is simple, targeted, and effective. ✅ Strengths
🔍 Considerations & Questions1. Performance Impact (Low Priority)Generator tests are now triggered for ANY JS/TS change in packages/react-on-rails/, not just TypeScript compilation-breaking changes. This means:
Analysis: This is likely acceptable because:
Recommendation: ✅ Accept as-is. The trade-off favors safety. 2. Potential False PositivesChanges to packages/react-on-rails/tests/** or packages/react-on-rails/scripts/** will also trigger generator tests since they set JS_CHANGED=true (line 97). Example: A change to only packages/react-on-rails/tests/ComponentRegistry.test.ts would now run generator tests even though it can't break the build. Recommendation: If you want to optimize, you could create a separate JS_SRC_CHANGED flag for just src/ files and keep JS_CHANGED for tests/scripts. However, this adds complexity. Current approach is fine unless CI costs become prohibitive. 3. TypeScript Config ChangesThe pattern at line 97 includes packages/react-on-rails/tsconfig.json, which will correctly trigger generator tests. This is good - tsconfig.json changes can absolutely break builds. Recommendation: ✅ Working as intended. 🐛 Potential IssuesLogic Clarity (Minor): The comment says "JS changes trigger generator tests" but could be even clearer about the two distinct reasons generator tests run. Very low severity - existing comment is adequate. 🔒 Security ConcernsNone. This is a CI configuration change with no security implications. 📊 Test CoverageCurrent Coverage: The change is implicitly tested by CI workflows (e.g., .github/workflows/examples.yml at line 98 checks run_generators). Additional Testing: The ci-changes-detector script itself has no unit tests. Consider adding a test suite in a future PR to verify:
Recommendation: Not required for this PR, but would improve maintainability long-term. ✅ Final VerdictAPPROVED ✓ This is a well-reasoned, minimal fix that directly addresses the root cause from #2205. The code is clean, well-commented, and follows existing patterns. Minor Suggestions (Optional):
Great work on the root cause analysis and keeping the fix surgical! 🎯 |
Code Review for PR #2208SummaryThis PR addresses issue #2205 by ensuring that TypeScript changes in ✅ Positive Aspects
🔍 Code Quality AnalysisScript Logic (script/ci-changes-detector:270-272)Before: if [ "$GENERATORS_CHANGED" = true ]; then
RUN_GENERATORS=true
fiAfter: # JS changes trigger generator tests because generators do a full build
# which catches TypeScript compilation errors (see issue #2205)
if [ "$GENERATORS_CHANGED" = true ] || [ "$JS_CHANGED" = true ]; then
RUN_GENERATORS=true
fiAnalysis:
|
Summary
packages/react-on-rails/change, CI now also triggers generator testsProblem (Fixes #2205)
PR #2125 changed TypeScript types in
packages/react-on-rails/src/types/index.ts, which exposed a latent type error inserverRenderReactComponent.ts. This wasn't caught until the release script ranpnpm publishwhich performs a fresh TypeScript build.The generator/example tests would have caught this because they run a full build, but they weren't triggered because the CI change detection didn't consider
packages/react-on-rails/**changes as requiring generator tests.Solution
Updated
script/ci-changes-detectorto trigger generator tests whenJS_CHANGED=true(which includes TypeScript file changes inpackages/react-on-rails/src/).Test plan
run_generators=true🤖 Generated with Claude Code