fix: expose conversionId in convert --async and add --timeout flag (#22)#25
Merged
Merged
Conversation
Print conversion_id to stderr immediately after runAsync and in each polling status update. Enrich timeout errors with the conversion_id so users can recover results later. Add --timeout flag (default 300s) to control polling duration for large documents. Closes #22 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the UX of docutray convert --async by making the async conversion identifier visible during polling and by adding a configurable polling timeout.
Changes:
- Print
conversion_idimmediately afterrunAsync()returns and include it in each polling status update (TTY + JSON to stderr). - Add
--timeout <seconds>(default 300) and pass it to the SDK.wait()as milliseconds. - Add tests for conversion id output, timeout propagation/default, and JSON polling status output; update help snapshot.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/commands/convert.ts | Adds --timeout, prints conversion id + status during async polling, and enriches polling errors. |
| test/commands/convert.test.ts | Adds new async-focused tests (conversion id output, timeout passed/default, JSON status output). |
| test/snapshots/help.test.ts.snap | Updates CLI help snapshot for the new --timeout flag and example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… tests - Remove redundant "(default: 300)" from --timeout description - Add min:1 validation to --timeout flag to reject 0/negative values - Only enrich timeout errors with conversionId; rethrow other errors intact to preserve statusCode/body/requestId for outputError() - Add TTY format test for conversion_id in stderr - Add test verifying non-timeout API errors are not wrapped Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
conversion_idto stderr immediately afterrunAsyncreturns (before polling starts) and in every polling status update--timeout <seconds>flag (default: 300) to control async polling duration, passed to SDK's.wait()in millisecondsconversion_idand recovery hint so users can check results later🔗 Related Issue
Closes #22 (bundles #8 and #10)
✅ Acceptance Criteria
conversion_idprinted to stderr immediately afterrunAsyncconversion_id⟳ Conversion <id>: <STATUS>{"conversionId":"<id>","status":"<STATUS>"}conversion_id--timeout <seconds>flag controls polling timeout (default: 300).wait()in milliseconds🧪 Testing
🤖 Generated with Claude Code