fix: attach config to ConnectionError on pre-flight token expiry check#370
Conversation
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWhen the shell detects an expired token it now constructs a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
python/packages/jumpstarter-cli/jumpstarter_cli/shell_test.py (1)
1-19:⚠️ Potential issue | 🟡 MinorFix import ordering to pass linting.
The pipeline is failing due to ruff's
I001rule (import block is un-sorted or un-formatted). Runmake lint-fixto auto-fix, or manually reorder the imports.Proposed fix
import base64 import inspect import json import time from contextlib import asynccontextmanager from datetime import datetime, timedelta from unittest.mock import AsyncMock, Mock, patch import anyio import click import pytest -from jumpstarter_cli.shell import _resolve_lease_from_active_async, _shell_with_signal_handling, shell - -from jumpstarter_cli_common.exceptions import handle_exceptions_with_reauthentication - from jumpstarter.client.grpc import Lease, LeaseList from jumpstarter.config.client import ClientConfigV1Alpha1 from jumpstarter.config.env import JMP_LEASE +from jumpstarter_cli.shell import _resolve_lease_from_active_async, _shell_with_signal_handling, shell +from jumpstarter_cli_common.exceptions import handle_exceptions_with_reauthenticationAs per coding guidelines: "Use Ruff for code formatting and linting on all Python files except
jumpstarter-protocol, invoked viamake lintandmake lint-fix".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@python/packages/jumpstarter-cli/jumpstarter_cli/shell_test.py` around lines 1 - 19, The import block in shell_test.py is not sorted per ruff I001; reorder the imports into the standard groups and alphabetical order (stdlib, third-party, local) and/or run make lint-fix to auto-fix; specifically fix the ordering of imports such as base64, inspect, json, time, contextlib.asynccontextmanager, datetime/timedelta, unittest.mock (AsyncMock/Mock/patch), then third-party (anyio, click, pytest), then local module imports (from jumpstarter_cli.shell import _resolve_lease_from_active_async, _shell_with_signal_handling, shell; from jumpstarter_cli_common.exceptions import handle_exceptions_with_reauthentication; from jumpstarter.client.grpc import Lease, LeaseList; from jumpstarter.config.client import ClientConfigV1Alpha1; from jumpstarter.config.env import JMP_LEASE) so the file passes ruff linting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@python/packages/jumpstarter-cli/jumpstarter_cli/shell_test.py`:
- Around line 1-19: The import block in shell_test.py is not sorted per ruff
I001; reorder the imports into the standard groups and alphabetical order
(stdlib, third-party, local) and/or run make lint-fix to auto-fix; specifically
fix the ordering of imports such as base64, inspect, json, time,
contextlib.asynccontextmanager, datetime/timedelta, unittest.mock
(AsyncMock/Mock/patch), then third-party (anyio, click, pytest), then local
module imports (from jumpstarter_cli.shell import
_resolve_lease_from_active_async, _shell_with_signal_handling, shell; from
jumpstarter_cli_common.exceptions import
handle_exceptions_with_reauthentication; from jumpstarter.client.grpc import
Lease, LeaseList; from jumpstarter.config.client import ClientConfigV1Alpha1;
from jumpstarter.config.env import JMP_LEASE) so the file passes ruff linting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1ce68803-f8e2-4893-84c8-85fa453c8afa
📒 Files selected for processing (2)
python/packages/jumpstarter-cli/jumpstarter_cli/shell.pypython/packages/jumpstarter-cli/jumpstarter_cli/shell_test.py
The pre-flight token expiry check in _shell_with_signal_handling raised
a bare ConnectionError("token is expired") without attaching the client
config. When the re-auth handler called exc.get_config() it received
None, causing an AttributeError crash in relogin_client().
This was originally fixed in PR jumpstarter-dev#256 and accidentally reverted in
54ae7d5.
Fixes: jumpstarter-dev#162
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Assisted-by: claude-opus-4.6
ac508da to
0fdbc73
Compare
The pre-flight token expiry check in _shell_with_signal_handling raised a bare ConnectionError("token is expired") without attaching the client config. When the re-auth handler called exc.get_config() it received None, causing an AttributeError crash in relogin_client().
Fixes: #162