Skip to content

rank: basename test files (tests.zig, *_tests.zig) dodge the test-path penalty #580

@justrach

Description

@justrach

Problem

rerankSignalScore's test penalty checks only DIRECTORY segments (pathHasSegment 'test'/'tests'), so test files identified by basename — src/tests.zig, src/adversarial_tests.zig, src/test_*.zig — receive no penalty in the scan-rerank path. Live: codedb search snapshot ranks src/tests.zig at file-rank 3, above non-test source. BM25's pathRelevanceMultiplier already handles this (startsWith(base,\"test\") / indexOf(base,\"_test\")); the two scorers should agree.

Failing Test

In src/test_search.zig (named after this issue once assigned): a denser-mentioning src/zz_tests.zig must rank below src/owner.zig for a concept query. Fails red on release/0.2.5825 (test file first).

Fix

Extend the penalty condition in rerankSignalScore with the same basename checks BM25 uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p2Medium priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions