fix(kafka): align revoke grant arguments - #774
Conversation
📝 Changelog previewBelow is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog. v5.49.1 - 2026-09-10Full Changelog: v5.49.0...v5.49.1 🐛 Bug Fixes |
There was a problem hiding this comment.
🟡 Changes recommended
Autocomplete currently fetches team-wide topic grants even when completing the final access argument, which can be significantly more data than needed and may degrade shell completion performance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aligns the revoke-grant command’s positional arguments to username topic access, and updates Kafka grant autocomplete and GraphQL client code to support the new flow.
Changes:
- Reordered
revoke-grantarguments and moved access validation into the command’sValidateFunc. - Added a team/environment-scoped GraphQL query and helper to fetch Kafka topic ACL grants across topics (used by autocomplete).
- Updated
schema.graphqland regenerated the GraphQL client types/operations.
File summaries
| File | Description |
|---|---|
| schema.graphql | Adds Kafka topic update activity log enum/type definitions to the schema. |
| internal/naisapi/gql/generated.go | Regenerates genqlient output to include the new GetTeamKafkaTopicGrants query and types. |
| internal/kafka/kafka.go | Adds TopicGrant and GetTeamKafkaTopicGrants helper to list grants across team topics in an environment. |
| internal/kafka/command/revoke_grant.go | Reorders args to username topic access, adds access validation, and updates autocomplete to match. |
| internal/kafka/command/list_grants_test.go | Updates the revoke-grant command arg-order expectation. |
| internal/kafka/command/flag/flag.go | Changes KafkaTopicGrantAccess.Validate() to a value receiver and simplifies empty/invalid checks. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| grants, err := kafka.GetTeamKafkaTopicGrants(ctx, flags.Team, flags.Environment) | ||
| if err != nil { | ||
| return nil, "Unable to fetch Kafka topic grants." | ||
| return nil, "Unable to fetch Kafka grants." | ||
| } |
No description provided.