Repository navigation
Stop apply --enable-state deleting resources whose metadata changed - #148
Merged
Merged
Conversation
This was referenced Oct 6, 2026
99-not-out
added this pull request to stack #150
October 6, 2026 16:12
99-not-out
marked this pull request as ready for review
October 6, 2026 16:15
99-not-out
force-pushed
the
fix/state-identity
branch
from
October 7, 2026 08:25
e3fa7a0 to
1c2963a
Compare
The state matched a resource it had applied against the files by all of its metadata. Changing a topic's description, or giving it a first label, made the applied topic look removed: apply deleted it and created it again, losing its data. The state now identifies a resource by its kind, name and the parents its path or query needs (a Gateway resource's vCluster, an interceptor's scope), and keeps the latest metadata of a resource applied again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B464sFQc8q6VkehfkByBaX
99-not-out
force-pushed
the
fix/state-identity
branch
from
October 7, 2026 08:57
1c2963a to
c53a0fc
Compare
BStarmerSmith
approved these changes
Oct 7, 2026
99-not-out
added a commit
that referenced
this pull request
Oct 7, 2026
* fix(state): leave the state file untouched when nothing changed Since #148 re-applying a managed resource replaces its entry with the latest metadata, but it also bumped lastUpdated on every apply, so a run that changed nothing still rewrote the state file. Only replace the entry, and bump lastUpdated, when the stored entry actually differs. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test: never give the random interceptor fixture priority 0 Gateway rejects an interceptor priority below 1, and rand.IntN(100) drew 0 one run in a hundred. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
What & why
With
--enable-state, apply works out what to delete by matching each resource in the state against the files. It matched by all of a resource's metadata, so changing a Topic'smetadata.description, or giving it a first label, made the applied topic look removed: apply deleted it and created it again — its messages are lost. Any metadata edit to a stateful resource can do this, and nothing in the output says the delete is a recreate (a dry run shows one delete and one update).Changes
vCluster, an interceptor'sscope(Catalog.StateIdentity) — passed in where the state is loaded. Without it the old comparison is kept.Notes
Updated, where it was deleted and recreated, and the description reaches the Console.