Skip to content

feat: cancel() + stable error codes (#366)#370

Draft
plrthink wants to merge 4 commits into
masterfrom
cursor/cancel-error-codes-b7ed
Draft

feat: cancel() + stable error codes (#366)#370
plrthink wants to merge 4 commits into
masterfrom
cursor/cancel-error-codes-b7ed

Conversation

@plrthink

Copy link
Copy Markdown
Collaborator

Summary

Implements #366 (P0): cancelable operations and stable cross-platform error codes.

Depends on #369 (listContents / selective extract) — this branch is stacked on that work.

New API

  • cancel(): Promise<void> — best-effort abort of the in-flight operation
  • ErrorCodes map in JS (ERR_CANCELLED, ERR_WRONG_PASSWORD, ERR_UNSAFE_PATH, …)

Behavior

  • Android: atomic cancel flag checked between zip/unzip entries on the worker thread
  • iOS: cancel flag + SSZipArchiveDelegate abort for full unzip; selective extract / file-array zip check between entries
  • Rejections use stable error.code strings on both platforms (no more generic RNZipArchiveError / ad-hoc codes)

Test plan

  • npm test (36 tests)
  • Cancel mid-unzip on a large archive; promise rejects with ERR_CANCELLED
  • Wrong password maps to ERR_WRONG_PASSWORD
  • Zip Slip still maps to ERR_UNSAFE_PATH
Open in Web Open in Cursor 

cursoragent and others added 2 commits July 25, 2026 01:37
Expose listContents, unzipFiles, and unzipFilesWithPassword on iOS and
Android so apps can inspect archives and extract only selected entries
without switching to another library.

Co-authored-by: Perry <plrthink@gmail.com>
Allow aborting in-flight zip/unzip work and reject with consistent
ERR_* codes on iOS and Android, including ERR_CANCELLED.

Co-authored-by: Perry <plrthink@gmail.com>
cursoragent and others added 2 commits July 25, 2026 01:57
Co-authored-by: Perry <plrthink@gmail.com>
Co-authored-by: Perry <plrthink@gmail.com>
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