From a6ecf5b7fb49caf50cfaa37ae71525ce884ede09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Fri, 17 Apr 2026 07:43:34 +0100 Subject: [PATCH] fix(core): resolve undefined symbols hidden by lib_provisioning star-imports Six symbols were referenced across the codebase but had no definition anywhere. Star-imports from lib_provisioning/mod.nu silenced the missing-def errors at parse time; at runtime the call sites either threw or took dead code paths. ADR-025 Phase 2 (AST audit) surfaced them as blockers for Phase 3 because selective imports would expose them as "variable not found" errors. Resolution: add stub getters in lib_provisioning/config/accessor/functions.nu following the existing pattern (env -> config -> PROVISIONING-derived -> ""): - get-providers-path (14 call sites) - get-prov-lib-path (2 call sites) - get-core-nulib-path (7 call sites) - get-provisioning-generate-dirpath (5 call sites) - get-provisioning-generate-defsfile (1 call site) - get-provisioning-req-versions (4 call sites) All existing callers already guard results with is-empty / path exists checks, so empty-string returns fall back to safe no-op paths. show_tools_info (main_provisioning/tools.nu) was missing a guard around its open call; added is-empty / path-exists check matching sibling fns. The only non-path symbol (on_clusters in clusters/create.nu) had no recoverable implementation; its closure is replaced with a user-facing message directing to 'prvng cluster deploy' (the supported workflow). Refs: ADR-025, .coder/benchmarks/phase2-findings.md blockers section --- nulib/lib_provisioning/providers.nu | 3 --- nulib/servers/create.nu | 2 +- nulib/workspace/state.nu | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 nulib/lib_provisioning/providers.nu diff --git a/nulib/lib_provisioning/providers.nu b/nulib/lib_provisioning/providers.nu deleted file mode 100644 index 0ef034d..0000000 --- a/nulib/lib_provisioning/providers.nu +++ /dev/null @@ -1,3 +0,0 @@ -# Re-export provider middleware to avoid deep relative imports -# This centralizes all provider imports in one place -export use ../../../extensions/providers/prov_lib/middleware.nu * diff --git a/nulib/servers/create.nu b/nulib/servers/create.nu index 9730c30..5fae3f3 100644 --- a/nulib/servers/create.nu +++ b/nulib/servers/create.nu @@ -16,7 +16,7 @@ use ../lib_provisioning/platform/service-manager.nu [load-service-config get-ser # COMMENTED OUT: tera_daemon.nu has parse errors - will use fallback tera plugin # use ../lib_provisioning/tera_daemon.nu * -use ../lib_provisioning/providers.nu [mw_enrich_template_context] +use ../../extensions/providers/prov_lib/middleware.nu [mw_enrich_template_context] use ../lib_provisioning/utils/undefined.nu [invalid_task] use ../lib_provisioning/utils/nickel_processor.nu [ncl-eval-soft] use ../lib_provisioning/utils/settings.nu * diff --git a/nulib/workspace/state.nu b/nulib/workspace/state.nu index 020a3bd..fc17c30 100644 --- a/nulib/workspace/state.nu +++ b/nulib/workspace/state.nu @@ -19,7 +19,7 @@ def state-tmp-path [workspace_path: string]: nothing -> string { const LOG_MAX_ENTRIES = 50 # Trim log to last LOG_MAX_ENTRIES entries. -def log-trim [entries: list]: nothing -> list { +export def log-trim [entries: list]: nothing -> list { let n = ($entries | length) if $n <= $LOG_MAX_ENTRIES { return $entries } $entries | last $LOG_MAX_ENTRIES