You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
deps: update the Bluelink libraries and report unencrypted state on its own - #68
Bumps deploy-cli-sdk to the latest Bluelink library releases: blueprint v0.57.0, blueprint-state v0.13.1 and deploy-engine-client v0.6.0. It also gives state that isn't encrypted its own error message.
What this does
The bump changes how one error reaches the SDK, which is why the fix is in the same PR. Encrypted memfile state can contain files that are not encrypted, because they were written while state.encryption was turned off. When the SDK reads one of those files:
blueprint-state 0.12: builds a new error with its own message, so the SDK shows that message as the cause.
blueprint-state 0.13.1: wraps crypto.ErrNotEnvelope. ExplainError steps through the wrapping and shows the innermost message as the cause, which is the bare "payload is not an envelope".
The bump on its own makes that message worse. The fix catches this case and gives it its own summary and hint.
Reading order
fix(stateio): stateio/backend.go, wrapMemfileLoadError. It adds a check for crypto.ErrNotEnvelope before the general decryption error. On the old pins nothing reaches the check, so this commit changes no behaviour on its own.
deps: go.mod and go.sum.
backend.go drops the "written before encryption" sentence from the wrong-key hint.
stateio/encryption_test.go updates the expected messages.
Behaviour changes
State that isn't encrypted:
Summary: "some of the state is not encrypted"
Hint: run bluelink-deploy-engine reencrypt-state with the deploy engine stopped. A running engine writes its in-memory copy back over the re-encryption pass.
Error code: still ErrCodeStateDecryptionFailed. Nothing branches on the code beyond the JSON output's type.
Wrong or missing key: the hint now covers only the key and previous_keys.
Public API, state or cross-repo changes
Public API: none in this SDK.
Upstream releases: the pinned releases are already out.
Next steps: after this releases, bump the Bluelink CLI and the Celerity CLI.
Tests
Test_suggests_reencrypting_state_written_before_encryption_was_enabled now expects the new summary and hint. With the new check disabled it fails, so the test proves the check matters.
stateDecryptionHint is updated to match the shorter wrong-key hint.
Checks:scripts/lint.sh and scripts/run-tests.sh --integration pass, and so does the module-mode build. Commit 1 was also checked on its own against the old pins.
Not handled
blueprint-state's own error text still ends with "re-encrypt the state directory or start from an empty one". That text appears in the error's output after the SDK's own hint. Starting from an empty directory would leave the deployed resources untracked, so that wording should come out of blueprint-state too. This needs a small fix in blueprint-state.
Objectstore and postgres: they reject encryption, so ErrNotEnvelope can only come from memfile state.
Risk tier and review
Tier: state persistence (error reporting only).
Commit 1: self-check, then a fresh and an adversarial review. They found no wrong classification. The review changed the hint:
removed "start from an empty state directory"
added "with the deploy engine stopped"
softened it to "some state files … usually because …", since a zero-byte file from an interrupted write also matches the check
Commit 2: self-check and the falsification above.
Not verified
The CLIs haven't been run against this build. Only the SDK's suites cover it.
Improved error guidance when loading encrypted state files, distinguishing files that are not encrypted from failures caused by an incorrect encryption key.
For files that are not encrypted, guidance now recommends running bluelink-deploy-engine reencrypt-state while the deploy engine is stopped. For key mismatches, it explains how to configure rotated keys.
No actionable comments were generated in the recent review.
Walkthrough
The state loader now reports unencrypted-state errors separately from other decryption errors. The hints and tests reflect this distinction. Three Go dependency versions are updated.
Changes: State Decryption Error Guidance
Layer / File(s)
Summary
Classify decryption errors and update guidance go.mod, stateio/backend.go, stateio/encryption_test.go
The loader handles crypto.ErrNotEnvelope with an unencrypted-state message and reencrypt-state guidance. Other decryption errors retain key and rotated-key guidance. Tests check the updated hints. Three dependency versions are updated.
Merge Risk: Minimal · up to 1934f · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the two main changes: the Bluelink library dependency update and separate reporting for unencrypted state. The changeset matches both. The title is a single sentence of 12 words. It is…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It has a clear summary of the dependency bump and the new unencrypted-state error handling, with a reading order, behaviour changes, and tests.…
Full details: Title check
Explanation
The title names the two main changes: the Bluelink library dependency update and separate reporting for unencrypted state. The changeset matches both. The title is a single sentence of 12 words. It is slightly long and uses two clauses joined by 'and', but it is specific and accurate.
Full details: Description check
Explanation
The description follows the repository template closely. It has a clear summary of the dependency bump and the new unencrypted-state error handling, with a reading order, behaviour changes, and tests. It also names the checks that ran (lint.sh, run-tests.sh --integration, module-mode build). The template's Related issues section is not filled in, and the Type of change and Checklist sections are not explicitly ticked. The Testing section is present but written as prose rather than the reproduction steps the template asks for. These gaps are non-critical, so the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e8ebb3dd-8d34-4478-b0ac-5e3f03dcbe13
Commits
Reviewing files that changed from the base of the PR and between 62c9717 and 1934fbb.
Files ignored due to path filters: 1
go.sum is excluded by !**/*.sum
Files selected for processing: 3
go.mod
stateio/backend.go
stateio/encryption_test.go
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Bumps deploy-cli-sdk to the latest Bluelink library releases: blueprint v0.57.0, blueprint-state v0.13.1 and deploy-engine-client v0.6.0. It also gives state that isn't encrypted its own error message.
What this does
The bump changes how one error reaches the SDK, which is why the fix is in the same PR. Encrypted memfile state can contain files that are not encrypted, because they were written while
state.encryptionwas turned off. When the SDK reads one of those files:crypto.ErrNotEnvelope.ExplainErrorsteps through the wrapping and shows the innermost message as the cause, which is the bare "payload is not an envelope".The bump on its own makes that message worse. The fix catches this case and gives it its own summary and hint.
Reading order
fix(stateio):stateio/backend.go,wrapMemfileLoadError. It adds a check forcrypto.ErrNotEnvelopebefore the general decryption error. On the old pins nothing reaches the check, so this commit changes no behaviour on its own.deps:go.modandgo.sum.backend.godrops the "written before encryption" sentence from the wrong-key hint.stateio/encryption_test.goupdates the expected messages.Behaviour changes
bluelink-deploy-engine reencrypt-statewith the deploy engine stopped. A running engine writes its in-memory copy back over the re-encryption pass.ErrCodeStateDecryptionFailed. Nothing branches on the code beyond the JSON output'stype.previous_keys.Public API, state or cross-repo changes
Tests
Test_suggests_reencrypting_state_written_before_encryption_was_enablednow expects the new summary and hint. With the new check disabled it fails, so the test proves the check matters.stateDecryptionHintis updated to match the shorter wrong-key hint.scripts/lint.shandscripts/run-tests.sh --integrationpass, and so does the module-mode build. Commit 1 was also checked on its own against the old pins.Not handled
ErrNotEnvelopecan only come from memfile state.Risk tier and review
Not verified
🤖 Generated with Claude Code
Summary by CodeRabbit
bluelink-deploy-engine reencrypt-statewhile the deploy engine is stopped. For key mismatches, it explains how to configure rotated keys.