refactor(lib): remove dead export-env blocks (ADR-025 blocker 4)

Two export-env blocks in lib_provisioning/ ran at module load time as side
effects of the lib_provisioning/mod.nu star-import chain. ADR-025 empties
that chain; the side effects were never going to fire again and neither has
a remaining reader that depends on them.

1. lib_provisioning/cmd/env.nu
   Former block: called check_env (a pre-flight gate for PROVISIONING_VARS /
   PROVISIONING_WORKSPACE_PATH / PROVISIONING_WK_ENV_PATH existence) and set
   $env.PROVISIONING_DEBUG = false. Nobody imports cmd/env.nu directly; every
   downstream reader of PROVISIONING_DEBUG either sets it explicitly via a
   --debug flag branch or reads it with `?` + default fallback.

2. lib_provisioning/providers/registry.nu
   Former block: $env.PROVIDER_REGISTRY_INITIALIZED = false. The four read
   sites in registry.nu already use `$env.PROVIDER_REGISTRY_INITIALIZED? |
   default false`; the unset state is equivalent to false. Zero behaviour
   change.

Both files now carry a comment explaining the removal so future contributors
understand the history without reading ADR-025.

Refs: ADR-025, .coder/benchmarks/phase2-findings.md export-env decisions
This commit is contained in:
Jesús Pérez 2026-04-17 07:47:19 +01:00
parent c917b058b3
commit 037acd52eb
Signed by: jesus
GPG key ID: 9F243E355E0BC939
2 changed files with 12 additions and 15 deletions

View file

@ -1,12 +1,9 @@
export-env {
use ../config/accessor.nu *
use ../utils/logging.nu [is-debug-enabled]
use ./lib.nu check_env
check_env
$env.PROVISIONING_DEBUG = if (is-debug-enabled) {
true
} else {
false
}
}
# export-env block removed by ADR-025 Phase 3 blocker 4.
# The former block called check_env (a pre-flight gate) and set $env.PROVISIONING_DEBUG.
# Nobody imports cmd/env.nu directly; it was only reached via the star-import chain
# from lib_provisioning/mod.nu. With that chain being emptied, this block would
# never fire at CLI start anyway. Thin handlers that need the debug flag already
# set it explicitly via `if $debug { $env.PROVISIONING_DEBUG = true }` — and
# remaining reads like `if not $env.PROVISIONING_DEBUG { ... }` are gated upstream
# by the same flag.

View file

@ -270,7 +270,7 @@ export def refresh-provider-registry [] {
init-provider-registry | ignore
}
# Export environment setup
export-env {
$env.PROVIDER_REGISTRY_INITIALIZED = false
}
# export-env block removed by ADR-025 Phase 3 blocker 4.
# The former block set $env.PROVIDER_REGISTRY_INITIALIZED = false at module load time.
# Every read site uses `$env.PROVIDER_REGISTRY_INITIALIZED? | default false`, so the
# unset state is equivalent to false. Zero behaviour change.