Skip to content

fix(cli): reject unknown regions and separate app lists - #306

Open
autoidm-jon wants to merge 8 commits into
mainfrom
fix/cli-list-spacing
Open

autoidm-jon wants to merge 8 commits into
mainfrom
fix/cli-list-spacing

Conversation

@autoidm-jon

@autoidm-jon autoidm-jon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

A region that the provider does not have is now an error in pdt init, pdt validate, and pdt deploy, before any cloud call, with the closest real names, and each deploy config error names the app once. A blank line now separates each app list and each next-steps block from the text around it, and places print as azure (eastus2).

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • src/pdt/deploy.py is provider-neutral deploy flow
  • agree with floor — src/pdt/deploy.py changes 9 lines in the provider-neutral flow (describe_place and the removed console.say() before deployed_next_steps and start)
  • src/pdt/deploy.py:273 changes the user-facing place string everywhere it appears (pdt init prompts, destroy, pinning messages) from 'azure, region eastus2, ...' to 'azure (eastus2, ...)'; tests/test_scaffold.py pins the new wording
  • src/pdt/console.py:366 makes next_steps print a leading blank line for all 17 call sites; alerts_cli.py:360 and scaffold.py already emit a blank line just before, so those paths can now print two
  • src/pdt/regions.py:321 adds say_suggestion and wires it into scaffold.PROVIDER_QUESTIONS, so pdt init now prints the suggestion and region list it did not print before

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/41703475276

@autoidm-jon

autoidm-jon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Reviewer: Cursor gpt-5.6-luna-high. The review read 36e8e52; the fix for finding 1 is in 55b64e6.

Goal: pdt commands show app lists apart from the next-step hints, write a place as provider (region), and suggest a region the same way in every command that asks for one.

# Severity Disposition Finding Action
1 should-fix Fixed pdt alerts setup printed two blank lines before Next steps:, because console.next_steps now prints one itself. alerts_cli.setup prints a blank line only before the text that follows it; a test asserts one blank line before Next steps:.
2 should-fix Dismissed The pdt init region suggestion ignores a kept AWS profile when it reads the region of the CLI settings. main already called suggest_region with no platform, so this change does not alter it, and the time zone comes first. A new project has no kept profile.
3 nit Dismissed No test covers the region-list link line or the blank line after the pdt destroy --all list. The link line is the existing choose_region line, now shared; the destroy --all blank line is one console.say().

The reviewer also found no provider-and-region text left in the comma form in source, tests, or docs.

Checks that passed on 55b64e6: uv run pytest -q (2541 passed, 2 skipped), uv run --group dev ruff check, and pdt deploy with no app name in a scratch project (a blank line between the app list and pdt list).

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • src/pdt/deploy.py is provider-neutral deploy flow
  • src/pdt/deploy.py changes describe_place's user-facing place format (azure (eastus2, subscription sub-1)) and drops the blank line before deployed_next_steps/start, now owned by console.next_steps, so the spacing contract of every provider's deploy output moves into src/pdt/console.py
  • src/pdt/regions.py adds say_suggestion and src/pdt/scaffold.py wires it into PROVIDER_QUESTIONS for azure, aws, and google-cloud, so pdt init prints new output; all three cloud providers change together, so parity holds
  • no config key, dependency, dispatch branch, or deploy ordering change, and tests/test_next_steps.py, test_cli.py, and test_scaffold.py pin every new string

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/41867267251

@autoidm-jon

autoidm-jon commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Output changes from 5a2e5641 to 55b64e61. Each diff shows real command output from sample projects with placeholder settings such as subscription sub-1. No command contacted a cloud.

Places print as provider (region)

Commands run: pdt init and pdt deploy <app>.

-1  alpha  azure, region eastus2, subscription sub-1, resource group pdt
+1  alpha  azure (eastus2, subscription sub-1, resource group pdt)
-   own    google-cloud, region us-east4; edit own/config.yml to move it
+   own    google-cloud (us-east4); edit own/config.yml to move it
-alpha is deployed to azure, region eastus2, subscription sub-1, resource group pdt,
-but pdt.yml now deploys it to aws, region us-east-2.
+alpha is deployed to azure (eastus2, subscription sub-1, resource group pdt),
+but pdt.yml now deploys it to aws (us-east-2).

pdt init shows the suggested region and why

The first deploy already prints these two lines.

 Choose [1]: 1

