[bugfix] Write back lockfile after devbox update #1291
Merged
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.
Summary
After calling
devbox update
, we were not writing back todevbox.lock
.ensurePkgsAreInstalled
would then return early because the local lock file hadn't changed (since it re-readsdevbox.lock
from disk, rather than using the updated in-memory lockfile), so it would skip writing the lockfile as well.This also makes the lockfile a bit more self-healing, since it will overwrite the current user's sysInfo entirely, rather than just adding the CAStorePath. This ensures that the StorePath and CAStorePath are written together.
How was it tested?
Manually, but plan to add testscripts in separate PR. I tested a few different scenarios, notably:
devbox update
adds system info for current user without changing system info for other systems.devbox update
will restore it.devbox shell
, then we'll print a warning instructing the user to rundevbox update
. Calling it will then actually fix the lockfile and the warning will not be reprinted. It's worth mentioning that the warning will only be shown once to the user, because then they'll cache print-dev-env, so we won't re-exercise the path that computes CAStorePath. Not super ideal, but good enough I think.