## [mirendev/runtime#1359](https://github.com/mirendev/runtime/pull/1359) 5cc4c8d fixes the `AppCentric` problem from my last review, so this is ready for a human reviewer. I found one smaller gap in the new options struct, noted inline. It isn't a blocker. I checked the new `CloudAppOptions` (`cloud.go:466-504`) against each of the three problems: - **`MIREN_CLUSTER`:** `Cluster` is now a plain `short:"C" long:"cluster"` field with no `env` tag. Without `-C`, the `{cluster}` placeholder stays empty and `cloudInput` fails with `--cluster is required` before any request goes out. The "runtime cluster environment is not a Cloud ID" case in `TestCloudAppContextInvoke` sets `MIREN_CLUSTER`, then asserts that error and zero requests. - **Runtime dial:** the struct has no `LoadCluster`, so `setup()` in `global.go` only reaches its `LoadConfig` branch, and that just reads the client config. `TestCloudAppDoesNotDialRuntime` uses a live UDP listener to check that no packets go out. - **Init prompt:** `Validate` only fills `App` from `app.toml` and never prompts. `TestCloudAppMissingNameDoesNotInitialize` asserts the `--app is required` error and that no `.miren` directory is created. I'm resolving my thread. **New, non-blocking:** `CloudAppOptions.Validate` doesn't have the sandbox guard that `AppCentric.Validate` has (`app.go`, the `MIREN_RUNTIME_APP` block). Inside a sandbox, `MIREN_APP` is injected as an alias for the sandbox's own app name. `AppCentric` notices this and defers to the local `app.toml`. The new code returns as soon as `o.App` is non-empty. So `miren cloud app show`, run in a sandbox from another app's directory, shows the sandbox's app instead of the one in `app.toml`. The description says these commands keep `MIREN_APP`/`app.toml` selection, and this is the one case where they don't. The test explicitly clears `MIREN_RUNTIME_APP`, so it never exercises this path. The effect is narrow and read-only, but it's cheap to fix. Details are in the inline comment. The org-ID thread at `cloud.go:272` is still waiting for a person to close it. I'm not recommending approval without a human review. This PR adds a large set of commands that write to an external service, and the tests check them against mocks built on the same assumptions about Cloud's API as the code. Your source-level checks against the Cloud handlers help. Someone familiar with Cloud should still look over the write paths before merge: member role PUT, cluster PATCH, invite PATCH, subdomain assign, and token revoke. ## Inline comments - **cli/commands/cloud.go:477** — Returning early whenever `o.App` is set skips the sandbox guard in `AppCentric.Validate` (`app.go`, the `MIREN_RUNTIME_APP` / `RuntimeEnvAliases` block). Inside a sandbox, `MIREN_APP` is injected as the sandbox's own app name. mflags copies it into `o.App`, so this returns before `app.toml` is ever read. Running `cloud app show` from another app's directory inside a sandbox then targets the sandbox's app instead of the `app.toml` in front of the user. `AppCentric` exists partly to prevent exactly that. Suggested fix: load the local config first. Then, when `MIREN_RUNTIME_APP` is set, `o.App` equals both it and the legacy `MIREN_APP`, and the config has a name, use the config's name. The cleanest way is probably to pull that check out of `AppCentric.Validate` into a small shared helper, so the two copies can't drift apart. A test case with `MIREN_RUNTIME_APP=env-web` and `MIREN_APP=env-web` that expects `local-web` would cover it. Today `TestCloudAppContextInvoke` clears `MIREN_RUNTIME_APP`. ## Replies to existing threads _Posted to the PR's comment threads when you submit._ - _(reply & resolve: addressed)_ 5cc4c8d fixes all three problems: - `CloudAppOptions` is now its own struct, and its `Cluster` field has no `env` binding. - There's no `LoadCluster` hook for `setup()` to call. - `Validate` only fills the app name from `app.toml`, so a missing name ends in `--app is required` instead of an init prompt. The environment case in `TestCloudAppContextInvoke` now sets `MIREN_CLUSTER` and expects `--cluster is required` with zero requests, which is what I asked for. The UDP-listener test and the no-`.miren` test also cover the other two directly. Thanks, I'm resolving this. I've left a separate, smaller note at line 477: the sandbox `MIREN_RUNTIME_APP` guard didn't carry over to the new struct. --- **Verdict:** ready