fix: Migrate off deprecated GraphQL APIs - #118
Open
howbazaar wants to merge 2 commits into
Open
Conversation
Repository, account-group, policy-collection, and binding commands now use the platform's non-deprecated GraphQL fields/mutations (repositoryConfig, accountMappings/upsertAccountGroupMappings/removeAccountGroupMappings, policyMappings, executionConfig) instead of ones marked @deprecated in the schema. Some CLI options that no longer have a schema equivalent were dropped (repository add's branch/suffix/directory/deep-import options, repository process/scan/show/remove's --url in favor of --uuid, account-group add-item's --provider); account-group remove-item keeps its existing --key/--provider interface via an internal mapping-id lookup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| stacklet/client/platform/commands/account_group.py | Adds cursor-based mapping lookup before removal, resolving the previously reported 1000-entry limit. |
| stacklet/client/platform/graphql/snippets/account_group.py | Migrates account-group fields and mutations to account-mapping APIs. |
| stacklet/client/platform/graphql/snippets/repository.py | Migrates repository operations and response shapes to repository-config APIs. |
| stacklet/client/platform/graphql/snippets/binding.py | Moves binding variables into executionConfig for queries and mutations. |
| stacklet/client/platform/graphql/snippets/policy_collection.py | Replaces deprecated policy-collection item fields with policy-mapping connections. |
| tests/test_account_group.py | Verifies account-mapping add, lookup, pagination, removal, and missing-item behavior. |
| tests/test_repository.py | Updates repository command coverage for the replacement GraphQL API. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
CLI[account-group remove-item] --> Lookup[Query accountMappings page]
Lookup --> Match{Mapping found?}
Match -- Yes --> Remove[Remove mapping by opaque ID]
Match -- No, next page --> Cursor[Advance with endCursor]
Cursor --> Lookup
Match -- No more pages --> Error[Report mapping not found]
Reviews (2): Last reviewed commit: "fix: Page through all account-group mapp..." | Re-trigger Greptile
The account-group remove-item lookup only checked the first 1000 mappings, so accounts past that page were reported as missing and couldn't be removed. Follow pageInfo.hasNextPage/endCursor until the account is found or every page has been checked. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
jtroup
approved these changes
Jul 31, 2026
jtroup
left a comment
Contributor
There was a problem hiding this comment.
Seems reasonable - please either complete the last test in the checklist, or remove the item before comitting. Thanks @howbazaar
Contributor
Author
|
Running against platform functional tests as additional end to end checks. |
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.
Summary
stacklet-adminoff GraphQL fields/mutations marked@deprecatedin the platform schema, across the repository, account-group, policy-collection, and binding domains.repositorycommands move from the legacyrepository/repositories/addRepository/removeRepository/processRepositoryAPI torepositoryConfig/repositoryConfigs/addRepositoryConfig/removeRepositoryConfig/triggerRepositoryScan. As a result:repository adddrops--branch-name,--policy-file-suffix,--policy-directory,--deep-import(no longer accepted byaddRepositoryConfig).repository process/scan/show/removetake--uuidinstead of--url;repository scandrops--start-rev-spec.account-groupcommands moveAccountGroup.items/itemCounttoaccountMappings, andaddAccountGroupItems/removeAccountGroupItemstoupsertAccountGroupMappings/removeAccountGroupMappings.remove-itemkeeps its existing--uuid/--key/--providerinterface via an internal mapping-id lookup (paginated, so it works past the first page), since the new mutation needs an opaque mapping id.add-itemdrops--provider(unused by the new mutation).policy-collectioncommands movePolicyCollection.items/itemCounttopolicyMappings(theadd-item/remove-itemmutations themselves were not deprecated, so no CLI interface change there).bindingcommands move the deprecated top-levelvariablesarg/field to the structuredexecutionConfig { variables }.Test plan
uv run pytest tests/— 90 passeduv run ruff check .uv run ruff format --check .uv run ty check stacklet/uv run deptry .repository list/repository show— confirmed realRepositoryConfigdata comes back correctly shaped viarepositoryConfigs/repositoryConfig.policy-collection list— confirmedpolicyMappings.pageInfoshape.account-group add(with--region),add-item,show— confirmed the newaccountMappingsshape end-to-end (create group → add mapping → verify mapping visible).account-group remove-item— confirmed the mapping-id lookup pre-check resolves correctly and the mapping is actually removed (this is the path fixed for pagination per Greptile's review comment on this PR).account-group remove/account remove— cleanup succeeded.binding list— query accepted by the schema (no existing bindings locally to exercise theexecutionConfiground-trip on add/update).account-group addrequires--regionfor AWS groups — pre-existing server-side validation unrelated to this migration, just something to be aware of when testing.repository add(needs a reachable git URL) andbinding add/update(no binding fixture available locally).🤖 Generated with Claude Code