Skip to content

Fix CSV exports rejecting valid large fields - #54

Merged
mohsen1 merged 1 commit into
prooflinedev:mainfrom
veliunusdu:fix/large-csv-export-fields
Nov 17, 2026
Merged

mohsen1 merged 1 commit into
prooflinedev:mainfrom
veliunusdu:fix/large-csv-export-fields

Conversation

@veliunusdu

Copy link
Copy Markdown

CSV exports currently reject valid cells larger than Python's default 131,072-character field limit, even when the response is well below the SDK's 8 MiB limit. For example, a synthetic findings export containing a 150,000-character claim raises urn:proofline:sdk:invalid-response in both clients, while the equivalent NDJSON page succeeds. This affects consumers exporting verbose findings or large JSON-valued cells. The bundled finding schema has no maxLength on claim or impact; the reproduction uses a loopback server, not evidence of hosted API output.

The fix adds a private parser for the existing CSV dialect, preserving quoted commas, doubled quotes, Unicode, embedded CR/LF, empty cells, and EOF behavior. It avoids changing csv.field_size_limit(), which would affect unrelated readers in the caller's process. The decoder retains header/row validation, raw response text, string cells, metadata, and typed errors, and enforces the existing 8 MiB byte bound when called directly. Public signatures, generated code, and the API contract are unchanged.

Validation on Windows / CPython 3.14.3:

  • Full python scripts/check.py: 162 passed, 8 subtests passed, generation and contracts, Ruff lint/format, mypy, wheel/sdist builds, and installed-artifact sync/async HTTP smoke tests.
  • Focused CSV/export suite: 28 passed. Covers both public clients, large quoted Unicode fields, response bounds, malformed quoting, duplicate headers, inconsistent row widths, and concurrent decoding without changing global parser settings.
  • Small CSV inputs are compared against csv.reader(strict=True) in an automated compatibility test. An independent AI-assisted review also compared 150,000 randomized inputs without finding a difference.
  • Original reproduction now preserves all 131,072-, 131,073-, and 150,000-character CSV/NDJSON claims through both clients. Before the fix, larger CSV cases failed; direct regression tests were also observed failing before implementation.

To reproduce the regression tests:

python scripts/check.py --prepare
.venv/bin/python -m pytest tests/test_exports.py tests/test_http.py -k 'export or csv' -q

On Windows use .venv/Scripts/python.exe; install the bootstrap's pinned uv 0.13.7 first if it is not already on PATH.

Proofline review: fork PR #1, hosted review, run 1, completed on 16 November 2026. The checksum-verified Windows CLI 0.2.16 retrieved the automatic review using proofline review --repo veliunusdu/sdk-python --pr 1 --json. Its recorded code assessment is COMPLETED, with incompleteness_kind: null and zero findings, for head 399d4452acd0919b44949668347e15bc2569cda8 against base 0b08aa6388193efd0a6ee45c1675dba1fb70a624. The pushed branch still matches that reviewed head.

Feedback decisions: no findings were returned, so none were accepted or rejected and no review-driven changes were made. I retained the tested fix. This was a code-only review without a linked cloud environment; zero findings does not establish that every possible defect was excluded.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@mohsen1
mohsen1 merged commit e4fd8fa into prooflinedev:main Nov 17, 2026
1 of 2 checks passed
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.

3 participants