Skip to content

direct: Warn when state was written by a newer CLI version - #6173

Open
denik wants to merge 3 commits into
denik/state_cli_versionfrom
denik/cli_version_warning
Open

direct: Warn when state was written by a newer CLI version#6173
denik wants to merge 3 commits into
denik/state_cli_versionfrom
denik/cli_version_warning

Conversation

@denik

@denik denik commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Stacked on #6222, which makes cli_version record the CLI that last wrote the state — without that this
warning reads a value that can be many releases stale.

Why

resources.json 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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

6 files changed
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @andrewnester, @pietern, @lennartkats-db, @anton-107

/bundle/ - needs approval

Files: bundle/direct/dstate/state.go
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @andrewnester, @pietern, @lennartkats-db, @anton-107

/cmd/bundle/ - needs approval

Files: cmd/bundle/utils/process.go, cmd/bundle/utils/process_test.go
Suggested: @janniklasrose
Also eligible: @shreyas-goenka, @andrewnester, @pietern, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/state-newer-cli-version-warning.md
Based on git history:

  • @janniklasrose -- recent work in .nextchanges/bundles/, bundle/direct/dstate/, cmd/bundle/utils/

Any maintainer (@andrewnester, @anton-107, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 855f637

Run: 31491966098

Env ❌​FAIL 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
❌​ aws linux 1 1 3 4 294 1131 8:13
❌​ aws windows 1 1 3 4 296 1129 8:15
❌​ azure linux 1 1 3 4 293 1131 9:09
❌​ azure windows 1 1 3 4 295 1129 9:06
❌​ gcp linux 1 1 1 5 293 1131 9:01
❌​ gcp windows 1 1 5 296 1129 9:26
10 interesting tests: 4 SKIP, 3 RECOVERED, 1 KNOWN, 1 FAIL, 1 flaky
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K 🟨​K
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
❌​ TestAccept/pipelines/destroy/cascade-on-destroy-terraform-error ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestSyncNestedFolderDoesntFailOnNonEmptyDirectory ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 1 slowest tests (at least 2 minutes):
duration env testname
3:18 aws windows TestFilerRecursiveDelete/workspace_files_extensions

@denik
denik force-pushed the denik/cli_version_warning branch from fbf38ab to d95d7b2 Compare August 6, 2026 12:33
@denik
denik changed the base branch from main to denik/dev_version August 6, 2026 12:33
@denik
denik force-pushed the denik/cli_version_warning branch 2 times, most recently from a1bed90 to 360b44a Compare August 9, 2026 12:16
@denik
denik force-pushed the denik/dev_version branch from 89ebed2 to 66dfc90 Compare August 9, 2026 12:43
@denik
denik force-pushed the denik/cli_version_warning branch from 360b44a to 0205b80 Compare August 9, 2026 12:44
Base automatically changed from denik/dev_version to main August 9, 2026 13:22
@denik
denik force-pushed the denik/cli_version_warning branch from 0205b80 to 2a6fa17 Compare August 11, 2026 10:19
@denik
denik changed the base branch from main to denik/state_cli_version August 11, 2026 10:19
@denik
denik force-pushed the denik/state_cli_version branch from 4f78708 to 4b2f17d Compare August 11, 2026 12:33
denik added 3 commits August 11, 2026 14:33
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
denik force-pushed the denik/cli_version_warning branch from d6fea59 to 855f637 Compare August 11, 2026 12:34
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.

2 participants