Repository navigation
Leave the state file untouched when an apply changes nothing - #152
Merged
Merged
Conversation
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]>
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]>
BStarmerSmith
approved these changes
Oct 7, 2026
achever1
approved these changes
Oct 7, 2026
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
main's integration test fails onTest_Apply_With_State_Subsequent_Run_No_Changes: applying the same group twice changed the state file'slastUpdated. Since Stop apply --enable-state deleting resources whose metadata changed #148, re-applying a managed resource replaces its entry with the latest metadata, which is intended, but it also bumpedlastUpdatedevery time, so every run rewrote the state. The test only caught it when its two applies straddled a second, which is why Stop apply --enable-state deleting resources whose metadata changed #148 passed its own CI.Test_Apply_Gateway_Resourcesflakes one run in a hundred: the random interceptor fixture could draw priority0, which Gateway rejects (priority must be greater than or equal to 1). It did on Plan creates with diffs, and apply the deletes of an emptied folder #149.Changes
AddManagedResourceleaves the entry andlastUpdatedalone when the stored entry is already identical; a real metadata change (labels, description) still updates both.lastUpdatedacross an unchanged re-apply and a relabel.1 + rand.IntN(100).Notes
ghodss/yaml), so their metadata has the same Go types as a state loaded from JSON andreflect.DeepEqualcompares them reliably.go test ./...andgo vet ./...pass locally; the integration suite needs a license, so this PR's CI run is its check.