Refactor: centralize resource type and plan field identifiers#903
Merged
Refactor: centralize resource type and plan field identifiers#903
Conversation
Alias planner resource type constants to the canonical declarative resource types, type ResourceRef.Kind as resources.ResourceType, and replace planner/executor plan-field literals with shared constants. Also includes Go 1.26 mechanical updates from the repository-prescribed go fix gate.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is stage 1 of #792, refactoring the declarative planner/executor boundary to centralize resource type identifiers and plan contract field keys (reducing scattered string literals across the pipeline).
Changes:
- Centralized planner/executor contract keys via
planner.Field*constants (common fields, relationships, portal fields, and event-gateway fields). - Centralized resource type identifiers by aliasing planner resource types to canonical
internal/declarative/resourcesidentifiers. - Updated
resources.ResourceRef.Kindfromstringtoresources.ResourceTypeand propagated type-safe usage across planners/executors and tests.
Reviewed changes
Copilot reviewed 108 out of 108 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/declarative/resources/types.go | Adds new resource types and makes ResourceRef.Kind typed (ResourceType) instead of raw string. |
| internal/declarative/resources/*.go (+ tests) | Replaces dependency kind string literals with ResourceType* constants and updates tests accordingly. |
| internal/declarative/planner/constants.go | Introduces shared Field* constants and aliases ResourceType* to canonical resource identifiers. |
| internal/declarative/planner/*.go | Replaces plan field/resource type string literals with shared constants across planning, dependency resolution, and protection logic. |
| internal/declarative/executor/*.go | Replaces executor-side plan field/resource type string literals with shared constants (adapters, progress formatting, deck execution). |
| internal/declarative/common/*.go | Updates helper logic and prompts to reference shared planner field constants. |
| internal/declarative/errors/api_errors.go | Updates conflict/validation hint matching to use canonical resource type identifiers. |
| internal/declarative/protection/lookup.go | Adds new resource types to the managed/protected resource type set. |
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
Stage 1 of the cleanup requested in #792.
This PR centralizes declarative resource type and planner/executor field identifiers so the declarative pipeline no longer depends on scattered string literals for plan contracts and resource references.
What Changed
internal/declarative/resources.resources.ResourceRef.Kindfromstringtoresources.ResourceType.planner.Field*constants where those strings are part of planner/executor contracts.Reviewer Notes
This is intentionally mechanical and limited to the declarative resource/planner/executor boundary. It does not include the separate
kongctl viewcleanup, which should remain a later stage.I left domain payload keys as literals where they represent API/config subdocuments rather than planner contract fields, for example OIDC config keys, menu item keys, schema registry config paths, and selector payload keys.
Validation
make buildmake lintmake testCloses #792