Skip to content

fix(config): return ("", nil) from GlobalVersion when unconfigured#221

Merged
CalvinAllen merged 1 commit intomainfrom
fix/config/auto-global-install
Feb 9, 2026
Merged

fix(config): return ("", nil) from GlobalVersion when unconfigured#221
CalvinAllen merged 1 commit intomainfrom
fix/config/auto-global-install

Conversation

@CalvinAllen
Copy link
Contributor

Summary

  • Fixed config.GlobalVersion() returning an error for "unconfigured" states (missing config file, runtime not in config), which caused autoSetGlobalIfNeeded() to skip auto-setting the global version on the first install of a runtime on a clean system
  • Changed GlobalVersion() to return ("", nil) for unconfigured states, reserving errors for actual failures (I/O errors, corrupt JSON)
  • Updated provider test harness to accept ("", nil) as valid from GlobalVersion()
  • Added tests for clean system scenarios and I/O error handling

Test plan

  • TestGlobalVersion_NoConfigFile — verifies ("", nil) when no config file exists
  • TestGlobalVersion_RuntimeNotInConfig — verifies ("", nil) when runtime is absent from config
  • TestAutoSetGlobalIfNeeded_GlobalVersionError — verifies auto-global is skipped on real errors
  • All existing tests pass (go test ./...)
  • go vet ./... clean

Closes #220

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
@CalvinAllen CalvinAllen merged commit 71b446a into main Feb 9, 2026
12 checks passed
@CalvinAllen CalvinAllen deleted the fix/config/auto-global-install branch February 9, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Auto Global on Install Doesn't Appear to be Working

1 participant