Skip to content

Include target file paths in IO error messages for FASTA/Newick operations - #207

Draft
MattesMrzik with Copilot wants to merge 5 commits into
developfrom
copilot/add-file-paths-to-io-errors
Draft

MattesMrzik with Copilot wants to merge 5 commits into
developfrom
copilot/add-file-paths-to-io-errors

Conversation

Copilot AI commented Oct 27, 2026 •

Copy link
Copy Markdown

IO failures (e.g., missing file/invalid path) were surfaced without consistently identifying which path failed, making troubleshooting harder. This change makes file-path context explicit across core read/write IO flows.

  • Scope: path-aware IO errors

    • Added explicit map_err handling in src/io/mod.rs so Error::Io messages include the affected path for:
      • FASTA read (Reader::from_file)
      • FASTA write/create (Writer::to_file, write_record)
      • Newick read (fs::read_to_string)
      • Newick write/create (File::create, write_all)
  • Behavioral coverage

    • Updated IO tests to assert path inclusion in error messages for missing/bad-path cases.
    • Added nonexistent Newick-read coverage mirroring FASTA missing-file behavior.
let newick = fs::read_to_string(&path).map_err(|err| {
    Error::Io(format!(
        "failed to read newick file {}: {err}",
        path.as_ref().display()
    ))
})?;

Copilot AI linked an issue Oct 27, 2026 that may be closed by this pull request
Co-authored-by: MattesMrzik <35169243+MattesMrzik@users.noreply.github.com>
Copilot AI changed the title [WIP] Add file paths to IO errors when file not found Include target file paths in IO error messages for FASTA/Newick operations Oct 27, 2026
Copilot AI requested a review from MattesMrzik October 27, 2026 10:47
Co-authored-by: MattesMrzik <35169243+MattesMrzik@users.noreply.github.com>
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.90%. Comparing base (527040d) to head (37132c4).
⚠️ Report is 44 commits behind head on develop.

Files with missing lines Patch % Lines
phyne/src/io/mod.rs 90.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #207      +/-   ##
===========================================
+ Coverage    96.32%   96.90%   +0.58%     
===========================================
  Files           32       53      +21     
  Lines         4355     6564    +2209     
===========================================
+ Hits          4195     6361    +2166     
- Misses         160      203      +43     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

1 175 tests  +1   1 174 ✅ +1   29m 31s ⏱️ + 14m 42s
    5 suites ±0       1 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 37132c4. ± Comparison against base commit f76a766.

This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both.
src/io/mod.rs - io ‑ read_newick_from_file (line 136)
src/io/mod.rs - io ‑ write_newick_to_file (line 160)
src/io/mod.rs - io ‑ write_sequences_to_file (line 88)
io::tests ‑ reading_nonexistent_newick
src/io/mod.rs - io ‑ read_newick_from_file (line 133)
src/io/mod.rs - io ‑ write_newick_to_file (line 159)
src/io/mod.rs - io ‑ write_sequences_to_file (line 81)

♻️ This comment has been updated with latest results.

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.

Add file paths to io errors

2 participants