fix(components): resolve stack version for config GET via --stack-version flag (CLI-124)#457
Open
fhacloid wants to merge 4 commits into
Open
fix(components): resolve stack version for config GET via --stack-version flag (CLI-124)#457fhacloid wants to merge 4 commits into
fhacloid wants to merge 4 commits into
Conversation
… (CLI-124) The CLI omitted the ?service_catalog_source_version_id query param when fetching component config, causing the API to return a stale version. Auto-resolve the latest version by fetching the component's stack ref and calling resolveStackVersion with empty hints (matching console behavior). An explicit --service-catalog-source-version-id flag is also added to config_get for version pinning. create/update callers now also pass the resolved latest version when pre-loading current config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…CLI-124) Replace the internal uint32 --service-catalog-source-version-id flag with the standard --stack-version flag (tag/branch/sha/id) using the same cyargs.AddStackVersionFlags + ResolveStackVersionArg pattern as other stack commands. Internally the middleware still resolves via resolveStackVersion to service_catalog_source_version_id before the config GET. Default (no flag) auto-resolves the catalog branch head, matching console behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…get (CLI-124) --stack-version=version:<id> bypasses stack ref resolution and passes the catalog source version ID directly to the config GET, useful for debugging by known ID. Other --stack-version forms (tag:/branch:/sha:) and the default auto-resolve-latest path are unchanged. ResolveStackVersionArg returns an informative error if version:<id> is used with commands that cannot accept a raw ID. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…to package (CLI-124) - cyargs.GetStackVersionID parses --stack-version=version:<id> so consumers do not inline flag reading - config_get.go uses GetStackVersionID; drops fmt/strconv/strings imports - verbose WHAT comment removed from GetComponentConfig - ComponentConfigServer moved to offline/mockserver package with exported constants; component_config_test.go references them Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
`GetComponentConfig` made a bare `GET .../config` with no query params. The API returns the config pinned to an older stack commit when `service_catalog_source_version_id` is omitted — the console always passes it (`?service_catalog_source_version_id=`), so the CLI was returning stale fields (missing new widgets, new credential keys, etc.).
Evidence:
Fix
`GetComponentConfig` now:
When no version flag is given (default), all three args are empty → `resolveStackVersion` returns the catalog-repo branch head, which is exactly what the console does.
User-facing flags
`cy component config get` now accepts `--stack-version` via `cyargs.AddStackVersionFlags` — same surface as every other stack command:
`ResolveStackVersionArg` returns an informative error if `version:` is used with commands that don't support raw IDs.
Changed files
Tests
Four offline tests (no backend required) — all pass:
`golangci-lint run --new-from-rev=develop` → 0 new issues.
Closes CLI-124