Conversation
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.
What changed
This PR refactors the CLI command layer into smaller, focused modules and adds explicit public-contract guardrails so internal refactors can proceed safely without silently changing user-facing behavior.
Issue and user impact
The command implementation had grown into large, multi-responsibility modules (notably
arrangement.pyandtrack.py) with transport, parsing, and command adaptation concerns mixed together. That made routine changes harder to reason about and increased the chance of accidental regressions in CLI behavior, JSON output shape, protocol handling, and exit-code semantics that users depend on in scripts.Root cause
Public/stable boundaries were documented only implicitly, and there was no automated snapshot gate to detect contract drift. At the same time, command adapters accumulated too many responsibilities in single files, which increased coupling and made intent-preserving changes expensive and error-prone.
Fix
The refactor splits command responsibilities into dedicated internal modules (for arrangement/track subdomains and shared command-runner utilities), while keeping the public command surface unchanged. It also introduces explicit contract enforcement by adding a generated public snapshot (
tests/snapshots/public_contract_snapshot.json), a contract check module, and a regeneration tool (tools/update_public_contract_snapshot.py).In addition, client/backend responsibilities are separated (
src/ableton_cli/client/backends.py), remote/contract paths and error mapping were tightened, and contributor guidance now documents the public contract boundary and snapshot update workflow.Validation
The following checks were run on this branch:
uv run python -m ableton_cli.dev_checksuv run ruff check .uv run ruff format --check .uv run pytestAll checks passed (including
515 passedin pytest).