Summary
collect_rstest_companion_test_functions in src/hir/mod.rs marks functions as test-context based on companion-module detection heuristics, but emits no logging, diagnostics, or spans when it does so. Maintainers cannot observe which functions were marked, which qualification path was taken, or detect false positives at runtime.
Problem
Adding unconditional per-function diagnostic notes (e.g. via cx.span_note()) would be prohibitively verbose in normal use. However, the absence of any observability makes it difficult to:
- Diagnose false positives or false negatives in companion-module detection.
- Validate that the correct qualification path (descriptor-only, fn/const pair, etc.) was taken for a given function.
- Investigate CI failures where a lint fires or is silenced unexpectedly.
Proposed resolution
Add an opt-in debug diagnostic mode, gated on either an environment variable (e.g. WHITAKER_DEBUG_COMPANION_DETECTION=1) or a dylint.toml configuration key. When enabled:
- Emit an info-level note for each function marked as test-context, including the function name, module path, and which qualification pattern matched.
- Emit a debug-level note for edge cases (empty candidate modules, modules with no harness items, false-positive sibling modules that were rejected).
- Optionally, warn when a module's item count exceeds a configurable threshold (e.g. ~100 items per scope) to surface the O(n²) complexity concern tracked by issue #225.
Context
Identified during review of PR #221. The companion-module detection heuristic and its acknowledged false-positive risks are documented in docs/developers-guide.md under Regression infrastructure → Test-context ancestry detection.
Raised by @leynos.
Summary
collect_rstest_companion_test_functionsinsrc/hir/mod.rsmarks functions as test-context based on companion-module detection heuristics, but emits no logging, diagnostics, or spans when it does so. Maintainers cannot observe which functions were marked, which qualification path was taken, or detect false positives at runtime.Problem
Adding unconditional per-function diagnostic notes (e.g. via
cx.span_note()) would be prohibitively verbose in normal use. However, the absence of any observability makes it difficult to:Proposed resolution
Add an opt-in debug diagnostic mode, gated on either an environment variable (e.g.
WHITAKER_DEBUG_COMPANION_DETECTION=1) or adylint.tomlconfiguration key. When enabled:Context
Identified during review of PR #221. The companion-module detection heuristic and its acknowledged false-positive risks are documented in
docs/developers-guide.mdunder Regression infrastructure → Test-context ancestry detection.Raised by
@leynos.