+pdt suggests eastus2, because this computer's time zone is America/New_York.
+All Azure regions: https://learn.microsoft.com/en-us/azure/reliability/regions-list
 Which Azure region should hold your jobs? (type cancel to change nothing) [eastus2]:

A blank line separates app lists and next steps from the text around them

Commands run: pdt deploy with and without apps, pdt deploy <app> --yes, pdt destroy --all, pdt alerts setup, and pdt new --from.

pdt deploy in a project with two apps:

   daily-report
   hello-world
+
   pdt list  see every app
   pdt deploy <app>
+
 Get help with pdt deploy at https://autoidm.com/discord

pdt alerts setup in a project where one app sets its own alerts:

 note: beta sets its own alerts:, so it does not use these entries.
+
 Next steps:
   pdt alerts test   send a test message

pdt init no longer prints a blank line at the end of its output when you keep the apps in their current place.

Defect: pdt --welcome has an extra blank line

This is not fixed in this PR. console.next_steps now prints a blank line, and the banner already ends with one.

                            welcome!

+
 Get started:
   pdt init my-project  create a project in a new folder

Not run

These commands need a cloud change, a cloud sign-in, or a change to the installed pdt: pdt init with a yes to removing apps, pdt upgrade, pdt destroy <app> on a cloud, and the Azure sign-in next steps.

Every next-steps block and the help line after a failure start after a blank line. The region questions of pdt init print the suggestion and its reason, as the first deploy does.
Port the region check of PR 206: `regions.REGIONS` and `region_problem` in `validate_app`, the first-deploy question, and the `pdt init` question. Also remove the suggestion and region-list lines above the `pdt init` region question.
@autoidm-jon autoidm-jon changed the title fix(cli): separate app lists and show places as provider (region) fix(cli): reject unknown regions and separate app lists Nov 4, 2026
@autoidm-jon

Copy link
Copy Markdown
Contributor Author

Before and after output: main at e97557e and this branch at 42bcaa5. Color codes are removed, and the project path is /path/to/project.

pdt init with the offered region prints the same text as main: no lines appear above the region question.

A wrong region in the pdt init question is asked again

Affects pdt init. On main, pdt.yml gets region: eastu2. On this branch, it gets region: eastus2.

 
 Which Azure region should hold your jobs? (type cancel to change nothing) [eastus2]: eastu2
+There is no Azure region named eastu2. Did you mean eastus2 or eastus or westus2? All Azure regions:
+https://learn.microsoft.com/en-us/azure/reliability/regions-list
+Which Azure region should hold your jobs? (type cancel to change nothing) [eastus2]: eastus2
 Your project is ready:
 /path/to/project/my-project

pdt validate rejects a region the provider does not have

Affects pdt validate on Azure, AWS, and Google Cloud, with region: eastu2 in pdt.yml. The exit code changes from 0 to 1.

       runs run.py
       .env file read: .env
-Configuration is valid.
+error: hello: platform.region in pdt.yml or hello/config.yml: There is no Azure region named eastu2. Did you
+       mean eastus2 or eastus or westus2? All Azure regions:
+       https://learn.microsoft.com/en-us/azure/reliability/regions-list
+1 problem(s) found.
 
+Get help with pdt validate at https://autoidm.com/discord
       runs run.py
       .env file read: .env
-Configuration is valid.
+error: hello: platform.region in pdt.yml or hello/config.yml: There is no AWS region named eastu2. Did you
+       mean us-east-2 or ap-east-2? All AWS regions:
+       https://docs.aws.amazon.com/global-infrastructure/latest/regions/aws-regions.html
+1 problem(s) found.
 
+Get help with pdt validate at https://autoidm.com/discord
       runs run.py
       .env file read: .env
-Configuration is valid.
+error: hello: platform.region in pdt.yml or hello/config.yml: There is no Google Cloud region named eastu2.
+       Did you mean asia-east2? All Google Cloud regions: https://docs.cloud.google.com/run/docs/locations
+1 problem(s) found.
 
+Get help with pdt validate at https://autoidm.com/discord

A wrong region from an environment variable is rejected too

Affects pdt validate and pdt deploy when pdt.yml sets no region and .env sets PDT_AZURE_REGION=eastu2.

       runs run.py
       .env file read: .env
-Configuration is valid.
+error: hello: the environment variable PDT_AZURE_REGION: There is no Azure region named eastu2. Did you mean
+       eastus2 or eastus or westus2? All Azure regions:
+       https://learn.microsoft.com/en-us/azure/reliability/regions-list
+1 problem(s) found.
 
