Commit 7c675c1
authored
fix(api,robot-server): let CSVParameter dialect sniffer see entire CSV file (#20245)
# 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 the `csv.Sniffer`. If
that chops up a line at an inopportune place, it would cause the sniffer
to fail with `Could 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 `edge`
rather 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.1 parent 6e2f037 commit 7c675c1
File tree
2 files changed
+31
-1
lines changed- api
- src/opentrons/protocols/parameters
- tests/opentrons/protocols/parameters
2 files changed
+31
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
48 | 65 | | |
49 | 66 | | |
50 | 67 | | |
| |||
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
105 | 135 | | |
106 | 136 | | |
107 | 137 | | |
| |||
0 commit comments