Skip to content

Fix coverage region parsing for filenames with spaces - #4936

Merged
feliperodri merged 2 commits into
model-checking:mainfrom
wodex1nhaoIeng:codex/fix-4838-coverage-paths
Oct 2, 2026
Merged

feliperodri merged 2 commits into
model-checking:mainfrom
wodex1nhaoIeng:codex/fix-4838-coverage-paths

Conversation

@wodex1nhaoIeng

Copy link
Copy Markdown
Contributor

Coverage region parsing currently splits on whitespace, so a source filename such as a a.rs makes kani autoharness --coverage panic at blank_splits[1] == "-".

Parse the region separator and starting line/column from the right, preserving the complete filename. Add parser unit tests for spaces, repeated colons and - in filenames, plus a coverage UI regression using a module named a a.rs.

Resolves #4838.

Validation

  • Reproduced the original panic before the fix. After the fix, the issue's original code and command (kani autoharness -Zautoharness --coverage -Zsource-coverage a.rs) exit successfully and report a a.rs (a::c) as covered.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Parse coverage region delimiters from the right to preserve filenames containing whitespace, colons, and separator text. Add parser unit tests and a coverage UI regression for issue model-checking#4838.
@wodex1nhaoIeng
wodex1nhaoIeng requested review from a team as code owners October 1, 2026 10:16
@feliperodri feliperodri self-assigned this Oct 1, 2026
@feliperodri
feliperodri requested a balanced review from Copilot October 1, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: None

What changed in this PR

Fixes CoverageRegion parsing so coverage output can be parsed when source filenames contain spaces (and other tricky substrings), preventing kani autoharness --coverage panics and adding regressions tests for the reported case (#4838).

Changes:

  • Update CoverageRegion::from_str to parse from the right (preserving filenames with spaces/colons/-).
  • Add unit tests covering multiple tricky filename shapes.
  • Add a UI coverage regression test using an auxiliary module file named a a.rs.
File Description
tests/​ui/​coverage-spaces/​test.rs New UI test that compiles/executes coverage with a module path containing spaces.
tests/​ui/​coverage-spaces/​expected Expected coverage output asserting a a.rs is reported and parsed correctly.
tests/​ui/​coverage-spaces/​auxiliary/​a a.rs Auxiliary module source file whose filename contains a space.
kani-driver/​src/​coverage/​cov_results.rs Implements right-to-left parsing and adds parser unit tests for edge-case filenames.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@feliperodri feliperodri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving. Splitting from the right fixes it at the source. I checked it against real files named a a.rs, a - b.rs and x:y z.rs, and against the issue's autoharness command. All report correct coverage, and main panics on the first. One suggestion inline: keep the input in the panic message.

Comment thread kani-driver/src/coverage/cov_results.rs Resolved
Comment thread kani-driver/src/coverage/cov_results.rs Resolved
@feliperodri
feliperodri enabled auto-merge October 2, 2026 19:47
@feliperodri
feliperodri added this pull request to the merge queue Oct 2, 2026
Merged via the queue into model-checking:main with commit 9adc0de Oct 2, 2026
33 checks passed
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.

panic: assertion failed: blank_splits[1] == "-"

3 participants