Skip to content

Separate functions for allowing/disallowing empty csv files#463

Merged
tsmbland merged 3 commits intomainfrom
empty_csv
Mar 21, 2025
Merged

Separate functions for allowing/disallowing empty csv files#463
tsmbland merged 3 commits intomainfrom
empty_csv

Conversation

@tsmbland
Copy link
Copy Markdown
Collaborator

@tsmbland tsmbland commented Mar 20, 2025

Description

read_csv was originally intended to disallow empty csv files, but this was lost somewhere along the way.

That said, there are some instances where we might want to allow empty csv files, such as agent_search_space if the user doesn't want to apply any search spaces.

I've created read_csv_optional to allow empty csv files, modified read_csv to disallow empty csv files, and put the shared code in _read_csv_internal.

So far only agent_search_space is using read_csv_optional. There are some other empty csv files (process_flow_share_constraints etc.) but I believe these aren't read in yet

Fixes #106

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.11%. Comparing base (cd7ea10) to head (7d7372f).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/input.rs 90.00% 0 Missing and 2 partials ⚠️
src/input/agent/search_space.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #463      +/-   ##
==========================================
- Coverage   95.13%   95.11%   -0.03%     
==========================================
  Files          32       32              
  Lines        4732     4751      +19     
  Branches     4732     4751      +19     
==========================================
+ Hits         4502     4519      +17     
  Misses        119      119              
- Partials      111      113       +2     

☔ View full report in Codecov by Sentry.
📢 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.

@tsmbland tsmbland marked this pull request as ready for review March 20, 2025 14:31
@tsmbland tsmbland requested a review from alexdewar March 20, 2025 14:31
Copy link
Copy Markdown
Member

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

I think it would be a bit cleaner to have _read_csv_internal return the Vec, then have the caller check whether it's empty or not. This is also ok though.

@tsmbland tsmbland enabled auto-merge March 21, 2025 08:29
@tsmbland tsmbland merged commit 55d7c49 into main Mar 21, 2025
7 checks passed
@tsmbland tsmbland deleted the empty_csv branch March 21, 2025 08:30
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.

Allow empty CSV files

2 participants