Skip to content

test: assert the suffix-distinct module names, not merely that they differ - #1436

Open
vitali87 wants to merge 6 commits into
mainfrom
test/suffix-names-not-just-distinct
Open

test: assert the suffix-distinct module names, not merely that they differ#1436
vitali87 wants to merge 6 commits into
mainfrom
test/suffix-names-not-just-distinct

Conversation

@vitali87

@vitali87 vitali87 commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary

test_same_stem_with_different_suffixes_stays_separate asserted only that docs/guide.md and docs/guide.markdown produce two distinct qualified names. That is the same predicate the fix under test establishes, so the test could not fail for any reason the fix would cause.

A rule that mangled the stem — prefixing it, truncating it, hashing it — would still produce two different names and pass.

Verified the test now catches that

Deliberately mangled the stem in flat_module.py (guide_mdXXguide_md) and re-ran:

before: passes  (two distinct names, both wrong)
after:  FAILS   (names do not match the expected values)

Now asserts the actual qualified names each file receives, and the Section qns rooted under them.

Why this shape is worth watching for

The property I had in mind when writing the fix was uniqueness, so uniqueness was the property I tested. A test written from the same premise as the fix inherits its blind spots — it can only fail in ways the author already conceived of.

Credit to the fix-doc-qualified-name session, which found the identical shape in its own collision tests for #1429 and flagged the pattern.

Test Plan

  • 34 tests pass in test_document_tier.py.
  • Confirmed the strengthened assertion fails against a deliberately mangled stem, which the uniqueness-only form accepted.

Type of Change

  • Test updates

Summary by CodeRabbit

  • Tests
    • Added coverage for consistent qualified names when headings contain extra whitespace.
    • Added coverage for untitled headings, ensuring they receive a clear placeholder name.
    • Strengthened validation for files sharing the same name but using different extensions, including their module and section names.

The suffix collision test checked only distinctness, which is the same
predicate the fix establishes: a rule that mangled the stem would still
produce two different names and pass. Now asserts the qualified names
each file actually receives. Verified it fails against a deliberately
mangled stem, which the uniqueness-only form accepted.
@vitali87 vitali87 added the claimed An agent/session is actively working this — check before taking it over label Aug 25, 2026
@vitali87

Copy link
Copy Markdown
Owner Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 10 minutes.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e0c6cc56-566e-41ce-9650-77ce98f7eecd

📥 Commits

Reviewing files that changed from the base of the PR and between 73c9747 and 865043e.

📒 Files selected for processing (1)
  • codebase_rag/tests/test_document_tier.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 54f084ce-010d-47df-a58d-bc10ed1ab589

📥 Commits

Reviewing files that changed from the base of the PR and between 4e45c74 and 73c9747.

📒 Files selected for processing (1)
  • codebase_rag/tests/test_document_tier.py
💤 Files with no reviewable changes (1)
  • codebase_rag/tests/test_document_tier.py

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The document-tier tests now cover heading whitespace normalization, empty-heading placeholders, and exact qualified names for files with different suffixes.

Changes

Document tier test validation

Layer / File(s) Summary
Qualified-name assertions
codebase_rag/tests/test_document_tier.py
The tests verify collapsed whitespace in qualified names, preserved display-name spacing, (untitled) for empty headings, and exact module and section qualified names for .md and .markdown files.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 73c97

This localized test-only change strengthens assertions for suffix-distinct module names without changing product behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: strengthening the suffix-distinct module-name test to assert exact names.
Description check ✅ Passed The description explains the test weakness, the strengthened assertions, the deliberate failure check, and the test results. It includes Summary, Test Plan, and Type of Change sections. Related Issues…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the test weakness, the strengthened assertions, the deliberate failure check, and the test results. It includes Summary, Test Plan, and Type of Change sections. Related Issues and Checklist sections are missing, but the description is otherwise complete.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/suffix-names-not-just-distinct

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

Comment @coderabbitai help to get the list of available commands.

Found by mutation rather than inspection: replacing the whitespace
collapse with a plain strip, and dropping the (untitled) fallback, both
left all 34 tests passing. Two deliberate documented behaviours that
nothing actually held in place.

Killing a mutant does not require conceiving of the failure mode first,
which is what makes it catch the case where a test was written from the
same premise as the code.
@vitali87

Copy link
Copy Markdown
Owner Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR strengthens document-tier tests by asserting exact qualified names and adds separate coverage for whitespace normalization, multiline setext headings, and untitled headings.

  • Verifies suffix-distinct files receive the expected module and section qualified names.
  • Exercises multiline heading normalization through the production parsing path.
  • Confirms empty headings receive the (untitled) placeholder.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
codebase_rag/tests/test_document_tier.py Strengthens qualified-name assertions and correctly addresses the prior concern by testing a genuinely multiline setext heading.

Reviews (4): Last reviewed commit: "test: exercise a heading whose text real..." | Re-trigger Greptile

Another mutation survivor: flipping the default to True passed all 45
tests. The opt-in-ness is the whole reason the ast-grep tier's names are
unchanged by #1428 — an argument I made in review and nothing enforced.

Ruby still yields <project>.app, not app_rb. Changing that is #1429's
job, deliberately and with its own review.
@vitali87

Copy link
Copy Markdown
Owner Author

@greptileai review

Comment thread codebase_rag/tests/test_document_tier.py Outdated
The comment claimed the test protected identity for a heading reflowed
across lines, but the fixture was one physical line with repeated
spaces — it exercised space collapsing, not reflow. A setext heading's
text genuinely spans lines, so that case now has its own test: the
display name keeps the newline, the qualified name collapses it.
@vitali87

Copy link
Copy Markdown
Owner Author

@greptileai review

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claimed An agent/session is actively working this — check before taking it over

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant