Skip to content

Envoy CLI and Cleanup Command#21

Merged
bbengfort merged 2 commits intomainfrom
cli
Mar 12, 2026
Merged

Envoy CLI and Cleanup Command#21
bbengfort merged 2 commits intomainfrom
cli

Conversation

@bbengfort
Copy link
Copy Markdown
Contributor

@bbengfort bbengfort commented Mar 12, 2026

Scope of changes

Implements an Envoy CLI command that can be pip installed and a cleanup command for dealing with UAB Raison messages.

Fixes SC-37567

Type of change

  • bug fix
  • new feature
  • documentation
  • other (describe)

Acceptance criteria

This PR will be merged without review.

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have updated the dependencies list
  • I have added new test fixtures as needed to support added tests
  • I have added or updated the documentation

Note

Medium Risk
Adds a new installable CLI that can batch archive/delete transactions; mistakes in filtering/confirmation could lead to unintended data changes. Also tweaks client request typing/validation and adds a new transactions archive call path that should be verified against the API.

Overview
Introduces a pip-installable envoy CLI (envoy.__main__ + console_scripts) that loads configuration from .env/env vars and dispatches subcommands.

Adds status output and a new cleanup command to batch archive or delete transactions by counterparty and status, with interactive confirmation, --dry-run, and --yes safeguards.

Extends the Python client with stricter URL validation, minor typing adjustments, and adds a transactions-level archive API call; bumps version to 1.3.0.

Written by Cursor Bugbot for commit cbf0bf8. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@@ -0,0 +1,104 @@
"""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing __init__.py breaks CLI package distribution

High Severity

The new envoy/cli/ directory has no __init__.py file. Since setup.py uses find_packages() (not find_namespace_packages()), setuptools requires __init__.py to recognize a directory as a package. Without it, envoy.cli and its modules (cleanup, status, prompt) won't be included in the pip-installed distribution, causing the CLI entry point (envoy=envoy.__main__:main) to fail with an import error at runtime.

Additional Locations (1)
Fix in Cursor Fix in Web

envoy/client.py Outdated
raise ValueError(f"unhandled status code {rep.status_code}")

def _make_endpoint(self, *endpoint: tuple[str], params: dict = None) -> str:
def _make_endpoint(self, *endpoint, params: Optional[dict] = None) -> Literal[b""]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incorrect return type annotation Literal[b""] on _make_endpoint

Medium Severity

The _make_endpoint return type annotation was changed from the correct -> str to -> Literal[b""]. The function returns urlunparse(...) which produces a str, not a bytes literal. Literal[b""] claims the function always returns the exact empty bytes value b"", which is semantically nonsensical and will break any static type checking. This appears to be an accidental edit.

Fix in Cursor Fix in Web

"help": "the counterparty name or ID of the transactions to cleanup",
"type": str,
"required": True,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Conflicting short flags between global and cleanup args

Medium Severity

The cleanup subparser defines -s/--status and -c/--counterparty, which collide with the global -s/--secret and -c/--client-id short flags. When a user places these flags after the cleanup subcommand, the subparser consumes them with different semantics. For example, envoy cleanup -s mysecret interprets mysecret as a status value (failing choices validation) instead of a secret. This makes the short flags unusable for credentials when using the cleanup command and produces confusing error messages.

Additional Locations (1)
Fix in Cursor Fix in Web

@bbengfort bbengfort merged commit 4f8dade into main Mar 12, 2026
3 of 4 checks passed
@bbengfort bbengfort deleted the cli branch March 12, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant