Skip to content

Refactor: centralize resource type and plan field identifiers#903

Merged
rspurgeon merged 2 commits intomainfrom
gh-792-type-names
Apr 26, 2026
Merged

Refactor: centralize resource type and plan field identifiers#903
rspurgeon merged 2 commits intomainfrom
gh-792-type-names

Conversation

@rspurgeon
Copy link
Copy Markdown
Collaborator

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

  • Added planner field constants for common plan fields, relationship fields, portal fields, and event-gateway fields.
  • Aliased planner resource type constants to the canonical identifiers in internal/declarative/resources.
  • Changed resources.ResourceRef.Kind from string to resources.ResourceType.
  • Replaced planner and executor resource-type literals with constants across declarative planning, execution, state error context, dependency resolution, and progress/prompt formatting.
  • Replaced required-field and plan-field map key literals with shared 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 view cleanup, 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 build
  • make lint
  • make test

Closes #792

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.
@rspurgeon rspurgeon changed the title declarative: centralize resource type and plan field identifiers Refactor: centralize resource type and plan field identifiers Apr 26, 2026
@rspurgeon rspurgeon had a problem deploying to kongctl-acceptance-4 April 26, 2026 15:59 — with GitHub Actions Failure
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-2 April 26, 2026 15:59 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance April 26, 2026 15:59 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-5 April 26, 2026 15:59 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-3 April 26, 2026 15:59 — with GitHub Actions Inactive
@rspurgeon rspurgeon marked this pull request as ready for review April 26, 2026 16:00
@rspurgeon rspurgeon requested a review from a team as a code owner April 26, 2026 16:00
Copilot AI review requested due to automatic review settings April 26, 2026 16:00
@rspurgeon rspurgeon requested a review from a team as a code owner April 26, 2026 16:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/resources identifiers.
  • Updated resources.ResourceRef.Kind from string to resources.ResourceType and 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.

Comment thread internal/declarative/planner/planner.go
Comment thread internal/declarative/planner/dependencies.go Outdated
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-4 April 26, 2026 16:14 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-5 April 26, 2026 16:14 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-3 April 26, 2026 16:14 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance April 26, 2026 16:14 — with GitHub Actions Inactive
@rspurgeon rspurgeon had a problem deploying to kongctl-acceptance-2 April 26, 2026 16:14 — with GitHub Actions Failure
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-2 April 26, 2026 16:21 — with GitHub Actions Inactive
@rspurgeon rspurgeon merged commit 2a1919d into main Apr 26, 2026
29 of 32 checks passed
@rspurgeon rspurgeon deleted the gh-792-type-names branch April 26, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Implement a consistent resource type, name, field name identifier usage across the codebase

2 participants