Repository navigation
fix(deploy): show the full command and the tool's real error on failure - #95
autoidm-jon wants to merge 3 commits into
Conversation
|
PR tier:
A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/37006898248 |
f7955e4 to
b194792
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b194792 to
b913f12
Compare
|
Goal: after a failed cloud command, pdt prints the complete command and the error from the cloud tool, and hides the install progress lines of uv. Reviewer: Cursor Review of the conflict resolutions of the rebase onto main 5a2e564 (old head f7955e4).
Resolutions:
Checks that passed at b913f12:
|
|
PR tier:
A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/41847620266 |
|
Output changes from A failed command prints every argument and its exit codeCommands run: The ownership check no longer replaces the error with "failed while checking resource ownership". The ERROR: (gcloud.artifacts.repositories.describe) INVALID_ARGUMENT: Location eastus2 is not a valid Artifact Registry location.
-error: pdt gcloud artifacts repositories describe pdt failed while checking resource ownership
+error: pdt gcloud artifacts repositories describe pdt --location eastus2 --project pdt-sample --format=json failed with exit code 1; fix the problem above and re-runBefore, the cut after four arguments left ERROR: (gcloud.services.list) PERMISSION_DENIED: Permission denied to list services for project pdt-sample.
-error: pdt gcloud services list --enabled --project failed; fix the problem above and re-run the deploy
+error: pdt gcloud services list --enabled --project pdt-sample '--format=value(config.name)' failed with exit code 1; fix the problem above and re-runuv no longer prints its download and install linesCommand run: the first no .env file in hello-world or a folder above it, so pdt reads env vars only from this terminal
-Downloading grpcio (12.1MiB)
-Downloading duckdb (16.8MiB)
- Downloaded grpcio
- Downloaded duckdb
-Installed 50 packages in 40ms
checking: Docker on this computerThe Azure CLI's Python warnings no longer printCommand run: The <pdt>/.venv/lib/python3.15/site-packages/backoff/_decorator.py:201: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
if asyncio.iscoroutinefunction(target):
-<uv-cache>/environments-v2/deploy-azure-8e0783fec722ae1f/lib/python3.12/site-packages/azure/cli/core/telemetry.py:295: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
- _session.start_time = datetime.datetime.utcnow()
ERROR: Please run 'az login' to setup account.Defect: the quoted command does not run again in Windows Command PromptThis is not fixed in this PR. Not runThese need a cloud sign-in or a cloud change: the Azure |
Why
Derek tested pdt through pdt-meltano and hit two errors that did not say what went wrong. On Azure, pdt printed:
On Google Cloud, pdt printed:
Each message cut the command to its first three or four arguments. The Azure line dropped
--location eastus, and the Google Cloud line dropped--location eastus2. In both cases the location was the problem. The Google Cloud message also replaced every error other than "not found" with the label "failed while checking resource ownership". That label also covered a bad argument, a missing permission, a disabled API, and an expired login. Derek could not see which command failed or why.Each provider had its own copy of the failure message, and each copy cut the command in a different place.
Scope
deploy_common.fail_command(command, proc, hint="")is now the one way to report a failed command. It prints the tool's captured output, thenerror: <full command> failed with exit code N; fix the problem above and re-run, then the hint when pdt has one. The command is the line the user can run again, such aspdt az ...orpdt gcloud ....run_quiet,run_stream,read_json_or_none, and bothgcloud auth loginfailures. Azurerun_quiet(the quota hint goes throughhint),run_stream,delete_unless_locked, andaz login. AWSdocker login/build/pushinbuild_and_pushandaws sso logininrelogin(the access key advice goes throughhint). The sharedrun_buildfordocker build/pushon Azure CI.read_json_or_nonestill answersNonefor "not found". Any other error prints the real gcloud error and the full command.python -W ignore. Before, a shell with Python warnings on (Derek's run under Meltano) showed telemetryutcnowDeprecationWarnings and ResourceWarnings around each az error. Errors are not Python warnings, so az still prints them.uv runfor the provider scripts and forpdt aws/az/gcloudpasses--quiet. That removes the "Downloading ..." and "Installed N packages" lines. uv still prints an error when it cannot install a package.Tradeoffs
fail_commanddoes not redact.Blast Radius
Error output on every cloud provider. A command that succeeds prints the same as before. A command that fails prints the full command and its exit code. The Google Cloud ownership check stops with the real error, as before, but with a different message. The Windows provider does not change. Its
WindowsDeployErroralready includes the PowerShell error text, and its command is an encoded script that the user cannot run again.Not changed:
az_jsonanddescribe_jsonstill answerNonefor any error, and the caller treatsNoneas "the resource does not exist". They have about 50 callers, and some of them depend on that. For example,az account showanswersNonewhen no user is signed in. A later write to the same resource then fails throughfail_commandwith the real error. Changing those probes needs a review of each caller.Verification
tests/test_command_errors.pyand the new tests intests/test_google_cloud_not_found.pycame first and failed onmaster. Onmaster, theread_json_or_nonetest printedfailed while checking resource ownershipand no--location. They pass at the head. Thetest,lint,smoke, andbuildjobs pass on the head, which is rebased onto Release 0.1.3.ruff check .passes.read_json_or_none("artifacts", "repositories", "describe", "pdt", "--location", "eastus2", "--project", ...). Before and after, the gcloud re-login text printed first. The last line changed:run_quiet("group", "show", "--name", "pdt-nonexistent-xyz", "--query", "location")withPYTHONWARNINGS=default. Before, it printed 4 warnings around the error: 2 DeprecationWarnings fromtelemetry.py, an unclosed file ResourceWarning, and a subprocess ResourceWarning. After, it printed only the error:With
PYTHONDEVMODE=1in place ofPYTHONWARNINGS=default, the new code printed the same 4 lines and no warnings.uv run --quiet --scriptchecks: a script with a dependency that does not exist still prints uv's resolution error and exits 1. A script that installs a package prints no "Installed" line. Its own stdout, stderr, and exit code pass through.group create. It writes to a subscription.tests/test_command_errors.pycovers Derek's--location eastuscase with his exact Azure error text.🤖 Generated with Claude Code
Moved from GitLab
autoidm/pdt!161(https://gitlab.com/autoidm/pdt/-/merge_requests/161), opened by autoidm-jon on 2026-09-30.