fix(api,robot-server): let CSVParameter dialect sniffer see entire CSV file #20245
+31
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
A customer reported that a parameterized protocol works with a short CSV file but fails with their longer CSV file: https://opentrons.slack.com/archives/C389UCULX/p1763376654727119
The root cause seems to be that in
parse_as_csv(), we were truncating the CSV file to 1024 bytes before passing it to thecsv.Sniffer. If that chops up a line at an inopportune place, it would cause the sniffer to fail withCould not determine delimiter.We should just pass the whole CSV file to the sniffer.
From our meeting this morning, we said we would fix this in
edgerather than trying to get it into RS 8.8.0.Test Plan and Hands on Testing
Added a test case with a long CSV file derived from the customer report.
Risk assessment
Low.
I guess there's a small risk that there could be some horrifying junk in the CSV file after the first 1024 bytes, that the sniffer previously wouldn't see, that would now be visible to the sniffer. But I think overall, it's more correct to let the sniffer see the whole file, rather than arbitrarily cutting it off at 1024 bytes.