Skip to content

Conversation

@shbhmexe
Copy link

This PR addresses inconsistent error handling in authentication commands and removes deprecated code past its removal deadline. We've encountered recurring issues where direct process.exit() calls cause CI/CD pipelines to hang, as documented in #1144 and #1149 . The fix involves consistently using the exitGracefully() utility across all auth-related commands.

The core change updates exitGracefully() to accept custom exit codes, as it previously only supported exit code 0. We replaced 5 direct process.exit() calls with exitGracefully() across auth.ts, login.ts, logout.ts, and index.ts. Additionally, we removed the deprecated --login and --logout options from the auth command, which were scheduled for removal after September 2025.

This change affects 6 files total. The exit-gracefully utility now supports custom exit codes while maintaining backward compatibility. All authentication commands now use standardized error handling. We added 2 new test cases specifically for exit code functionality, bringing the total to 12 passing tests. TypeCheck passes with no errors, and the build succeeds without issues.

Note that there are 5 pre-existing test failures on Windows related to path separator issues in buckets.spec.ts and find-locale-paths.spec.ts. These failures are unrelated to our changes and exist in the main branch.

This represents Phase 1 of standardizing error handling across the CLI as outlined in ISSUE_ERROR_HANDLING.md. It focuses on high-priority auth commands and establishes a foundation for similar improvements in config, show, and run commands. The changes prevent CI/CD pipeline hangs, make commands easier to test, remove technical debt, and establish a consistent error handling pattern.

Related to: #1144, #1149,

- Replace direct process.exit() calls with exitGracefully() in auth, login, logout commands
- Remove deprecated --login and --logout options from auth command (past Sept 2025 deadline)
- Update exitGracefully() to support custom exit codes for error scenarios
- Add comprehensive tests for new exit code parameter
- Improve CI/CD reliability by using graceful exit utility consistently
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR standardizes error handling across authentication commands by replacing direct process.exit() calls with the exitGracefully() utility, which properly waits for pending async operations before exiting. The changes also remove deprecated --login and --logout options from the auth command that were past their September 2025 removal deadline.

Key changes:

  • Enhanced exitGracefully() to accept custom exit codes while maintaining backward compatibility
  • Replaced 5 direct process.exit() calls with exitGracefully() across auth-related commands
  • Removed deprecated command-line options and their warning logic from auth.ts

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/cli/src/cli/utils/exit-gracefully.ts Updated function signature to accept exitCode parameter with default value of 0
packages/cli/src/cli/utils/exit-gracefully.spec.ts Added two new test cases for custom exit codes and updated existing tests to use new parameter order
packages/cli/src/cli/index.ts Replaced process.exit() calls with exitGracefully() in error handler
packages/cli/src/cli/cmd/logout.ts Replaced process.exit(1) with exitGracefully(1) in error handler
packages/cli/src/cli/cmd/login.ts Replaced process.exit(1) with exitGracefully(1) in error handler
packages/cli/src/cli/cmd/auth.ts Removed deprecated --login and --logout options and replaced process.exit(1) with exitGracefully(1)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shbhmexe shbhmexe closed this by deleting the head repository Nov 16, 2025
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.

1 participant