Skip to content

fix(declarative): enforce saved plan execution modes - #1655

Merged
rspurgeon merged 4 commits into
Kong:mainfrom
floze-the-genius:fix/1653-apply-plan-mode-error
Jul 23, 2026
Merged

fix(declarative): enforce saved plan execution modes#1655
rspurgeon merged 4 commits into
Kong:mainfrom
floze-the-genius:fix/1653-apply-plan-mode-error

Conversation

@floze-the-genius

@floze-the-genius floze-the-genius commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enforce strict saved-plan ownership for declarative execution commands:
    • apply --plan accepts only apply-mode plans
    • sync --plan accepts only sync-mode plans
    • delete --plan accepts only delete-mode plans
  • keep diff --plan mode-neutral
  • identify the plan source, actual mode, required mode, regeneration command, and safe execution command in mismatch errors
  • retain defensive action validation for editable plan artifacts:
    • apply accepts CREATE, UPDATE, and EXTERNAL_TOOL
    • sync accepts CREATE, UPDATE, DELETE, and EXTERNAL_TOOL
    • delete accepts only DELETE
  • correct delete help that routed delete-mode plans through sync
  • make saved-plan examples generate the mode required by their execution command
  • add unit, integration, root-command, and E2E coverage for the mode and action invariants

Testing

  • go fix ./...
  • changed Go files formatted with gofumpt and golines -m 120
  • make build
  • make build-ci
  • make lint
  • make test
  • make test-integration
  • KONGCTL_E2E_SCENARIO=declarative/plan-mode-validation go test -tags=e2e ./test/e2e -run '^Test_Scenarios$' -count=1 -v

Closes #1653

@floze-the-genius
floze-the-genius requested review from a team as code owners July 19, 2026 01:43
@CLAassistant

CLAassistant commented Jul 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Trusted E2E passed for reviewed fork SHA.

This trusted E2E result applies only to the exact reviewed SHA above. Re-run trusted E2E if the contributor pushes another commit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6731cc4955

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/root/products/konnect/declarative/declarative.go Outdated
@floze-the-genius
floze-the-genius force-pushed the fix/1653-apply-plan-mode-error branch from 6731cc4 to abf46a9 Compare July 20, 2026 13:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abf46a99eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cmd/root/products/konnect/declarative/declarative.go Outdated
Comment thread docs/declarative.md Outdated
@rspurgeon rspurgeon self-assigned this Jul 21, 2026
@rspurgeon

Copy link
Copy Markdown
Collaborator

@floze-the-genius please see #1655 (comment)

thank you for your contribution

@floze-the-genius

Copy link
Copy Markdown
Contributor Author

Thanks for the reminder. I have now signed the CLA, and the license/cla status is passing on the current head SHA.

@rspurgeon

Copy link
Copy Markdown
Collaborator

Thank you @floze-the-genius . I wanted to point to some expanded information in the original issue on this
#1653 (comment)
I want to expand the behavior such that we are stricter on validating modes when apply|sync|delete commands are ran. My goal for this change is to ensure we cover all those cases as well as update documentation a bit to provide the necessary clarity (if needed).

Please let me know if you'd like to expand your PR to cover that additional requirement, otherwise I can take it from you and continue.

Thanks again

@floze-the-genius
floze-the-genius force-pushed the fix/1653-apply-plan-mode-error branch from b3fad1d to 7be4c69 Compare July 22, 2026 17:04
@floze-the-genius floze-the-genius changed the title fix(declarative): reject plans with mismatched apply modes fix(declarative): enforce saved plan execution modes Jul 22, 2026
@floze-the-genius

Copy link
Copy Markdown
Contributor Author

Thanks for the clarification. I expanded the PR to cover the full command/mode contract from #1653 and rebased it onto the latest main.

The updated implementation now:

  • enforces apply/apply, sync/sync, and delete/delete saved-plan ownership;
  • keeps diff --plan mode-neutral;
  • preserves command-specific action invariants for editable plan artifacts;
  • reports the plan source, actual mode, required mode, and the correct regeneration or safe execution workflow;
  • fixes the obsolete delete-to-sync help path and aligns saved-plan examples;
  • adds unit, integration, root-command, and E2E mismatch coverage.

The full race-enabled unit and integration suites, lint, CGO-disabled build, and the focused E2E scenario all pass on the rebased head.

@rspurgeon

Copy link
Copy Markdown
Collaborator

I pushed a small follow-up that only copy-edits the plan-mode validation errors. Suggested commands now appear on their own lines with a mock terminal prompt, and the guidance names the applicable command. There are no behavioral changes.

@floze-the-genius

Copy link
Copy Markdown
Contributor Author

The trusted E2E payload itself passed: the build, harness, and all five acceptance shards completed successfully. The red E2E Required status comes from the final shard-verification job, where actions/download-artifact found all six artifacts but then failed while fetching a signed artifact URL with 404 Not Found: workflow run not found.

This appears to be a transient artifact-service/verifier failure rather than a test failure on 2b4a97e6. Could you rerun the trusted E2E workflow when convenient?

@rspurgeon
rspurgeon merged commit 36c01ae into Kong:main Jul 23, 2026
16 checks passed
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.

Task: Improve error message for loading of plan files into commands in different modes

3 participants