Skip to content

feat(cli): argument errors, run timeout, signal cancellation, and version resolution - #137

Merged
udoyechinenyevictoria merged 2 commits into
Esureorg:mainfrom
linesofcodes0-cloud:feat/esure-batch-54-55-56-57
Oct 22, 2026
Merged

udoyechinenyevictoria merged 2 commits into
Esureorg:mainfrom
linesofcodes0-cloud:feat/esure-batch-54-55-56-57

Conversation

@linesofcodes0-cloud

Copy link
Copy Markdown
Contributor

Summary

This pull request addresses issues #54, #55, #56, and #57 in esure-cli:

  1. Structured JSON Argument Errors (CLI: make argument errors conform to JSON output mode #54):

    • CLI argument errors (unknown commands, missing file paths/scenario IDs, invalid options) now emit a structured JSON error envelope ({"error": {"code": "INVALID_ARGUMENT", "message": "..."}}) on stderr when --output json or -o json is requested.
    • Successful command outputs, exits, and human diagnostics remain clean and uncontaminated.
  2. Bounded Overall Run Timeout (CLI: add a bounded overall run timeout #55):

    • Added validated --timeout-ms <ms> option with a default of 120,000ms and bounded between 1ms and 600,000ms.
    • Wired AbortSignal to gateway execution to cancel pending work on timeout.
    • Returns a structured RUN_TIMEOUT error in JSON and human modes, and ensures timeout timers are cleaned up on all exit paths.
  3. Graceful SIGINT and SIGTERM Cancellation (CLI: handle SIGINT and SIGTERM with graceful run cancellation #56):

    • Installed scoped signal handlers for active run and suite executions.
    • Aborts ongoing operations via AbortSignal and emits concise cancellation output without leaking raw errors.
    • Uses standard exit codes (130 for SIGINT, 143 for SIGTERM).
    • Cleans up process listeners in finally blocks to prevent listener leaks.
  4. Package Metadata Version Resolution (CLI: derive --version from package metadata #57):

    • --version resolves the version dynamically by locating the nearest @esure/cli package.json metadata relative to module location.
    • Works outside the repository root without network calls.

Closes #54
Closes #55
Closes #56
Closes #57

…olution

Resolve issues Esureorg#54, Esureorg#55, Esureorg#56, and Esureorg#57 in the ESURE CLI:
- Return structured JSON error envelopes on stderr for CLI argument errors
- Add bounded --timeout-ms option wired to gateway execution via AbortSignal
- Gracefully handle SIGINT and SIGTERM with documented exit codes 130 and 143
- Dynamically resolve package version from package.json metadata
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@linesofcodes0-cloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

@linesofcodes0-cloud is attempting to deploy a commit to the Favour Chigozirim's projects Team on Vercel.

A member of the Team first needs to authorize it.

@udoyechinenyevictoria
udoyechinenyevictoria merged commit f16931e into Esureorg:main Oct 22, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants