Repository navigation
Fix: [for cherry-picking] Made nested baseline directory traversal dete - #208
qodo-code-review[bot] wants to merge 1 commit into
Conversation
|
Skipping PR review because a bot author is detected. If you want to trigger CodeAnt AI, comment |
Reviewer's GuideBaseline filesystem resolution now scans directories deterministically, prioritizes flat references over nested ones, and deduplicates variant files by configuration suffix. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
🏁 CodeAnt Quality Gate ResultsCommit: ✅ Overall Status: PASSEDQuality Gate Details
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="crates/bamts-verification/tests/types_facet_sampler.rs" line_range="188-190" />
<code_context>
- variants.push((suffix.to_owned(), entry.path()));
+ // A suffix identifies one configuration; retain the first
+ // occurrence so nested copies cannot make matching ambiguous.
+ if seen_variants.insert(suffix.to_owned()) {
+ variants.push((suffix.to_owned(), entry.path()));
+ }
}
</code_context>
<issue_to_address>
**issue (bug_risk):** `seen_variants` deduplicates only the raw suffix text, while `suffix_matches_options` treats option names, values, and option ordering case-insensitively. Equivalent variants such as `foo(target=ES5,module=commonjs).types` and `foo(module=commonjs,target=es5).types` therefore remain as two matches, causing the resolver to skip the intended match and fall back to an arbitrary lexicographic variant.
**Triggers:** When flat and nested baseline directories contain the same configuration encoded with different casing or option ordering.
**Suggested fix:** Canonicalize each suffix into a normalized option map before inserting it into `seen_variants`, or deduplicate the matching variants using the same normalization as `suffix_matches_options`.
```suggestion
let normalized_suffix: BTreeMap<String, String> = suffix
.split(',')
.filter_map(|part| {
let (key, value) = part.trim().split_once('=')?;
Some((
key.trim().to_ascii_lowercase(),
value.trim().to_ascii_lowercase(),
))
})
.collect();
if seen_variants.insert(normalized_suffix) {
variants.push((suffix.to_owned(), entry.path()));
}
```
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: crates/bamts-verification/tests/types_facet_sampler.rs:190
| if seen_variants.insert(suffix.to_owned()) { | ||
| variants.push((suffix.to_owned(), entry.path())); | ||
| } |
There was a problem hiding this comment.
issue (bug_risk): seen_variants deduplicates only the raw suffix text, while suffix_matches_options treats option names, values, and option ordering case-insensitively. Equivalent variants such as foo(target=ES5,module=commonjs).types and foo(module=commonjs,target=es5).types therefore remain as two matches, causing the resolver to skip the intended match and fall back to an arbitrary lexicographic variant.
Triggers: When flat and nested baseline directories contain the same configuration encoded with different casing or option ordering.
Suggested fix: Canonicalize each suffix into a normalized option map before inserting it into seen_variants, or deduplicate the matching variants using the same normalization as suffix_matches_options.
| if seen_variants.insert(suffix.to_owned()) { | |
| variants.push((suffix.to_owned(), entry.path())); | |
| } | |
| let normalized_suffix: BTreeMap<String, String> = suffix | |
| .split(',') | |
| .filter_map(|part| { | |
| let (key, value) = part.trim().split_once('=')?; | |
| Some(( | |
| key.trim().to_ascii_lowercase(), | |
| value.trim().to_ascii_lowercase(), | |
| )) | |
| }) | |
| .collect(); | |
| if seen_variants.insert(normalized_suffix) { | |
| variants.push((suffix.to_owned(), entry.path())); | |
| } |
Fixed Findings
Automated fix from agentic review of #207
Summary by Sourcery
Deduplicate baseline variants according to deterministic directory precedence during filesystem resolution.
Bug Fixes:
Enhancements:
Summary by cubic
Makes baseline directory traversal deterministic so duplicate nested variants no longer create ambiguous matches.
Written for commit 1afe0b4. Summary will update on new commits.