Skip to content

fix: return CSV output when a PDF isn't split - #185

Merged
CyMule merged 1 commit into
mainfrom
fix/unsplit-csv
Oct 7, 2026
Merged

CyMule merged 1 commit into
mainfrom
fix/unsplit-csv

Conversation

@CyMule

@CyMule CyMule commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What

partition with CSV output now returns the CSV whenever the PDF isn't actually split.

partition({ files: report.txt, splitPdfPage: true }, { acceptHeaderOverride: "text/csv" })

Before: SyntaxError: Unexpected token 'y', "type,text..." is not valid JSON
After:  "type,text\nTitle,Hello\n"

Why

The split-PDF hook ran on every response and tried to merge it as JSON, even when no split happened: splitting off, a non-PDF file, or a PDF too small to split. A CSV body can't be read as JSON, so the call failed. The hook now passes the response through untouched when there was no split. Real splits behave as before.

Validation

Tests call the public client for CSV with splitting off, a non-PDF file, and a one-page PDF, plus JSON output and two operations running at once. All 35 unit tests pass.

@CyMule
CyMule marked this pull request as ready for review October 7, 2026 15:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T15:45:16.629980Z a5acfc9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 2 files

Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.

View guided diff | Re-trigger cubic

@CyMule CyMule changed the title Return CSV responses when PDF splitting is skipped fix: return CSV output when a PDF isn't split Oct 7, 2026

@cragwolfe cragwolfe 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.

Oracle Pro review of exact head a5acfc9a8c87d189107d0bfea6b921e61af69e25.

No concrete actionable defects introduced by this change were found. I verified the operation-specific guard against request IDs, split state, the success-hook dispatcher, and JSON/CSV response parsing. Unsplit responses now pass through without cloning or consuming their bodies, while actual split requests keep the aggregation and cleanup path, including zero-success results. The checked-in tests cover the three CSV cases, JSON output, overlapping operation state, and zero-success aggregation.

One low-severity coverage improvement: the overlap test injects hook state directly. A simultaneous public-client split request and unsplit CSV request would give stronger integration coverage of independent completion and downstream hooks. This is not a merge prerequisite. Existing request buffering and instance-wide allowFailed behavior are unchanged by this PR.

Exact-head CI: unit and integration tests, CodeQL and reported security checks succeeded. No local repository tests were run. Oracle's completed original browser conversation returned SAFE TO MERGE; Pro was verified before submission and during processing. CLI capture failed to recognize the submitted prompt, so the full completed response was retained from that same browser conversation.

(authored by codex)

@CyMule
CyMule merged commit a50e288 into main Oct 7, 2026
11 checks passed
@CyMule
CyMule deleted the fix/unsplit-csv branch October 7, 2026 20:16
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.

2 participants