fix: use active product version [APIAPEX-2731]#75
Merged
Conversation
68e636b to
69f3a18
Compare
69f3a18 to
14e4503
Compare
There was a problem hiding this comment.
Pull request overview
Renames and reworks the datastore lookup so that vcr init resolves a product template's active version (via Products_by_pk.active_version_id) instead of picking the most recently created version, which could be a draft. The interface, mocks, callers, tests, and user-facing strings are updated accordingly.
Changes:
- Replace
GetLatestProductVersionByIDwithGetActiveProductVersionByID, querying the product'sactive_version_idand then resolving that version by primary key. - Update the
initcommand spinner/error messages and theDatastoreInterface+ generated mock to use the new name. - Refactor
datastore_test.goto support sequenced GraphQL responses and add coverage for empty active id, missing active version, and the "newer draft exists" regression; add a matching error-path test ininit_test.go.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/api/datastore.go | Implements new two-step active-version lookup with new request/response types and ErrNotFound handling. |
| pkg/api/datastore_test.go | Switches mock to a per-call response sequence and adds new edge-case and regression tests. |
| pkg/cmdutil/factory.go | Renames the method on DatastoreInterface. |
| testutil/mocks/factory.go | Regenerated mock for the renamed method. |
| vcr/init/init.go | Calls the new method and updates spinner/error wording to "active". |
| vcr/init/init_test.go | Renames mock fields and adds an error-path test for active version not found. |
Files not reviewed (1)
- testutil/mocks/factory.go: Language not supported
Copilot stopped work on behalf of
DKVON-prog due to an error
May 19, 2026 07:19
cd81a73 to
d7d9fb3
Compare
sichan-vonage
approved these changes
May 20, 2026
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.
No description provided.