Atomic CLI related leftovers around name based lookups - #3798
Conversation
✅ Deploy Preview for golemcloud canceled.
|
|
📖 Docs preview: https://docs-eq5x12xei-golem-cloud.vercel.app Built from commit |
# Conflicts: # cli/golem-cli/src/command.rs # cli/golem-cli/src/command_handler/account.rs # golem-registry-service/tests/repo/mod.rs # golem-registry-service/tests/repo/postgres.rs # golem-registry-service/tests/repo/sqlite.rs
#3824 added `leadership` to golem_shard_manager::RunDetails; #3840's local_server_system_memory_override test constructs RunDetails without it, so the golem lib test failed to compile (a semantic conflict that landed on main). the test only exercises memory-config plumbing, so leadership: None. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5f7dgMarefJrfRRd9Xmww
|
secret, retry-policy, domain and security-scheme by-path/by-name lookups loaded the environment via EnvironmentService::get, which enforces EnvironmentVerb::View, purely to read the ownership triple for the permission target. a caller holding only the resource grant (but no environment view) got a 404, while the by-id lookup succeeded. add EnvironmentService::get_owner_unchecked and authorize the resource directly against it, matching the by-id path.
for secrets, retry-policies, security-schemes and domains: grant view on a single resource without environment-view, and assert the by-path/by-name lookup succeeds (it 404'd before the fix).
get_account_plugin authorizes on the plugin grant alone, but the CLI's --account <email> scope resolved the email through get_account_by_email, which requires AccountVerb::View, so it needed more than --account-id. add a by-email endpoint that resolves the owner account without an account-view check (via a new AccountService::resolve_account_id_by_email_unchecked) and authorizes the plugin grant, matching the by-id form. regenerate openapi spec and rest-api docs.
add AccountHandler::select_account_scope_or_err returning the scope without collapsing an email to an id up front. plugin get and unregister now dispatch --account <email> to the by-email endpoint and --account-id to the by-id one, so the email scope no longer requires AccountVerb::View.
with only a plugin-view grant (no account-view), assert the by-email lookup is 404 before the grant and succeeds after, matching the by-id and account-id forms.
# Conflicts: # golem-registry-service/src/api/agent_secrets.rs # integration-tests/tests/api/agent_secret.rs
domain registration is globally unique, so reusing test1.golem.cloud collided with register_and_fetch_domain and failed with DOMAIN_ALREADY_EXISTS before the permission check ran. use test6.golem.cloud.
only the missing-account case should map to not-found; db/decoding errors from the unchecked email resolution were being turned into 404, unlike the by-id endpoint.
--account <EMAIL>/--account-id <UUID>scope to account, card, and plugin commands--ididentities, with documented conflicts and explicit-account list semantics