+Get help with pdt validate at https://autoidm.com/discord

pdt deploy stops at a wrong region before any question or cloud call

Affects pdt deploy with region: eastu2. On main, the deploy goes on to the alerts question; the capture stopped there, before any sign-in.

-  hello
-      runs run.py
-      .env file read: .env
+error: hello: platform.region in pdt.yml or hello/config.yml: There is no Azure region named eastu2. Did you
+       mean eastus2 or eastus or westus2? All Azure regions:
+       https://learn.microsoft.com/en-us/azure/reliability/regions-list
 
-pdt can post to Slack or Microsoft Teams when hello deploys, or when a run fails.
-Set up alerts now? [y/N]
+Get help with pdt deploy at https://autoidm.com/discord

Each pdt deploy config error names the app once

Affects every pdt deploy config error. main printed hello: hello:. The blank line before Get help is the spacing change of this pull request.

-error: hello: hello: platform.account: That is not an AWS account ID. It is 12 digits, for example
-       123456789012.
+error: hello: platform.account: That is not an AWS account ID. It is 12 digits, for example 123456789012.
+
 Get help with pdt deploy at https://autoidm.com/discord

@autoidm-jon

Copy link
Copy Markdown
Contributor Author

Goal: a wrong region stops pdt init, pdt validate, and pdt deploy before any cloud call and names the closest real regions, pdt init asks its region question with no lines above it, and each pdt deploy config error names the app once.

The code review ran in four rounds. The last round, on 42bcaa5, found no blocker and no should-fix.

# Severity Disposition Finding Action
1 Should-fix ✅ Fixed A region from AWS_REGION, AWS_DEFAULT_REGION, PDT_AZURE_REGION, or PDT_GOOGLE_CLOUD_REGION, also from .env, was not checked. regions.env_region_problem runs after .env loads in pdt validate and pdt deploy. Tests for each variable.
2 Should-fix ✅ Fixed A wrong region from a provider's CLI settings was saved and used with --yes and --plan. choose_region stops with an error before the save. Tests for each provider.
3 Should-fix ✅ Fixed A deploy error that starts with a file, such as pdt.yml: platform: unknown key, had no app name. Each deploy problem gets the app name unless it already names the app. Tests for an unknown key and a wrong docker-build.
4 Nit ✅ Fixed The Azure list did not have southeastasia3. Added.
5 Should-fix ⏸️ Not changed region: null or region: "" in an app's config hides the region that the first deploy saves in pdt.yml, so the provider uses its own default region. main has the same behavior. Not fixed in this PR.
6 Should-fix ✅ Fixed A config load error, such as platform: azure as a string, did not name the app. The load error goes through the same app-name rule. Test added.
7 Should-fix 🟡 Partly fixed Some errors named the app twice: hello: pdt.yml: apps entry 'hello', and the region error hello: platform.region in pdt.yml or hello/config.yml. The apps entry error now has no second label. The region error keeps the path hello/config.yml, because it names a file to edit.
8 Should-fix ✅ Fixed At the first deploy, a wrong region from the CLI settings stayed the offered default, and a closed input suggested saving it. pdt prints the problem, then offers its default region. Tests added.
9 Should-fix ✅ Fixed pdt init offered a wrong region from the CLI settings. suggest_region falls back to pdt's default region. Tests for each provider.

Open decisions:

  • Finding 5: save the region in the file whose empty region: hides it, or report the empty value as an error.
  • A region that a provider opens after a pdt release is an error until pdt adds it to regions.REGIONS.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

PR tier: tier::architectural (rules and Claude agree)

  • src/pdt/cli.py is the command line
  • src/pdt/config.py is config loading and validation
  • src/pdt/deploy.py is provider-neutral deploy flow
  • config.py:1188 + regions.py:57 add a hardcoded region allowlist that rejects any region a provider opens after a pdt release, removing working behaviour from existing projects until a new release ships
  • config.py calls from pdt import regions inside validate_app, a function-local import that makes config validation depend on region tables
  • branch fix/cli-list-spacing mixes a new validation rule with unrelated blank-line/next_steps spacing edits across alerts_cli.py, console.py, scaffold.py, watch.py and deploy.py

A changed diff is scored again. Job log: https://github.com/AutoIDM/pdt/actions/runs/42046260303

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant