fix(planner): fix api_publication perpetual updates and delete composite ID bug#750
Closed
fix(planner): fix api_publication perpetual updates and delete composite ID bug#750
Conversation
… bugs - Fix shouldUpdateAPIPublication to skip auto_approve_registrations comparison when not explicitly specified in desired state (nil means "not managed"), consistent with how visibility and auth_strategy_ids are handled. This prevents perpetual false-positive UPDATE plans when the server returns a non-false auto_approve_registrations value. - Fix planAPIPublicationDelete to use just portalID as ResourceID instead of composite "apiID:portalID". The adapter's Delete method passes ResourceID directly as the portalID to DeleteAPIPublication, so passing the composite string caused invalid API calls. - Add idempotency step to portal/visibility e2e scenario to verify that running plan after initial apply shows 0 changes for publications. - Add unit tests for shouldUpdateAPIPublication covering: - Skips auto_approve_registrations when nil (idempotency) - Triggers update when auto_approve_registrations is explicitly set - Full idempotency when all fields match current state Agent-Logs-Url: https://github.com/Kong/kongctl/sessions/9e79fb8c-dabf-4c5d-8d8f-d3f714722f60 Co-authored-by: rspurgeon <10521262+rspurgeon@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Kong/kongctl/sessions/9e79fb8c-dabf-4c5d-8d8f-d3f714722f60 Co-authored-by: rspurgeon <10521262+rspurgeon@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix api_publication resources not updating properly after create
fix(planner): fix api_publication perpetual updates and delete composite ID bug
Apr 3, 2026
Collaborator
|
Closed as not applicable to the originating issue |
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.
api_publicationresources were planned for UPDATE on everyapplyrun after initial creation, and DELETE operations used an incorrect composite ID as the portal ID.Bugs Fixed
Perpetual false-positive UPDATEs (
shouldUpdateAPIPublication)auto_approve_registrationswas always compared against a hardcodedfalsedefault when not specified in the desired config. If the server returns a non-false value (e.g., when the portal'sauto_approve_applicationsistrue), every plan run generates a spurious update.Invalid DELETE calls (
planAPIPublicationDelete)ResourceIDwas set to"apiID:portalID"composite string.APIPublicationAdapter.DeletepassesResourceIDdirectly as theportalIDargument toDeleteAPIPublication, resulting in an API call with an invalid portal ID. Fixed to use onlyportalID; the API ID is already available viachange.Parent.ID.Test Coverage
shouldUpdateAPIPublication: nilauto_approve_registrationsis ignored, explicit value triggers update, full idempotency when state matches002-idempotency-checkstep inportal/visibilitye2e scenario: runsplanafter initial apply and assertstotal_changes: 0Resolves #37
Related #338