Skip to content

fix(search): stop penalising production modules named test_*.py - #107

Merged
ManSio merged 1 commit into
mainfrom
exp/test-bucket
Nov 10, 2026
Merged

ManSio merged 1 commit into
mainfrom
exp/test-bucket

Conversation

@ManSio

@ManSio ManSio commented Nov 10, 2026

Copy link
Copy Markdown
Owner

fix(search): stop penalising production modules named test_*.py

_bucket_penalty classifies by path, and any test_*.py was treated as a test
file and lost 2.0 rank on code questions. src/core/test_impact.py is a
production module - it predicts test impact - so its definitions were pushed
out of the answer: three tasks of the E66 panel failed there while a plain grep
found them.

Blast radius, measured: 926 tracked .py files, 271 match the path regex, 260 of
them are real tests (they define def test_* or import a test framework), and 1
production module is misclassified.

Outside tests/, a test_*.py now counts as a test only if its content says so.
Unreadable files keep the strict behaviour, so nothing becomes more permissive by
accident. MSCODEBASE_TEST_BUCKET=path restores the old rule as a rollback.

Measured (3 affected + 41 anchors + 40 sampled positives, 3 repeats, majority):

T1 affected fixed (any@8)        3/3     PASS
T2 anchors not worse             21/41 vs 21/41
T3 sampled positives not worse   40/40 vs 40/40
T4 identical on unrelated tasks  PASS

Targeted re-check of the load-bearing claim, 3 repeats per task per arm:
path 0/9, content 9/9 top-1 on risk_level, module_of, referenced_modules.

`_bucket_penalty` classifies by path, and any `test_*.py` was treated as a test
file and lost 2.0 rank on code questions. `src/core/test_impact.py` is a
production module - it *predicts* test impact - so its definitions were pushed
out of the answer: three tasks of the E66 panel failed there while a plain grep
found them.

Blast radius, measured: 926 tracked .py files, 271 match the path regex, 260 of
them are real tests (they define `def test_*` or import a test framework), and 1
production module is misclassified.

Outside `tests/`, a `test_*.py` now counts as a test only if its content says so.
Unreadable files keep the strict behaviour, so nothing becomes more permissive by
accident. `MSCODEBASE_TEST_BUCKET=path` restores the old rule as a rollback.

Measured (3 affected + 41 anchors + 40 sampled positives, 3 repeats, majority):

    T1 affected fixed (any@8)        3/3     PASS
    T2 anchors not worse             21/41 vs 21/41
    T3 sampled positives not worse   40/40 vs 40/40
    T4 identical on unrelated tasks  PASS

Targeted re-check of the load-bearing claim, 3 repeats per task per arm:
`path` 0/9, `content` 9/9 top-1 on risk_level, module_of, referenced_modules.
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a75a083e-4b44-4bb0-bac2-1013e430bb52
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ManSio
ManSio merged commit 092418a into main Nov 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant