Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,3 @@ they are merged.
- File: `cli/python/base_setup/engine.py`
- Problem: `run_command` captures stderr but leaves stdout inherited from the parent process, so `brew` and `pip` output appears live in the terminal but is absent from the persistent Base log.
- Expected fix: either capture and log stdout, stream it while also preserving it for the log, or document live-only stdout as intentional behavior.

## Design Issues — Bash Layer

- [ ] Avoid duplicate `pip show` calls in `basectl check`.
- File: `cli/bash/commands/basectl/subcommands/setup_common.sh`
- Problem: package checks call `setup_base_python_package_installed`, then `setup_base_python_package_check_message` calls it again, causing two `pip show` invocations per package.
- Expected fix: compute package presence once and pass the known status into message formatting.
15 changes: 8 additions & 7 deletions cli/bash/commands/basectl/subcommands/setup_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,9 @@ setup_install_click() {

setup_base_python_package_check_message() {
local package="$1"
local installed="$2"

if setup_base_python_package_installed "$package"; then
if [[ "$installed" == true ]]; then
printf "Python package '%s' is installed in the Base virtual environment.\n" "$package"
else
printf "Python package '%s' is not installed in the Base virtual environment.\n" "$package"
Expand Down Expand Up @@ -480,16 +481,16 @@ setup_run_check() {
fi

if setup_base_python_package_installed "$pyyaml_package"; then
log_info "$(setup_base_python_package_check_message "$pyyaml_package")"
log_info "$(setup_base_python_package_check_message "$pyyaml_package" true)"
else
log_warn "$(setup_base_python_package_check_message "$pyyaml_package")"
log_warn "$(setup_base_python_package_check_message "$pyyaml_package" false)"
missing=1
fi

if setup_base_python_package_installed "$click_package"; then
log_info "$(setup_base_python_package_check_message "$click_package")"
log_info "$(setup_base_python_package_check_message "$click_package" true)"
else
log_warn "$(setup_base_python_package_check_message "$click_package")"
log_warn "$(setup_base_python_package_check_message "$click_package" false)"
missing=1
fi

Expand Down Expand Up @@ -593,14 +594,14 @@ setup_run_check_json() {
else
missing=1
fi
pyyaml_message="$(setup_base_python_package_check_message "$pyyaml_package")"
pyyaml_message="$(setup_base_python_package_check_message "$pyyaml_package" "$pyyaml_ok")"

if setup_base_python_package_installed "$click_package"; then
click_ok=true
else
missing=1
fi
click_message="$(setup_base_python_package_check_message "$click_package")"
click_message="$(setup_base_python_package_check_message "$click_package" "$click_ok")"

printf '{\n'
printf ' "ok": %s,\n' "$([[ "$missing" -eq 0 ]] && printf true || printf false)"
Expand Down
6 changes: 6 additions & 0 deletions cli/bash/commands/basectl/tests/setup.bats
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,12 @@ create_base_venv_stub() {
pyyaml_package="${BASE_SETUP_PYYAML_PACKAGE:-PyYAML}"
click_package="${BASE_SETUP_CLICK_PACKAGE:-click}"
if [[ "${1:-}" == "-m" && "${2:-}" == "pip" && "${3:-}" == "show" && "${4:-}" == "$pyyaml_package" ]]; then
printf '%s\n' "$4" >> "${BASE_SETUP_TEST_STATE_DIR:?}/pip-show.log"
[[ -f "${BASE_SETUP_TEST_STATE_DIR:?}/pyyaml-installed" ]]
exit $?
fi
if [[ "${1:-}" == "-m" && "${2:-}" == "pip" && "${3:-}" == "show" && "${4:-}" == "$click_package" ]]; then
printf '%s\n' "$4" >> "${BASE_SETUP_TEST_STATE_DIR:?}/pip-show.log"
[[ -f "${BASE_SETUP_TEST_STATE_DIR:?}/click-installed" ]]
exit $?
fi
Expand Down Expand Up @@ -699,6 +701,8 @@ EOF
[[ "$output" == *"Python package 'PyYAML' is installed in the Base virtual environment."* ]]
[[ "$output" == *"Python package 'click' is installed in the Base virtual environment."* ]]
[[ "$output" == *"Base CLI environment check passed."* ]]
[ "$(grep -c '^PyYAML$' "$TEST_STATE_DIR/pip-show.log")" -eq 1 ]
[ "$(grep -c '^click$' "$TEST_STATE_DIR/pip-show.log")" -eq 1 ]
}

@test "basectl check fails when a required Base Python package is missing" {
Expand All @@ -719,6 +723,8 @@ EOF
[[ "$output" == *"Python package 'PyYAML' is not installed in the Base virtual environment."* ]]
[[ "$output" == *"Python package 'click' is installed in the Base virtual environment."* ]]
[[ "$output" == *"Base CLI environment check found missing requirements."* ]]
[ "$(grep -c '^PyYAML$' "$TEST_STATE_DIR/pip-show.log")" -eq 1 ]
[ "$(grep -c '^click$' "$TEST_STATE_DIR/pip-show.log")" -eq 1 ]
}

@test "basectl check --dev includes BATS in developer dependency checks" {
Expand Down
Loading