feat(project): accept a project ID in --project and other alias options (CLI-22) - #812
Conversation
keboola-pr-reviewer-bot
left a comment
There was a problem hiding this comment.
reviewer could not complete: opencode exited 1: (no stderr — check the reviewer logs for the trace summary)
Retry with @keboola-pr-reviewer review once the underlying issue clears.
|
@keboola-pr-reviewer review |
keboola-pr-reviewer-bot
left a comment
There was a problem hiding this comment.
reviewer could not complete: reviewer model call errored (subtype=success, api_status=400) after 1/18 turn(s).
Retry with @keboola-pr-reviewer review once the underlying issue clears.
zajca
left a comment
There was a problem hiding this comment.
Actionable findings from the automated review.
zajca
left a comment
There was a problem hiding this comment.
No actionable findings were found by the automated review.
What was wrong
--projectand the other options that name a registered project accepted only its alias. A user who knows a project by its ID had to find the alias first, although kbagent stores the ID of each registered project (project_id).What changed
--projecton every command (single and repeatable),project use,KBAGENT_PROJECT,sync clone --target,config clone --target-project, the project options ofsemantic-layer promoteanddiff,--stackon theauthcommands, and the{project},?project=,{alias},?alias=and/auth/*?stack=parameters ofkbagent serve.1234keeps its meaning, and kbagent looks up the ID only when no alias matches. When that alias is also the ID of another registered project, stderr shows a warning that names the alias of the other project, also with--json.CONFIG_ERRORwith the list of aliases and stacks. Exception: when all matches are on the same stack and exactly one has a session token, kbagent uses that alias.commands/_project_ref.pyadds a Click parameter callback to each of these options when the root group is built, so services receive only aliases.project add,project createandlineage showare excluded, because their--projectnames a new alias or filters an offline file.Project ID 4242 resolved to alias 'prod'to stderr. JSON output does not change, becausetargetsandproject_aliasalready name the alias.Behavior changes
project invite --from-csv: theprojectcolumn follows the same rules (alias first, an ambiguous ID is an error). Before, a numeric value was always an ID, and the first matching project was used. Theproject_idcolumn is still always an ID. One difference from--project: when a digits-only alias is also the ID of a different registered project, the row fails and names both, because an invite grants membership and a bulk run has no notice that a person reads first.project currentreports an ambiguousKBAGENT_PROJECTin the new fieldenv_error.Limits
kbagent servedoes not translate request bodies.request._query_params), because FastAPI reads the query before the dependency changes it.tests/test_server_project_ref.py::test_query_param_project_ids_reach_service_as_aliasesfails if a Starlette upgrade changes this.Tests
tests/test_project_ref.pywalks the Click tree, checks the walk against a second one, and runs each command that has--project, and each entry of the alias-option tables, through the real root with a project ID. Each command must receive the alias, and the excluded commands must receive the ID. Another test requires each option whose flag containsproject,aliasorstackto be translated or listed with a reason.project use,project current, the CSV invite and REST.make checkpasses. The CLI also starts with Typer 0.24.2, which does not includetyper._click.Docs:
gotchas.md(since vNEXT),commands-reference.md,keboola-expert.md,context.py,CLAUDE.md,CONTRIBUTING.md. No version bump, no changelog entry.Fixes CLI-22