Skip to content

Resolve each relative filename against the source root that has it - #74

Merged
ANcpLua merged 2 commits into
mainfrom
fix/multi-root-file-resolution
Oct 13, 2026
Merged

ANcpLua merged 2 commits into
mainfrom
fix/multi-root-file-resolution

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Resolve each relative filename against the <source> root that contains it, instead of always the first one.

Problem

coverage.py with several source roots writes each file name relative to the root that contains it. DotCov prefixed every relative name with the first root. On python-sdk's report (roots src, src/mcp-types/mcp_types, tests), every test file and every mcp_types file got a wrong path, and every multi-root report carried the warning.

What changed

  • With two or more roots, a relative file name resolves against the one root under which the file exists on disk.
  • When it exists under none (a report read away from its sources) or under several, the first root applies and the report-scoped FileIdentityAmbiguous warning is raised, with the same text as before.
  • Single-root and root-less reports are unchanged.
  • README: one sentence in the Python section.

Verification

  • fallout Test: 1390 passed. fallout Coverage: line 100.0%, branch 100.0%.
  • New specs: each file resolves against its own root; a file under every root falls back with the warning; a no-op root beside a real root.
  • python-sdk's real report (414 files): 413 now resolve to existing paths. The remaining one, __init__.py, exists under two roots and keeps the warning.

🤖 Generated with Claude Code

coverage.py with several `source` roots names each file relative to the root
that contains it. DotCov prefixed every relative name with the first root, so
in a report with src/ and tests/ roots every test file got a wrong path, and
the multi-root warning fired for every such report.

With two or more roots, a relative filename now resolves against the one root
under which the file exists on disk. When it exists under none (a report read
away from its sources) or under several, the first root applies and the
report-scoped warning is raised, as before. Single-root and root-less reports
are unchanged.

On python-sdk's coverage.py report (three roots, 414 files), 413 files now
resolve to their real paths; the remaining one, __init__.py, exists under two
roots and keeps the warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 01:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T01:39:23.305608Z b9d70a1 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89dc9bc5b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

string? match = null;
foreach (var root in document.SourceRoots)
{
if (!File.Exists(JoinRoot(root, filename))) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject report-supplied network roots before probing

On Windows, a Cobertura document with multiple roots can supply \\host\share (normalized to //host/share) and a relative class filename, causing both Parse and ParseAsync to call File.Exists on an attacker-controlled UNC path. This can initiate outbound SMB access, potentially use ambient authentication, and stall parsing while the network request times out; cancellation cannot interrupt the synchronous probe. Avoid probing network roots by default, or require an explicitly trusted/caller-provided source resolver.

Useful? React with 👍 / 👎.

itsdangerous names tests as a second source root, and every measured file
exists under exactly one of the two, so DotCov now attributes each file without
the warning. The per-file comparison against coverage.py's native JSON still
proves the attribution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 01:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@ANcpLua
ANcpLua merged commit 2c6b00a into main Oct 13, 2026
28 checks passed
@ANcpLua
ANcpLua deleted the fix/multi-root-file-resolution branch October 13, 2026 01:39
@ANcpLua ANcpLua mentioned this pull request Oct 13, 2026
ANcpLua added a commit that referenced this pull request Oct 13, 2026
Set 2.0.0 as the package version, the badge action's default and the README's
action snippet and release-notes link, and add docs/releases/2.0.0.md. The
major version marks that the same report can now count differently: istanbul
line totals and coverage.py multi-root paths (#74, #76). The README's
migration section now covers 1.x and points 0.x users to the 1.0 notes.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants