Skip to content

build(deps-dev): bump black from 23.7.0 to 24.3.0#57

Open
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/pip/black-24.3.0
Open

build(deps-dev): bump black from 23.7.0 to 24.3.0#57
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/pip/black-24.3.0

Conversation

@dependabot
Copy link

@dependabot dependabot bot commented on behalf of github Jun 25, 2025

Bumps black from 23.7.0 to 24.3.0.

Release notes

Sourced from black's releases.

24.3.0

Highlights

This release is a milestone: it fixes Black's first CVE security vulnerability. If you run Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings, you are strongly encouraged to upgrade immediately to fix CVE-2024-21503.

This release also fixes a bug in Black's AST safety check that allowed Black to make incorrect changes to certain f-strings that are valid in Python 3.12 and higher.

Stable style

  • Don't move comments along with delimiters, which could cause crashes (#4248)
  • Strengthen AST safety check to catch more unsafe changes to strings. Previous versions of Black would incorrectly format the contents of certain unusual f-strings containing nested strings with the same quote type. Now, Black will crash on such strings until support for the new f-string syntax is implemented. (#4270)
  • Fix a bug where line-ranges exceeding the last code line would not work as expected (#4273)

Performance

  • Fix catastrophic performance on docstrings that contain large numbers of leading tab characters. This fixes CVE-2024-21503. (#4278)

Documentation

  • Note what happens when --check is used with --quiet (#4236)

24.2.0

Stable style

  • Fixed a bug where comments where mistakenly removed along with redundant parentheses (#4218)

Preview style

  • Move the hug_parens_with_braces_and_square_brackets feature to the unstable style due to an outstanding crash and proposed formatting tweaks (#4198)
  • Fixed a bug where base expressions caused inconsistent formatting of ** in tenary expression (#4154)
  • Checking for newline before adding one on docstring that is almost at the line limit (#4185)
  • Remove redundant parentheses in case statement if guards (#4214).

Configuration

... (truncated)

Changelog

Sourced from black's changelog.

24.3.0

Highlights

This release is a milestone: it fixes Black's first CVE security vulnerability. If you run Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings, you are strongly encouraged to upgrade immediately to fix CVE-2024-21503.

This release also fixes a bug in Black's AST safety check that allowed Black to make incorrect changes to certain f-strings that are valid in Python 3.12 and higher.

Stable style

  • Don't move comments along with delimiters, which could cause crashes (#4248)
  • Strengthen AST safety check to catch more unsafe changes to strings. Previous versions of Black would incorrectly format the contents of certain unusual f-strings containing nested strings with the same quote type. Now, Black will crash on such strings until support for the new f-string syntax is implemented. (#4270)
  • Fix a bug where line-ranges exceeding the last code line would not work as expected (#4273)

Performance

  • Fix catastrophic performance on docstrings that contain large numbers of leading tab characters. This fixes CVE-2024-21503. (#4278)

Documentation

  • Note what happens when --check is used with --quiet (#4236)

24.2.0

Stable style

  • Fixed a bug where comments where mistakenly removed along with redundant parentheses (#4218)

Preview style

  • Move the hug_parens_with_braces_and_square_brackets feature to the unstable style due to an outstanding crash and proposed formatting tweaks (#4198)
  • Fixed a bug where base expressions caused inconsistent formatting of ** in tenary expression (#4154)
  • Checking for newline before adding one on docstring that is almost at the line limit (#4185)
  • Remove redundant parentheses in case statement if guards (#4214).

... (truncated)

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    You can disable automated security fix PRs for this repo from the Security Alerts page.

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [black](https://github.com/psf/black) from 23.7.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@23.7.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-version: 24.3.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Jun 25, 2025
ivyleavedtoadflax added a commit that referenced this pull request Jan 18, 2026
Renamed `cfg` to `config` throughout the file for consistency.
The codebase mixed both names for ConfigParser objects - now
standardized on `config` which is more descriptive and matches
the pattern used in ConfigManager class methods.

Co-authored-by: Claude <noreply@anthropic.com>
ivyleavedtoadflax added a commit that referenced this pull request Jan 18, 2026
Renamed `cfg` to `config` throughout the file for consistency.
The codebase mixed both names for ConfigParser objects - now
standardized on `config` which is more descriptive and matches
the pattern used in ConfigManager class methods.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 252f41d)
ivyleavedtoadflax added a commit that referenced this pull request Jan 18, 2026
* feat: Add Pydantic config validation with environment variable support

- Add pydantic-settings dependency for config validation
- Create RemoteConfig Pydantic model with field validators:
  - instance_name: alphanumeric, hyphens, underscores, dots
  - ssh_user: alphanumeric, hyphens, underscores
  - ssh_key_path: expands ~ to home directory
  - aws_region: validates AWS region format (e.g., us-east-1)
- Support environment variable overrides (REMOTE_ prefix)
- Create ConfigValidationResult for structured validation output
- Update ConfigManager to use Pydantic validation internally
- Enhance 'remote config validate' command with Pydantic validation
- Add 25 new tests for Pydantic config features
- Fix specs/readme.md: mark issue-23 as COMPLETED, update mypy path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 1f56cba)

* feat: Add built-in watch mode for instance status command

Add --watch/-w and --interval/-i flags to the status command to enable
continuous monitoring of instance status using Rich's Live display.
This resolves garbled output issues when using the external `watch`
command with Rich formatting.

- Add _build_status_table helper function for reusable table generation
- Add _watch_status function using Rich Live display with screen mode
- Validate interval must be at least 1 second
- Handle Ctrl+C gracefully to exit watch mode
- Add comprehensive tests for watch mode functionality

Closes #35

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit d2ccacc)

* refactor: Remove unused cfg parameter from get_instance_name()

- Remove unused `cfg: ConfigParser | None = None` parameter from get_instance_name()
- Remove corresponding docstring documentation for the parameter
- Remove now-unused `from configparser import ConfigParser` import

The parameter was marked as "for backward compatibility" but was never used
in the function body (it always used config_manager instead), and none of
the 8 call sites passed any arguments.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 24a886a)

* fix: Use correct config key ssh_key_path in connect()

The connect() function was using "ssh_key" as the config key when
retrieving the SSH key path, but the valid config key is "ssh_key_path".
This caused the SSH key configuration to fail silently.

- Fix get_value() call to use "ssh_key_path" instead of "ssh_key"
- Update help text to reference the correct config key name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit d9b35f5)

* docs: Add issue 36 for config validate panel width

Panel stretches beyond console width and has redundant messaging.

(cherry picked from commit 9f3116b)

* refactor: Remove unnecessary builtins import from instance.py (#18)

The builtins module was imported only to use builtins.list for a type
annotation. In Python 3.9+, list can be used directly in type annotations
without the builtins prefix. This change removes the unnecessary import
and simplifies the type annotation.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 1fc7119)

* refactor: Remove unused Typer app instance from utils.py

The utils.py module defined `app = typer.Typer()` but this app instance
was never used - no commands were registered to it and no other modules
imported it. The typer import itself is still needed for other uses
(typer.Exit, typer.secho, typer.colors).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit f57850d)

* refactor: Use cached get_sts_client() in get_account_id()

The get_sts_client() function was defined as a cached client factory but
was never used. The get_account_id() function created a new STS client
directly with boto3.client("sts") instead.

This change makes the code consistent with the EC2 client pattern where
get_ec2_client() is used throughout the codebase, and utilizes the
caching provided by @lru_cache.

Also updates tests to mock get_sts_client instead of boto3.client.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 8daac71)

* docs: Add issues 37-38 for pricing improvements

- Issue 37: Fallback to us-east-1 for pricing API in other regions
- Issue 38: Add command to show instance cost based on uptime

(cherry picked from commit 55af72a)

* fix: Remove hardcoded console width and simplify validate output

- Remove width=200 from Console initialization in config.py to use
  terminal's actual width instead of stretching beyond it
- Simplify validation output to show single status message instead
  of redundant "All checks passed" + "Status: Valid"
- Update test assertion to match new output message

Closes #36

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit acd655a)

* docs: Add issue 39 for scheduled instance shutdown

Add spec for feature to schedule instance stops after a duration,
e.g., `remote instance stop --in 3h`

(cherry picked from commit 01adf6b)

* docs: Update issue 39 to use remote shutdown command

Use SSH to run `shutdown -h +N` on the instance instead of a
local subprocess. This is simpler and survives local disconnects.

(cherry picked from commit f474c02)

* feat: Add region fallback for pricing API (#22)

When a user's region is not in the region-to-location mapping, pricing
lookups now fall back to us-east-1 instead of returning None. This
provides users in less common regions with an estimated price rather
than no price at all.

- Add get_instance_price_with_fallback() function that returns (price, fallback_used)
- Update get_instance_pricing_info() to include fallback_used indicator
- Update instance list command to use fallback pricing
- Add comprehensive tests for fallback behavior

Closes #37

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 875cc9d)

* feat: Add scheduled instance shutdown via SSH

Add --in option to stop command to schedule shutdown after duration
Add --stop-in option to start command to auto-stop after duration
Add --cancel flag to cancel scheduled shutdowns

Features:
- Parse duration strings (e.g., 3h, 30m, 1h30m)
- SSH to instance and run 'shutdown -h +N'
- Uses ssh_user and ssh_key_path from config
- Handles SSH errors gracefully

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 32d8144)

* docs: Add issue 40 for console output consistency

Standardize all command output styles around `config show` format.

(cherry picked from commit a8bb264)

* feat: Standardize console output styles for ECS commands

Update ECS list commands to use Rich Tables instead of plain line-by-line
output, matching the consistent style used across other modules.

Changes:
- list-clusters: Now displays clusters in a Rich Table with name and ARN
- list-services: Now displays services in a Rich Table with name and ARN
- prompt_for_cluster_name: Changed typer.echo to typer.secho for consistency
- prompt_for_services_name: Changed typer.echo to typer.secho for consistency

Closes #40

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 8adb22f)

* feat: Add instance cost command to show estimated cost based on uptime (#25)

Adds a new `remote instance cost` command that displays the estimated cost
of a running instance based on its uptime and hourly pricing rate.

Features:
- Shows instance ID, type, status, launch time, and uptime
- Calculates estimated cost using hourly rate × uptime hours
- Uses fallback to us-east-1 pricing for unsupported regions
- Handles non-running instances and unavailable pricing gracefully

Closes #38

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit ab6e4f9)

* docs: Add issues 41-42 for cost fixes and ls/status clarification

Issue 41: Fix instance cost (not displaying, panel too wide, integrate into ls)
Issue 42: Evaluate overlap between instance ls and status commands

(cherry picked from commit 7c6af04)

* docs: Add testing requirements for issue 41

Emphasize need for Typer CLI tests to catch cost display issues.

(cherry picked from commit 88852c7)

* feat: Integrate cost columns into instance ls with --cost flag (#41)

- Add --cost/-c flag to instance ls to show cost columns
- Add Uptime, $/hr, and Est. Cost columns when --cost is used
- Remove separate instance cost command (functionality now in ls)
- Remove _get_instance_details helper (no longer needed)
- Add _get_raw_launch_times helper for extracting launch times
- Add comprehensive tests for cost flag functionality
- Update plan.md and spec status to COMPLETED

The cost information is now opt-in rather than shown by default,
which improves performance since pricing API calls are skipped
unless explicitly requested.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 3980be0)

* docs: Reopen issue 41 - cost still not displaying

PR #26 did not fix the pricing lookup issue. Cost shows "-" in
real usage despite tests passing. Need to investigate mismatch
between mocked tests and actual AWS pricing API behavior.

(cherry picked from commit fccab83)

* feat: Differentiate instance ls and status commands (#42) (#27)

Clarify the distinct purposes of instance ls (summary view of all instances)
vs instance status (detailed view of one instance).

Changes:
- Enhanced instance status to show comprehensive details including network
  config, security groups, key pair, tags, and health status
- Updated help text for both commands to clearly indicate when to use each
- instance status now uses a Rich Panel instead of Table for better formatting
- Health status section only shown for running instances

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit d3093e7)

* refactor: Remove unnecessary enumerate() in get_instance_ids() (#28)

The loop index was unused, making enumerate() unnecessary.
Simplified to a plain for loop over reservations.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit b37effb)

* refactor: Remove unused drop_nameless parameter from get_instance_info()

The drop_nameless parameter was defined but never used - the function
always skips instances without a Name tag regardless of its value.
This was misleading since the default value of False implied nameless
instances would be included.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 0d14e97)

* refactor: Remove deprecated ec2_client backwards compatibility shim

The module-level `ec2_client` attribute was deprecated and scheduled
for removal in v0.5.0. After scanning the codebase, no code uses this
deprecated attribute - all modules use `get_ec2_client()` directly.

Remove:
- Deprecation comment block
- `__getattr__` function providing lazy access to `ec2_client`

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit c8885ac)

* refactor: Remove deprecated ecs_client backwards compatibility shim

The __getattr__ function providing lazy access to ecs_client as a
module-level attribute was dead code. All ECS functions use
get_ecs_client() directly, and no imports of ecs_client exist in
the codebase.

Also removes the unused Any type import.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit c361dcb)

* refactor: Remove unused ENV_PREFIX constant from config.py (#32)

The ENV_PREFIX constant was defined but never used. The actual env
prefix is hardcoded in RemoteConfig.model_config as env_prefix="REMOTE_".

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit aae94bd)

* refactor: Rename in_duration parameter to stop_in for consistency (#33)

The stop() function used parameter name 'in_duration' while the start()
function used 'stop_in' for the same purpose (scheduling automatic
shutdown). This inconsistency created cognitive overhead.

Renamed the parameter to 'stop_in' to match the pattern used in start().
The CLI flag '--in' remains unchanged for backwards compatibility.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 5e34587)

* docs: Add issue 43 for Rich Panel width fix

Recurring issue: Panels expand to full terminal width.
Audit all Panel usage and set expand=False globally.

(cherry picked from commit 209b796)

* refactor: Rename type function and parameter to avoid shadowing built-in (#34)

Rename the `type()` command function to `instance_type()` with
`@app.command("type")` decorator to preserve CLI command name.
Rename the `type` parameter to `new_type` to avoid shadowing
Python's built-in type() function.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 89b9939)

* refactor: Add missing width=200 to Console initialization in config.py

The config module's Console initialization was inconsistent with all other
modules, which specify width=200. This ensures consistent output formatting
across all CLI commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit bf38a96)

* refactor: Remove unused is_instance_stopped() function (#36)

The function was defined but never called in production code.
It only had test coverage but no actual usage in the codebase.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 915ec2f)

* fix: Correct EU region location names in pricing API

The AWS Pricing API uses "EU (...)" format for European regions,
not "Europe (...)". This was causing pricing lookups to fail for
all EU regions (eu-west-1, eu-west-2, etc.).

Fixes:
- eu-west-1: "Europe (Ireland)" -> "EU (Ireland)"
- eu-west-2: "Europe (London)" -> "EU (London)"
- eu-west-3: "Europe (Paris)" -> "EU (Paris)"
- eu-central-1: "Europe (Frankfurt)" -> "EU (Frankfurt)"
- eu-north-1: "Europe (Stockholm)" -> "EU (Stockholm)"
- Added eu-south-1: "EU (Milan)"

(cherry picked from commit ae9f89a)

* docs: Update issue 41 with root cause and fix details

Root cause: EU region location names in REGION_TO_LOCATION mapping
used "Europe (...)" format but AWS Pricing API expects "EU (...)".

(cherry picked from commit 9fafbad)

* docs: Add issue 44 for test API validation

Mocked tests can pass while real API fails. Add validation to
ensure test parameters match what AWS actually accepts.

(cherry picked from commit 5ab30ef)

* refactor: Remove duplicate list_launch_templates() from instance.py

The list_launch_templates() function was duplicated in both instance.py
and ami.py. The ami.py version is feature-rich with --filter and
--details options, while the instance.py version was a basic subset.

Remove the duplicate from instance.py as users can use
`remote ami list-templates` which provides the same functionality
plus additional filtering and detailed output capabilities.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 6712c6a)

* docs: Add issue 45 for v1.1.0 release preparation

Includes checklist for new features (watch mode, scheduled shutdown,
cost display), bug fixes, and release process.

(cherry picked from commit 9a10b7e)

* fix: Set expand=False on all Rich Panels to prevent full-width expansion

All Panel components in the codebase were expanding to fill the terminal
width instead of fitting their content. This fixes recurring issues with
overly wide panels in instance status, config validate, and launch commands.

Changes:
- instance.py: Fixed _build_status_table and launch panels
- config.py: Fixed validate command panel
- ami.py: Fixed launch command panel
- Added test for panel expand=False property

Fixes #43

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit f02aff2)

* test: Add AWS API contract validation tests (#39)

Add validation layer to ensure mocked tests use parameter values that
the real AWS APIs would accept. This prevents situations where tests
pass but real API calls fail (as happened with issue #41 where
"Europe (Ireland)" was used instead of "EU (Ireland)").

Changes:
- Add tests/fixtures/aws_api_contracts.py with known-good AWS values
- Add tests/test_api_contracts.py with 18 contract validation tests
- Document API contract in remote/pricing.py
- Add integration marker to pyproject.toml for optional real API tests

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit cdb30fe)

* release: Prepare v1.1.0 release (#40)

- Update version in pyproject.toml to 1.1.0
- Add CHANGELOG.md entry for v1.1.0 with new features, fixes, and changes
- Mark issue 45 as COMPLETED in plan.md and spec file

New in v1.1.0:
- Built-in watch mode for status command (--watch flag)
- Scheduled instance shutdown (--in flag for stop, --stop-in for start)
- Cost information in instance list (--cost flag)
- AWS API contract validation tests

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 2d72873)

* refactor: Remove unused ConfigurationError exception class (#41)

The ConfigurationError exception class was defined but never raised or
caught anywhere in the codebase. This dead code added unnecessary lines
to the exceptions module with no functional purpose.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 50886f1)

* refactor: Remove unused InvalidInstanceStateError exception class (#42)

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 311197f)

* refactor: Extract _build_ssh_command() helper to reduce duplication

The SSH argument building code was duplicated in _schedule_shutdown()
and _cancel_scheduled_shutdown(). Both functions built identical SSH
argument lists with the same options (StrictHostKeyChecking, BatchMode,
ConnectTimeout).

This change extracts the common logic into a new _build_ssh_command()
helper function that:
- Takes dns, key, and user parameters
- Returns a list of SSH command arguments ready for subprocess
- Is reused by both shutdown-related functions

Reduces code duplication by ~14 lines and ensures any future changes
to SSH options only need to be made in one place.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 62dc280)

* refactor: Consolidate datetime imports to module level in instance.py (#44)

Move datetime imports from inside functions to module level for consistency
with other modules like utils.py. Removes three inline imports from
_get_raw_launch_times, list_instances, and _schedule_shutdown functions.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 9660259)

* refactor: Centralize console initialization in utils.py

Move the shared Console instance to utils.py and have all other modules
import it instead of creating their own instances. This reduces code
duplication and ensures consistent console configuration across all
modules.

Files modified:
- remote/ami.py - Import console from utils
- remote/config.py - Import console from utils
- remote/ecs.py - Import console from utils
- remote/instance.py - Import console from utils (kept Console import
  for _watch_status local usage)
- remote/snapshot.py - Import console from utils
- remote/volume.py - Import console from utils

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 879337e)

* refactor: Remove redundant Console creation in _watch_status() (#46)

The _watch_status() function created its own Console instance when the
module already imports console from remote.utils. This change:

- Removes local watch_console = Console() in _watch_status()
- Uses the shared console instance from utils instead
- Removes now-unused Console import from rich.console
- Updates test to mock console instead of Console

This completes the console centralization refactor - all modules now
use the shared console instance from remote/utils.py.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 7d639db)

* chore: Add gitleaks to pre-commit hooks for secret detection

Complements existing security tools (bandit, pip-audit) by scanning
for hardcoded secrets before push.

(cherry picked from commit 9843b70)

* refactor: Remove redundant get_instance_type() call in instance_type()

The instance_type() function called get_instance_type() twice to fetch
the same value - once at function start (stored in current_type) and
again in the else branch (stored in current_instance_type). This made
an unnecessary AWS API call since current_type was already available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 470c984)

* refactor: Replace overly broad exception handling in list_launch_templates() (#48)

The exception handler `except (ResourceNotFoundError, Exception)` was
catching all exceptions silently, which could mask bugs. Changed to
`except (ResourceNotFoundError, AWSServiceError)` to match the documented
exceptions that get_launch_template_versions() can raise.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit c3074d4)

* refactor: Remove misleading return type from list_launch_templates() Typer command (#49)

The function returned a list value that was never consumed by callers since
it's a Typer CLI command. Changed return type to None and removed unused
Any import.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 9816412)

* refactor: Replace overly broad exception handling in config.py (#50)

Replace `except Exception` with `except ValueError` in three locations:
- ConfigValidationResult.validate_config()
- ConfigManager.get_instance_name()
- ConfigManager.get_value()

Pydantic's ValidationError inherits from ValueError, so this catches
validation errors while avoiding the antipattern of catching all
exceptions indiscriminately.

Updated test to use ValueError instead of generic Exception.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit c32ab4f)

* refactor: Replace silent exception handler in list_launch_templates()

Changed exception handling in ami.py's list_launch_templates() to display
a warning message instead of silently ignoring errors when fetching
launch template version details.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit bc7a4b5)

* refactor: Extract duplicated launch() logic into shared utility function (#52)

The launch() function was duplicated nearly identically (~130 lines) in both
ami.py and instance.py. This refactor:

- Adds launch_instance_from_template() to utils.py with all common logic
- Simplifies both launch() commands to thin wrappers calling shared function
- Updates test mocks to patch correct modules (remote.utils, remote.config)

Net change: -58 lines of code, single source of truth for launch logic.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 1cff43a)

* refactor: Add explicit exit codes to typer.Exit() calls in ecs.py

Two typer.Exit() calls lacked explicit exit codes:
- prompt_for_cluster_name(): when no clusters found
- prompt_for_services_name(): when no services found

While typer.Exit() defaults to exit code 0, being explicit about
exit codes is best practice and consistent with other exit calls
in the codebase. Exit code 0 is correct here as these are
informational cases, not errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 4b564d6)

* refactor: Standardize docstring formatting in ecs.py

Fix inconsistent docstring formatting to match the style used in
utils.py and other modules:

- Move descriptions to same line as opening triple quotes
- Add proper 4-space indentation to Args/Returns sections
- Remove redundant type annotations from docstrings (types are in
  function signatures)
- Remove type prefixes from Returns sections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 27cd751)

* refactor: Standardize Typer parameter style in status() command (#55)

The status() command in instance.py used the Annotated[] style for
parameter type hints while all other commands used the simpler inline
style. This inconsistency made the codebase harder to read and created
confusion about which style to follow.

Changes:
- Convert status() parameters from Annotated[] to inline style
- Remove unused Annotated import from typing

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 15b75b6)

* refactor: Remove unused get_instance_pricing_info() function (#56)

The function was dead code - only exercised by tests, never used in
application code. The instance list command uses get_instance_price_with_fallback()
directly rather than this higher-level wrapper.

- Remove get_instance_pricing_info() from remote/pricing.py
- Remove TestGetInstancePricingInfo from tests/test_pricing.py
- Update specs to reflect actual implementation

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit a50adcf)

* refactor: Standardize ConfigParser variable naming in config.py (#57)

Renamed `cfg` to `config` throughout the file for consistency.
The codebase mixed both names for ConfigParser objects - now
standardized on `config` which is more descriptive and matches
the pattern used in ConfigManager class methods.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 252f41d)

* refactor: Remove unused if __name__ == "__main__" blocks

Remove dead code from five modules that contained unused main blocks:
- remote/ami.py
- remote/config.py
- remote/instance.py
- remote/snapshot.py
- remote/volume.py

These modules are library code imported into __main__.py, not executed
directly. The blocks were never executed since users run `remote <cmd>`
not `python -m remote.instance` etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit a618fe7)

* refactor: Remove unused return value from write_config() function

The write_config() function returned its input ConfigParser object,
but no caller ever used the return value. Changed return type to None
and updated the corresponding test.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 9800551)

* refactor: Remove unused get_snapshot_status() function

The function was defined in utils.py but never called by any production
code. It was only exercised by tests. Removes dead code and associated
tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit b06bf72)

* refactor: Remove unused validate_snapshot_id() function

The validate_snapshot_id() function was defined in validation.py but
never called anywhere in the application. Remove this dead code along
with its associated tests to keep the codebase clean.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit fe92d81)

* refactor: Move Terraform comment to be adjacent to its code

Move the "# If the instance is managed by Terraform, warn user" comment
from line 963 to line 981, placing it directly above the terraform_managed
assignment it describes. The comment was previously orphaned from its
relevant code by 20 lines of unrelated confirmation prompts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 8a7eb0d)

* refactor: Use config_manager.remove_value() in unset_value command (#63)

The unset_value() CLI command was directly manipulating the config file
instead of using the ConfigManager.remove_value() method like other
similar commands (set_value, add). This violated encapsulation and
missed proper state management (cache invalidation).

Also fixed ConfigManager.remove_value() to read from the specified
config_path parameter instead of the default path.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 8c0f8ca)

* refactor: Simplify config path assignment with ternary operators

Replace verbose if-else blocks with ternary operators in
RemoteConfig.from_ini_file() and ConfigValidationResult.validate_config()
for cleaner, more idiomatic code (SIM108).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 190b0f5)

* refactor: Remove unused get_monthly_estimate() function and HOURS_PER_MONTH constant (#65)

The function and constant were defined but never used in production code:
- No code called get_monthly_estimate()
- HOURS_PER_MONTH was only used by get_monthly_estimate()
- Similar to previous removal of get_instance_pricing_info()

The application displays hourly prices directly without converting
to monthly estimates.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit b55caaf)

* refactor: Extract duplicate exception handling to helper method in ConfigManager (#66)

The get_instance_name() and get_value() methods had identical exception
handling blocks that displayed warnings for various config-related errors.
This duplicated ~12 lines of code.

Changes:
- Add _handle_config_error() helper method to centralize error handling
- Update both methods to use a single except clause delegating to helper
- Use union type syntax (X | Y) in isinstance checks per UP038 lint rule

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit dc66c51)

* refactor: Fix inconsistent filtering in get_instance_ids()

The get_instance_ids() function had inconsistent filtering behavior
compared to get_instance_info():

- get_instance_info() iterates through ALL instances and filters out
  those without a Name tag
- get_instance_ids() only took the FIRST instance from each reservation
  and did NOT filter by Name tag

This could cause array length mismatches when used together. The code
worked around this with strict=False in zip() calls, silently truncating
to the shortest array.

Changes:
- Update get_instance_ids() to iterate all instances and filter by Name tag
- Change strict=False to strict=True in zip calls in instance.py and config.py
- Add test for the new filtering behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 16147a7)

* refactor: Fix get_value CLI command to use ConfigManager consistently (#68)

The get_value() CLI command bypassed ConfigManager.get_value() and read
directly from config file. This was inconsistent with other CLI commands
(set_value, add, unset_value) which properly use ConfigManager.

Changes:
- Renamed function to get_value_cmd to avoid shadowing
- Added key validation against VALID_KEYS (consistent with set_value)
- For default path: delegate to config_manager.get_value()
- For custom paths: continue reading directly from file

Benefits:
- Pydantic validation for config values
- REMOTE_* environment variable override support
- Key validation (rejects unknown keys)
- Consistent API with other config commands

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 3bec8ed)

* refactor: Extract hardcoded time constants in instance.py (#69)

Replace magic numbers with named constants for better readability:
- SECONDS_PER_MINUTE, SECONDS_PER_HOUR, MINUTES_PER_DAY
- MAX_STARTUP_WAIT_SECONDS, STARTUP_POLL_INTERVAL_SECONDS
- CONNECTION_RETRY_SLEEP_SECONDS, MAX_CONNECTION_ATTEMPTS

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit f4640f9)

* refactor: Add MINUTES_PER_HOUR constant for semantic correctness

The _format_uptime() function used SECONDS_PER_MINUTE (60) to perform
arithmetic on values measured in minutes. While mathematically correct,
this was semantically misleading. Added MINUTES_PER_HOUR constant and
updated MINUTES_PER_DAY to use it for consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 9144511)

* refactor: Extract SSH readiness sleep to constant (#71)

Add SSH_READINESS_WAIT_SECONDS constant (10s) for the hardcoded
sleep times used when waiting for SSH to become ready after
instance startup. This follows the established pattern of
extracting time-related magic numbers to named constants.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit ef46b1a)

* refactor: Extract type change polling magic numbers to constants

Add TYPE_CHANGE_MAX_POLL_ATTEMPTS and TYPE_CHANGE_POLL_INTERVAL_SECONDS
constants to replace hardcoded `5` values in instance_type() function.
This follows the established pattern for time-related constants.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 468117d)

* docs: Add issue 46 for connect stopped instance behavior (GitHub #73)

(cherry picked from commit 8c0b1bf)

* feat: Add --start and --no-start flags to connect command (GitHub #73)

When connecting to a stopped instance:
- --start: Automatically starts the instance without prompting
- --no-start: Fails immediately with a helpful message
- Non-interactive mode (no TTY): Fails with helpful message

Also:
- Refactored start command to extract _start_instance() internal function
- Added comprehensive tests for new behavior
- Fixed typo: "trying to starting" -> "trying to start"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 48f9a1d)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants