Skip to content

fix(files): restore CSV preview cancellation - #6596

Merged
icecrasher321 merged 2 commits into
stagingfrom
fix/csv-preview-reg
Aug 12, 2026
Merged

fix(files): restore CSV preview cancellation#6596
icecrasher321 merged 2 commits into
stagingfrom
fix/csv-preview-reg

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Restores CSV preview request cancellation and safely destroys storage streams when clients disconnect. Adds regression coverage for active and pre-aborted reads.

Type of Change

  • Bug fix

Testing

N/A

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedAug 12, 2026 4:44am

Request Review

@cursor

cursorBot commented Aug 12, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches shared withRouteHandler error classification used by internal and v2 JSON routes, plus storage stream lifecycle on abort. Well-covered by regression tests, but a misclassification would affect many endpoints.

Overview
Restores client-disconnect cancellation for CSV preview and shared JSON routes, so aborted reads return 499 instead of being treated as unhandled 500s.

withRouteHandler now classifies errors after request.signal abort as cancellations, with route-family envelopes for internal ({ error, requestId }) and v2 (CLIENT_CLOSED_REQUEST) responses. The CSV preview route forwards request.signal into getCsvPreviewSlice, which destroys storage streams on both pre-aborted and mid-read cancels.

Reviewed by Cursor Bugbot for commit 932a7d4. Configure here.

@greptile-apps

greptile-appsBot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restores cancellation propagation for CSV previews and adds route-family-specific 499 responses.

  • Threads the request signal through the CSV preview route and use case.
  • Destroys storage and parser streams when cancellation occurs.
  • Adds cancellation response handling to internal and v2 JSON routes.
  • Adds coverage for active and pre-aborted preview reads.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

FilenameOverview
apps/sim/lib/core/utils/with-route-handler.tsAdds centralized client-disconnect classification and route-specific 499 response rendering.
apps/sim/lib/file-parsers/csv-preview-slice.tsAdds abort checks, active-stream destruction, AbortError normalization, and listener cleanup.
apps/sim/app/api/workspaces/[id]/files/[fileId]/csv-preview/route.tsPropagates the incoming request signal into the CSV preview use case.
apps/sim/lib/api/server/routes/internal-json-route.tsDefines the internal API cancellation envelope with a request ID.
apps/sim/lib/api/server/routes/v2-json-route.tsDefines the v2 API cancellation error envelope.

Sequence Diagram

sequenceDiagram
participant Client
participant Route
participant Preview as CSV Preview
participant Storage
Client->>Route: GET preview
Route->>Preview: getCsvPreviewSlice(signal)
Preview->>Storage: acquire stream
Client--xRoute: disconnect
Route-->>Client: 499 cancellation response
Preview--xStorage: destroy stream
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

Comment threadapps/sim/lib/file-parsers/csv-preview-slice.ts
Comment threadapps/sim/lib/file-parsers/csv-preview-slice.ts
@icecrasher321

Copy link
Copy Markdown
CollaboratorAuthor

bugbot run

@icecrasher321

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 932a7d4. Configure here.

@icecrasher321
icecrasher321 merged commit a6ebfec into stagingAug 12, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/csv-preview-reg branch August 12, 2026 09:10
Sign up for freeto 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.

1 participant

@icecrasher321