Skip to content

Nothing tests the bootstrap loaders' kept-tree swap sequence #1767

Description

@ptr727

The #1756 change gave host-setup/bootstrap.sh and bootstrap.ps1 a kept tree with a staging, swap, and retire sequence. The sequence runs in this order:

  • It extracts to a .new sibling.
  • It swaps the tree in immediately before the skills step, with the old tree moved aside to .old first and removed last.
  • It removes a leftover .new or .old on exit.

Nothing executes that sequence in CI. scripts/tests/test_bootstrap.py checks the loaders statically, and scripts/tests/test_skills_install.py covers only the Python installer. A change that reorders the steps would pass every check. Examples: swapping before an earlier stand-up step, or removing the old tree before the new one is in place.

What follows

  • The property this sequence exists for goes unchecked: a failed stand-up leaves the plugin loading the previous tree.

Options

  1. Add a test that runs bootstrap.sh in a scratch HOME. Give it a stub curl that serves a local tarball, and stub tools that fail at a chosen step. Then assert on the tree left behind. Add the same test for bootstrap.ps1 under pwsh.
  2. Extract the swap into a function each loader can be asked to run on its own, and test that function.

Found by the local strict review on the #1756 change.

Activity

  1. ptr727 commented on Sep 24, 2026

    @ptr727
    OwnerAuthor

    Copilot raised this again as two previously-missed findings on promotion PR #1774, at host-setup/bootstrap.ps1:299 and host-setup/bootstrap.sh:179. I filed that as #1780 by mistake, and it is closed as a duplicate of this issue.

  2. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Note from the windows lane, for whoever works this next. What now exercises the kept-tree swap sequence is in tests/test_bootstrap.py, by option 2's shape, each loader's own functions driven against a scratch directory:

    • TestKeptTreeHandling (bash, Linux) and TestPowerShellKeptTreeHandling (pwsh, both platforms) inject a failure at each rename and removal of swap_in/Invoke-SwapIn and of the cleanup, then assert which tree is left on disk.
    • The PowerShell class also runs Get-Tree → Invoke-SwapIn → Invoke-Cleanup with a stubbed download and extract, including a failed extract.
    • Test That the Directory the Skills Installer Registers Outlives the Run #2554, merged to develop, adds one case per loader that runs fetch → install_skills/Invoke-SkillsInstall → cleanup. Each asserts that the directory the installer registers is the kept tree and outlives the run. Running the installer ahead of the swap fails both cases.

    What none of them does is option 1's end-to-end run of main with a stub curl and a scratch HOME, so whether that is still owed is this issue's call.

  3. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Claimed for the wsl lane (#2478), worked on this WSL2 Debian host.

    • Branch: feature/wsl-1767
    • Predicted file set: tests/test_bootstrap.py, and host-setup/bootstrap.sh only if the end-to-end run needs a seam

    Any other group needing one of these files waits for this branch to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions