Repository navigation
Conversation
process_csv took the CSV header from output_rows[0]. When every run in the
task group failed, run_tasks returned an empty list, so enrichment crashed with
IndexError ("Error during enrichment: list index out of range") after the runs
were billed, and the target file had already been truncated to zero bytes.
Build the header from the input and output models when there are no rows, so
the target is a valid header-only CSV, matching the JSON processor, which
writes [] in the same case.
This branch has not been deployed
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.
Fixes #195
enrich runwith a CSV target crashed withIndexError: list index out of rangewhen no run in the task group returned a row (every run failed, or every output failed validation).process_csvtook the header fromoutput_rows[0], butrun_tasksreturns[]in that case. The crash came after the runs were billed, and the target, already opened for writing, was left empty.Fix: when there are no rows, build the header from the input and output models plus
batch_idandinsertion_timestamp, in the same orderrun_tasksbuilds its rows, so the target is a valid header-only CSV (as the JSON processor writes[]). Runs that return rows are unchanged.Files:
parallel_web_tools/processors/csv.py(+5/−1),tests/test_enrichment.py(newTestProcessCsv, stubbing the SDK client asTestRunTasksdoes, with one failed run).How tested: the new test fails on main with the IndexError and passes with the fix.
uv run ruff check .,uv run ruff format --check .,uv run tach checkanduv run ty checkare clean;uv run pytest -qgives 1033 passed (1032 on main). Merges cleanly with the open PRs, including #189, which also editsprocessors/csv.py.Not in this PR: the DuckDB processor fails the same way on an empty result (
pl.DataFrame([])has no columns). Happy to follow up.