Skip to content

feat(cli): add instance rescue and rescue-exit commands#446

Open
aliel wants to merge 5 commits into
masterfrom
aliel-feat-cli-instance-rescue-mode
Open

feat(cli): add instance rescue and rescue-exit commands#446
aliel wants to merge 5 commits into
masterfrom
aliel-feat-cli-instance-rescue-mode

Conversation

@aliel

@aliel aliel commented Apr 17, 2026

Copy link
Copy Markdown
Member

No description provided.

@aliel
aliel requested a review from foxpatch-aleph April 17, 2026 23:47
@github-actions

Copy link
Copy Markdown

Failed to retrieve llama text: POST 503: {"error": "This CRN cannot host the requested workload at this time."}

@aliel
aliel force-pushed the aliel-feat-cli-instance-rescue-mode branch from 69e0cc8 to c5f490f Compare April 24, 2026 07:19
@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.44444% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.98%. Comparing base (b5746b0) to head (a9d62e3).

Files with missing lines Patch % Lines
src/aleph_client/commands/instance/__init__.py 44.44% 26 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
- Coverage   58.15%   57.98%   -0.17%     
==========================================
  Files          22       22              
  Lines        4368     4422      +54     
  Branches      661      672      +11     
==========================================
+ Hits         2540     2564      +24     
- Misses       1553     1579      +26     
- Partials      275      279       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The rescue and rescue-exit commands are well-structured and follow existing patterns. Error handling is appropriate, and the code integrates cleanly with the existing CLI. However, there are no tests for the new commands, and there is a minor issue with the default runtime selection logic that should be addressed.

pyproject.toml (line 33): Typo in comment: 'changement' is French for 'change'. Please use 'change' for consistency with the rest of the codebase.

pyproject.toml (line 40): Same typo: 'changement' should be 'change'.

src/aleph_client/commands/instance/__init__.py (line 1319): The default_idx defaults to 0 if no runtime has default=True. This means the user will select the first runtime by default even when none is marked as default. Consider either printing a warning or defaulting to -1 (requiring explicit selection) when no default is found.

src/aleph_client/commands/instance/__init__.py (line 1310): If both choose_runtime=True and rescue_hash is provided, the choose_runtime flag is silently ignored. Consider either raising an error for this conflicting input, or documenting the precedence more clearly in the help text.

tests/unit/test_instance.py (line 1): Missing test coverage for the new rescue and rescue-exit commands. Following the existing test patterns (e.g., test_stop_instance, test_reboot_instance), tests should cover: successful rescue/rescue-exit, error status codes (409, 501), and the choose_runtime interactive flow.

@aliel
aliel requested a review from foxpatch-aleph April 24, 2026 12:28
 - fix typo, default runtime warning if no default, add tests

@foxpatch-aleph foxpatch-aleph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The rescue and rescue-exit commands correctly implement the rescue workflow, and the tests cover the happy path. However, both commands have a genuine bug: error responses (409 Conflict, 501 Not Available) print a message but do not exit with a non-zero exit code, causing the shell to see success (exit code 0). This is misleading for shell scripting and automation.

src/aleph_client/commands/instance/__init__.py (line 1352): The 409 Conflict branch echoes the error but falls through to implicit return None (exit code 0). Add 'raise typer.Exit(code=1)' after the echo.

src/aleph_client/commands/instance/__init__.py (line 1354): The 501 'Rescue mode not available' branch echoes the error but falls through to implicit return None (exit code 0). Add 'raise typer.Exit(code=1)' after the echo.

src/aleph_client/commands/instance/__init__.py (line 1385): The 409 Conflict branch echoes the error but falls through to implicit return None (exit code 0). Add 'raise typer.Exit(code=1)' after the echo.

tests/unit/test_instance.py (line 1096): test_rescue_instance_conflict and test_rescue_instance_not_available should assert that typer.Exit(code=1) is raised, not just that the API method was called. Similarly, test_rescue_exit_instance should cover the 409 case with an exit code assertion.

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