direct: Warn when state was written by a newer CLI version - #6173
Open
denik wants to merge 2 commits into
Open
Conversation
Contributor
Approval status: pending
|
Collaborator
Integration test reportCommit: d95d7b2
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 4 slowest tests (at least 2 minutes):
|
resources.json records the CLI version that last wrote it. Warn on plan/deploy when that version is newer than the running build.
The fixtures recorded cli_version 0.0.0 as a placeholder; with dev builds reporting a real version this no longer looks newer than the running CLI, so they need no change. Update the version comparison tests to use real dev versions instead of the old 0.0.0-dev scheme.
denik
force-pushed
the
denik/cli_version_warning
branch
from
August 6, 2026 12:33
fbf38ab to
d95d7b2
Compare
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.
Stacked on #6189.
Why
resources.json already records the CLI version that last wrote it, but nothing looks at it.
Deploying with an older CLI than the one that wrote the state is allowed, but it is usually
unintended, so warn about it. The state_version field remains the hard gate — dstate.Open rejects a
schema it cannot read.
Tests
Acceptance test with a committed resources.json fixture recording cli_version 99.0.0, since the
running version is only known at test time. The negative case derives cli_version from $CLI version
and asserts silence. Unit test on the comparison covers dev builds, prereleases and malformed
versions.