fix(cli): read run-workflow-csv inputs as strings to preserve leading zeros - #174
Open
salapenar-max wants to merge 4 commits into
Open
salapenar-max wants to merge 4 commits into
salapenar-max wants to merge 4 commits into
Conversation
… zeros
pd.read_csv() inferred numeric dtypes, so a string-typed input like a zip
code "01234" was read as int 1234 and stringified to "1234" (leading zero
lost); mixed columns became floats ("1002" -> "1002.0"). That corrupted
value is substituted into the workflow, so forms get filled with the wrong
identifier.
Read with dtype=str so string inputs keep their exact text. The per-field
type conversion still coerces number/bool inputs, and empty cells remain
NaN so required-field validation is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…rsion Address review on browser-use#174: - dtype=str alone still let pandas' default NA detection turn literal cells like "NA" (Namibia country code) or "null" into NaN. Read with keep_default_na=False and na_values=[''] so only empty cells are missing (pd.isna); string inputs keep their exact text. - Extract the CSV load + per-field conversion into workflow_use/csv_inputs.py so the regression test exercises the real code, not a mirror. - Give the test a __main__ runner and add it to tests/run_all_tests.py so the repo's harness actually executes it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
… result Address review round 2 on browser-use#174: - keep_default_na=False also kept literal "NA"/"null" in numeric fields, so an optional numeric NA hit float() -> the conversion-failure path. Add is_missing(value, field_type): NA tokens are missing for number/bool fields (restoring pre-change behaviour) but literal text for string fields (NA = Namibia). - Add failure_type to the input-validation failure results so the sequential runner's result['failure_type'] check no longer KeyErrors on them. - Fix import order (ruff isort I001): workflow_use.csv_inputs between controller and healing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
Address review round 3 on browser-use#174: the new 'input_validation' failure_type was not taught to the run_workflow_csv summary, so empty-required-cell / bad-value rows printed as generic 'Other failures' with no guidance. Treat input_validation like form_validation in the breakdown label and the 'check CSV data' recommendation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
run-workflow-csvloads the input CSV withpd.read_csv(csv_path)(default dtype inference), and_execute_single_workflowthen doesstr(raw_value)for astring-typed input. When pandas infers a numeric dtype, string identifiers are corrupted:01234→ int641234→"1234"(leading zero lost)00089→"89"1002,1002.0) → float64 →"1002.0"The corrupted value is then substituted into the workflow's
{placeholders}, so forms get filled with the wrong identifier (zip, phone, SKU, account number, …). It fails silently — no error is raised.Fix
Read the CSV with
dtype=strso string inputs keep their exact text. The existing per-field conversion still coercesnumber/boolinputs (float(...), truthy parse), and empty cells remainNaN, so thepd.isna(...)required-field check is unchanged.Test
Adds
workflows/tests/test_run_workflow_csv_string_dtype.py: string fields keep leading zeros; number/bool fields still convert; an empty required cell is still detected as missing.Note
Prepared with AI assistance and verified locally against the current default branch.
🤖 Generated with Claude Code
Summary by cubic
Fixes
run-workflow-csvsilently corrupting string-typed inputs like zip codes (01234→1234) because pandas inferred numeric dtypes and applied default NA detection. Reads the CSV withdtype=str,keep_default_na=False, andna_values=['']so string inputs keep exact text; number/bool fields still convert, and empty required cells are still detected as missing.NA(country code) ornullstay string text for string fields, but count as missing for number/bool fields.failure_typeand show in the run summary as form validation with "check CSV data" guidance, instead of KeyErroring or printing as generic failures.workflow_use/csv_inputs.pyfor unit-testability; addstest_run_workflow_csv_string_dtype.pywith a__main__runner, registered intests/run_all_tests.py.Written for commit 1ceb716. Summary will update on new commits.