fix(config): return ("", nil) from GlobalVersion when unconfigured#221
Merged
CalvinAllen merged 1 commit intomainfrom Feb 9, 2026
Merged
fix(config): return ("", nil) from GlobalVersion when unconfigured#221CalvinAllen merged 1 commit intomainfrom
CalvinAllen merged 1 commit intomainfrom
Conversation
On a clean system with no ~/.dtvem/config/runtimes.json, installing the
first version of a runtime should auto-set it as the global default.
This failed because GlobalVersion() returned an error when the config
file was missing, and autoSetGlobalIfNeeded() bailed out on any error.
Change GlobalVersion() to return ("", nil) for two "unconfigured" states
(missing config file, runtime not in config) instead of an error. Reserve
errors for actual failures (I/O errors, corrupt JSON).
Closes #220
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.
Summary
config.GlobalVersion()returning an error for "unconfigured" states (missing config file, runtime not in config), which causedautoSetGlobalIfNeeded()to skip auto-setting the global version on the first install of a runtime on a clean systemGlobalVersion()to return("", nil)for unconfigured states, reserving errors for actual failures (I/O errors, corrupt JSON)("", nil)as valid fromGlobalVersion()Test plan
TestGlobalVersion_NoConfigFile— verifies("", nil)when no config file existsTestGlobalVersion_RuntimeNotInConfig— verifies("", nil)when runtime is absent from configTestAutoSetGlobalIfNeeded_GlobalVersionError— verifies auto-global is skipped on real errorsgo test ./...)go vet ./...cleanCloses #220