From 05c005891e05b6eee2395e3f5572807deea4234a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 17:25:20 +0000 Subject: [PATCH 1/5] fix(shell): skip the devbase build in yq_resolve_bin when go is missing box.sh and devconfig.sh call yq_resolve_bin directly, which still ran `go build` and failed on jobs without Go. Return early when yq_wrapper will run gojq instead. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HFMJB4czsR4Tgad5w9cGrM --- shell/lib/yq.sh | 7 ++++++- shell/lib/yq_test.bats | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/shell/lib/yq.sh b/shell/lib/yq.sh index 9d3e61e8..9e595e97 100644 --- a/shell/lib/yq.sh +++ b/shell/lib/yq.sh @@ -25,12 +25,17 @@ DEVBASE_YQ_BIN="" # yq_resolve_bin resolves and caches in DEVBASE_YQ_BIN the binary # yq_wrapper() should run: built-from-source for "local"/dev (see # yq_build_from_source), or devbase_cli's own tagged-release resolution -# otherwise. +# otherwise. It resolves nothing when yq_wrapper will run gojq instead. yq_resolve_bin() { if [[ -n $DEVBASE_YQ_BIN ]]; then return fi + # Nothing to resolve: yq_wrapper runs gojq instead (see yq_use_gojq). + if yq_use_gojq; then + return + fi + local version version="$(devbase_cli_version)" diff --git a/shell/lib/yq_test.bats b/shell/lib/yq_test.bats index deafcb5f..c3465c91 100644 --- a/shell/lib/yq_test.bats +++ b/shell/lib/yq_test.bats @@ -129,6 +129,8 @@ stub_go_git() { @test "yq_resolve_bin uses yq_build_from_source for a local/dev version" { # shellcheck disable=SC2329 # Why: called indirectly as a stub. devbase_cli_version() { echo "local"; } + # shellcheck disable=SC2329 # Why: called indirectly as a stub. + find_tool() { echo "/fake/go"; } local build_count_file="$DEVBASE_CACHED_BINARY_STORAGE_PATH/count" stub_go_git "$build_count_file" # shellcheck disable=SC2329 # Why: called indirectly as a stub. @@ -253,3 +255,15 @@ stub_gojq_env() { assert_success assert_output "gojq fallback .a" } + +@test "yq_resolve_bin does not build devbase when go is missing" { + stub_gojq_env local "" + yq_build_from_source() { + echo "unexpected build" >&2 + return 1 + } + + run yq_resolve_bin + assert_success + assert_output "" +} From 67666a0f7e1e0ea6c034bbdaf191761ee995b194 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 17:58:00 +0000 Subject: [PATCH 2/5] test(shell): assert yq_resolve_bin leaves DEVBASE_YQ_BIN empty without go Also drop a comment that repeated the function header. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HFMJB4czsR4Tgad5w9cGrM --- shell/lib/yq.sh | 1 - shell/lib/yq_test.bats | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/shell/lib/yq.sh b/shell/lib/yq.sh index 9e595e97..c1d5afc4 100644 --- a/shell/lib/yq.sh +++ b/shell/lib/yq.sh @@ -31,7 +31,6 @@ yq_resolve_bin() { return fi - # Nothing to resolve: yq_wrapper runs gojq instead (see yq_use_gojq). if yq_use_gojq; then return fi diff --git a/shell/lib/yq_test.bats b/shell/lib/yq_test.bats index c3465c91..0b4a444e 100644 --- a/shell/lib/yq_test.bats +++ b/shell/lib/yq_test.bats @@ -263,7 +263,6 @@ stub_gojq_env() { return 1 } - run yq_resolve_bin - assert_success - assert_output "" + yq_resolve_bin + assert_equal "$DEVBASE_YQ_BIN" "" } From 978eb768bf95584c6691bafa6715e73566f77097 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 18:07:11 +0000 Subject: [PATCH 3/5] style(shell): silence SC2031 in the yq_resolve_bin test Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HFMJB4czsR4Tgad5w9cGrM --- shell/lib/yq_test.bats | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/lib/yq_test.bats b/shell/lib/yq_test.bats index 0b4a444e..4d0bcbdf 100644 --- a/shell/lib/yq_test.bats +++ b/shell/lib/yq_test.bats @@ -264,5 +264,6 @@ stub_gojq_env() { } yq_resolve_bin + # shellcheck disable=SC2031 # Why: yq_resolve_bin runs in this shell, not a subshell. assert_equal "$DEVBASE_YQ_BIN" "" } From 06f68ef42d443f24055cb13d7d3091c7f70fa0ba Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 20:30:41 +0000 Subject: [PATCH 4/5] test(shell): cover yq_resolve_bin for a tagged version without go Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HFMJB4czsR4Tgad5w9cGrM --- shell/lib/yq_test.bats | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shell/lib/yq_test.bats b/shell/lib/yq_test.bats index 4d0bcbdf..0835e3ff 100644 --- a/shell/lib/yq_test.bats +++ b/shell/lib/yq_test.bats @@ -267,3 +267,13 @@ stub_gojq_env() { # shellcheck disable=SC2031 # Why: yq_resolve_bin runs in this shell, not a subshell. assert_equal "$DEVBASE_YQ_BIN" "" } + +@test "yq_resolve_bin still resolves a tagged version when go is missing" { + stub_gojq_env v2.40.0 "" + # shellcheck disable=SC2317,SC2329 # Why: called indirectly as a stub. + devbase_cli_binary() { echo "/fake/devbase-v2.40.0"; } + + yq_resolve_bin + # shellcheck disable=SC2031 # Why: yq_resolve_bin runs in this shell, not a subshell. + assert_equal "$DEVBASE_YQ_BIN" "/fake/devbase-v2.40.0" +} From ac2f90eee8c929d425b5a52ca9542e9501696313 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 20:30:41 +0000 Subject: [PATCH 5/5] docs(shell): note that yq_resolve_bin resolves nothing without go Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01HFMJB4czsR4Tgad5w9cGrM --- shell/devconfig.sh | 3 ++- shell/lib/box.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/devconfig.sh b/shell/devconfig.sh index e562be03..f90126ae 100755 --- a/shell/devconfig.sh +++ b/shell/devconfig.sh @@ -14,7 +14,8 @@ source "$DIR/lib/yq.sh" # Resolve the yq binary once, up front: each yq_wrapper call below runs # as its own pipeline stage (a forked subshell), so without this each of # the 3 pipelines further down would independently redo yq_resolve_bin's -# own resolution work. +# own resolution work. Without Go, this resolves nothing and yq_wrapper +# runs gojq instead. yq_resolve_bin # shellcheck source=./lib/box.sh diff --git a/shell/lib/box.sh b/shell/lib/box.sh index 1190fea8..2a70cf59 100755 --- a/shell/lib/box.sh +++ b/shell/lib/box.sh @@ -52,7 +52,8 @@ download_box() { # Resolve the yq binary once, in this shell, before the 3 calls # below: each runs in its own forked subshell (pipe/process # substitution), so without this they'd each independently redo - # yq_resolve_bin's own resolution work. + # yq_resolve_bin's own resolution work. Without Go, this resolves + # nothing and yq_wrapper runs gojq instead. yq_resolve_bin # Avoid reading and writing to the same file newBox="$(yq_wrapper . "${BOXPATH}" |