fix(status): Set a non-zero exit code on both validation branches. Mer... (#984)#28
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(status): Set a non-zero exit code on both validation branches. Mer... (#984)#28aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
The status command's --type and --state validation branches rendered an error then bare-returned without setting a non-zero exit code, so scripts and CI under set -e could not detect a rejected filter (silent success on failure). Set process.exitCode = 1 on both branches before returning, which still lets cli.ts's finally cleanup run. Adds command.test.ts asserting exit code 1 for invalid --type and --state, and unset for a valid filter. Fixes aws#984
Coverage Report
|
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.
Refs aws#984
Issues
Root cause
In src/cli/commands/status/command.tsx the two argument-validation branches (--type lines 93-101, --state lines 104-112) render an error then bare-return without setting a non-zero exit code; withCommandRunTelemetry (cli-command-run.ts:94-136) only records telemetry and never exits, so parseAsync (cli.ts:174) resolves and Node exits 0. The real error paths at command.tsx:131/:165/:416 all call process.exit(1).
The fix
Set a non-zero exit code on both validation branches. Merge PR aws#1603 (process.exitCode = 1 before return, adds command.test.ts) — cleaner than a hard process.exit(1) because it lets cli.ts's finally cleanup run. Close PR aws#1169 (duplicate, uses process.exit(1), diff is stale against pre-aws#1317 file and will conflict).
Files touched: src/cli/commands/status/command.tsx — invalid
--typebranch (set exit signal after the render at line 99, before the return at line 100) and invalid--statebranch (after the render at line 110, before the return at line 111). Test: src/cli/commands/status/tests/command.test.ts (new, per PR aws#1603).Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.