Repository navigation
fix(devtools): preserve testmon affected selection - #1550
Conversation
Problem: the default devtools verify path still contained a hand-maintained global invalidator and always passed marker filters to pytest. Pytest-testmon disables selection when ordinary pytest selectors such as -m are present unless --testmon-forceselect is supplied, so the default path could silently expand to nearly the whole suite.\n\nWhat changed: remove the custom changed-file invalidator, always use pytest-testmon as the default selector after the seed preflight, pass --testmon-forceselect with the scale marker filter, and run affected testmon single-process by default to avoid xdist collection skew. Seed and explicit full diagnostics keep their worker pools. Update tests and docs to match the new model.\n\nCloses #1549
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 6 minutes and 13 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6bfee111e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
## Summary PR #1550 silently ran ~9,500 tests instead of the affected subset for a full week before being caught — a marker filter (\`-m not scale_*\`) deactivated pytest-testmon affected selection, with no failing test to surface the regression. This adds two unit tests pinning the marker+\`--testmon-forceselect\` pairing invariant so the footgun cannot re-land silently. Closes #1632. ## Problem Per pytest-testmon docs, any non-trivial \`-m\` marker selection deactivates testmon's affected-test selection unless \`--testmon-forceselect\` is also passed. PR #1550 added the flag; this PR makes sure it stays there. The existing tests assert specific marker tokens are present (\`not scale_medium\`, \`not scale_large\`), so a future change that swaps the marker vocabulary could pass those tests while still removing \`--testmon-forceselect\`. The new tests assert the conditional invariant directly: **IF \`-m\` is in the command THEN \`--testmon-forceselect\` is also in the command** — independent of the marker tokens themselves. ## Solution Two focused unit tests under \`tests/unit/devtools/test_verify.py\`: - \`test_default_testmon_step_pairs_marker_filter_with_forceselect\` — the default lane (no flags). - \`test_skip_slow_testmon_step_keeps_forceselect_with_compound_marker\` — \`--skip-slow\` composes the marker; the pairing must hold. The assertion message in both tests names #1550 and #1632 so any future failure trace points directly at the regression history. This matches the recommended Option 3 from #1632: > A meta-test under \`tests/unit/devtools/\` that constructs the same pytest argv \`devtools verify\` uses and asserts \`--testmon-forceselect\` is present whenever \`-m\` markers are present. ## Verification \`\`\` $ pytest tests/unit/devtools/test_verify.py 36 passed (2 new) $ devtools verify --quick "exit_code": 0 \`\`\` Both new tests pass against current code. To verify they actually catch the regression, I locally deleted the \`pytest_cmd.append("--testmon-forceselect")\` line in \`devtools/verify.py:384\` — both new tests fail with the named assertion message, the existing tests fail too. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added regression tests to enforce consistent test execution behavior with marker filtering options. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/Sinity/polylogue/pull/1648?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Make the default
devtools verifypath actually preserve pytest-testmon affected-test selection instead of silently expanding through Polylogue's own invalidator or pytest marker selection behavior.Problem
While validating #1548,
devtools verifywidened a narrow branch into a 9,513-test run. There were two separate causes:devtools/verify.pycarried a hand-maintained changed-file invalidator list that forced--testmon-noselectfor config andtests/infra/paths.-m not scale_medium and not scale_large. Pytest-testmon documents that ordinary pytest selectors such as-mdeactivate selection unless--testmon-forceselectis supplied, so the default command still ran effectively all tests.Solution
devtools verify.--seed-testmonand--all/--full.--testmon-forceselectto the default affected-test step because the command always uses marker filters for scale tiers.-n 0) to avoid xdist collection skew with forced testmon selection; seed/full diagnostics keep worker pools.Closes #1549
Verification
pytest -q tests/unit/devtools/test_verify.py --tb=short-> 32 passed in 5.16sruff format --check devtools/verify.py tests/unit/devtools/test_verify.py && ruff check devtools/verify.py tests/unit/devtools/test_verify.py-> all checks passedpython -m mypy devtools/verify.py tests/unit/devtools/test_verify.py-> successdevtools render-all-> regenerated AGENTS/docs surfacesdevtools verify --json-> exit 0, pytest steppytest testmon,pytest_workers: 0,pytest_selection: testmon,count: 32, total 42.67sdevtools verify --quick-> exit 0, total 33.08s