Skip to content

Leave the state file untouched when an apply changes nothing - #152

Merged
99-not-out merged 2 commits into
mainfrom
fix/state-unchanged-on-reapply
Oct 7, 2026
Merged

99-not-out merged 2 commits into
mainfrom
fix/state-unchanged-on-reapply

Conversation

@99-not-out

@99-not-out 99-not-out commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: An apply that changes nothing no longer rewrites the state file, which fixes the integration test failing on main since #148.

What & why

Changes

  • AddManagedResource leaves the entry and lastUpdated alone when the stored entry is already identical; a real metadata change (labels, description) still updates both.
  • Unit test pinning lastUpdated across an unchanged re-apply and a relabel.
  • Fixture priority is 1 + rand.IntN(100).

Notes

  • Resources are parsed YAML→JSON (ghodss/yaml), so their metadata has the same Go types as a state loaded from JSON and reflect.DeepEqual compares them reliably.
  • go test ./... and go vet ./... pass locally; the integration suite needs a license, so this PR's CI run is its check.
  • Plan creates with diffs, and apply the deletes of an emptied folder #149 needs rebasing onto this once merged.

99-not-out and others added 2 commits October 7, 2026 11:02
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]>
@99-not-out
99-not-out merged commit ffe8e05 into main Oct 7, 2026
7 checks passed
@99-not-out
99-not-out deleted the fix/state-unchanged-on-reapply branch October 7, 2026 10:40
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.

3 participants