Repository navigation
test(ci): stop the nightly guard leaving scripts/ci on the import path - #13940
Conversation
|
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: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE 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. 📝 WalkthroughWalkthroughThe nightly push throttle test now imports CI scripts through a helper that restores the original ChangesCI test import isolation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Other Merge Risk: ⚪ Minimal · up to This test-only import-isolation change presents no supported merge risk beyond normal checks. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches 💡 1📝 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 |
|
All contributors have signed the CLA ✍️ ✅ |
…scripts `main()` runs every test in this file in one process, so the `sys.path.insert` that let one test import the CI scripts stayed in front of the import path for the tests that ran after it. Nothing in `scripts/ci` shadows a module they import today, so this is hardening, not a live bug: save the path and put it back. Saving the whole list is what makes it work. `nightly_build_inputs` prepends the same directory at import time, so the call leaves two equal entries behind and `sys.path.remove` would drop only one. CodeRabbit raised this on #13899 and suggested `monkeypatch.syspath_prepend`, which does not apply: the guard lane runs this file as `python3 tests/...`, not under pytest, so there is no fixture to restore the path. The save/restore form matches `admission_helper` in tests/test_ci_change_areas.py. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2cbd283 to
a99fb21
Compare
|
Independent agent review of What it found. The helper did not do what its commit message claimed. It also scoped the problem down. Claims it checked and upheld: the guard lane runs this file as Verified after the fix: Not taken: a return annotation on the helper, which the file omits on — NightPetrel g1 🪁 |
5a28af9 test(ci): restore the import path after the nightly guard imports CI scripts (manaflow-ai#13940) ff710bf Lint every file that declares a feature flag (manaflow-ai#13917) 6000c0b ci: gate PRs on the iOS conventions they introduce, not on main's state (manaflow-ai#13934) # Conflicts: # .github/workflows/ci-guards.yml
Follow-up to #13899, addressing the one actionable CodeRabbit finding on it.
tests/test_ci_nightly_push_throttle.pyransys.path.insert(0, scripts/ci)inside a test and never took it back out.main()runs everytest_*in this file in a single process, so that entry sat at the front of the import path for every test that ran afterwards — whatever they imported would have resolved out ofscripts/cifirst. Nothing collides today; the point is that nothing stops one from colliding.The import now goes through a helper that removes the entry in a
finally.Why not CodeRabbit's suggestion. It asked for
monkeypatch.syspath_prepend. There is no pytest in this lane —ci-guards.ymlruns the file aspython3 tests/test_ci_nightly_push_throttle.py, and the repo has no pytest config, noconftest.py, and no pytest dependency — so there is no fixture to restore anything. The bot also marked the finding "✅ Addressed in commit 32381d8"; it was not, the line was still onmain.Tradeoff: a helper instead of two plain
importlines. That is the cost of not depending on a test runner this repo does not use.Guard sweep: 172 of the 177 commands in
ci-guards.ymlpass locally; the 5 that fail need$RUNNER_TEMP, theghostty/vendor/bonsplitsubmodules, or CI-provided arguments, and fail the same way onmain.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Stops the nightly-guard test from leaving
scripts/cion the import path, which could make later tests in the same process resolve imports from the wrong directory. The CI scripts now load through a helper that restores the original path in afinallyblock.nightly_build_inputsprepends the same directory on import, the helper saves and restores the whole path list instead of removing one entry.python3rather than under pytest, so there is no fixture to restore the path.Written for commit a99fb21. Summary will update on new commits.
Summary by CodeRabbit