Skip to content

Investigate intermittent basectl update multiple-argument usage failure #1114

Description

@codeforester

Summary

basectl test base reported one failure in cli/bash/commands/basectl/tests/update.bats: the basectl update rejects multiple project arguments test expected a usage-error exit status but did not receive it.

Reported failure

update.bats
 ✓ basectl update prints help
 ✓ basectl update dry-run reports planned update and setup
 ✓ basectl update dry-run resolves a named project
 ✗ basectl update rejects multiple project arguments
   (in test file cli/bash/commands/basectl/tests/update.bats, line 72)
     `[ "$status" -eq 2 ]' failed
 ✓ basectl update dry-run reports Homebrew handoff without running brew
 ✓ basectl update reports Homebrew tap trust recovery before upgrade
 ✓ basectl update only accepts structured Homebrew trust entries
 ✓ basectl update runs exact Homebrew package upgrade and clears Base env for setup
 ✓ basectl update uses current Homebrew opt basectl after Cellar-launched upgrades
 ✓ basectl update refuses dirty worktrees before pulling
 ✓ basectl update allows untracked files before pulling
 ✓ basectl update refuses non-default branches
 ✓ basectl update reports already up-to-date repositories
 ✓ basectl update reports changed revisions
 ✓ basectl update runs Git update and setup for a named project

The failing assertion is in this test:

@test "basectl update rejects multiple project arguments" {
    run env \
        HOME="$TEST_HOME" \
        BASE_HOME="$BASE_REPO_ROOT" \
        bash -c '
            source "$BASE_HOME/base_init.sh"
            source "$BASE_HOME/cli/bash/commands/basectl/subcommands/update.sh"
            base_update_subcommand_main demo other
        '

    [ "$status" -eq 2 ]
    [[ "$output" == *"The 'update' command accepts at most one project name."* ]]
}

Expected behavior

base_update_subcommand_main demo other should deterministically exit with status 2 and print:

The 'update' command accepts at most one project name.

Follow-up already checked

On the current local checkout, the failure did not reproduce when run narrowly:

bats --filter 'basectl update rejects multiple project arguments' cli/bash/commands/basectl/tests/update.bats
1..1
ok 1 basectl update rejects multiple project arguments

The full update.bats file also passed locally:

bats cli/bash/commands/basectl/tests/update.bats
1..16
ok 4 basectl update rejects multiple project arguments

That points toward an intermittent failure or full-suite state leak in basectl test base, rather than a simple deterministic failure of the isolated test.

Investigation notes

  • Capture the actual status and output from the failing run under basectl test base.
  • Check for environment or shell state leaked by earlier tests in the full Base test run.
  • Confirm base_update_subcommand_main rejects more than one positional project argument before any dry-run, Homebrew, or repo update path can proceed.
  • Keep the isolated and file-level BATS coverage passing while making the full-suite behavior deterministic.

Metadata

Metadata

Assignees

Labels

bugSomething is not workingciContinuous integration, tests, automation, or release workflows

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions