Skip to content

Cover the Bootstrap Upgrade Handoff and Name a Failed Agent Report on Windows - #3035

Merged
ptr727 merged 3 commits into
developfrom
feature/3030-bootstrap-upgrade-coverage
Oct 15, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/3030-bootstrap-upgrade-coverage

Conversation

@ptr727

@ptr727 ptr727 commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Answers the three review findings Copilot raised on the promotion pull request #3030, all on the bootstrap upgrade handoff #2997 introduced.

Changes

  • Linux upgrade handoff coverage (host-setup/bootstrap.sh:317 finding). TestKeptTreeEndToEnd now also runs bootstrap.sh --upgrade whole against the stub download and stub tools. It asserts that upgrade-host.sh --packages runs before install-agents.sh --upgrade, and that a failed package upgrade stops before the agent tools step. A run under unshare -r (EUID 0 in a user namespace, skipped where the host refuses one) asserts that the agent tools step is skipped and the "Running as root" line printed.
  • Windows upgrade handoff coverage (host-setup/bootstrap.ps1:473 finding). A new TestPowerShellToolHandoff runs bootstrap.ps1's own Invoke-Upgrade and Show-Report, extracted by AST through the existing harness, against stub .ps1 tools that record each step. It asserts upgrade-host.ps1 -Packages then install-agents.ps1 -Upgrade, the stop on a failed package step, and the elevated skip for both the upgrade and the report. The elevation check moves into its own Test-Elevated function, which every case stands in for. A case then reads the same on an elevated Windows runner as on a user's session. One case runs the real Test-Elevated and holds it to the host's own answer, IsUserAnAdmin on Windows, after Copilot's first round noted that no case ran it.
  • Silent agent report failure (Show-Report finding). Show-Report now prints "The agent tools step did not report, and the output above says why" when install-agents.ps1 -Report exits non-zero. That matches the skills step above it and bootstrap.sh's report(). A test covers the line, and a second asserts it is absent on success.
  • The harness command builder moves out of TestPowerShellKeptTreeHandling into a module-level powershell_harness_command, so both PowerShell classes share it.

Verification

  • Each new assertion was proven by breaking the flow and watching it fail. The breaks were dropping the agent tools upgrade call, swapping the two upgrade steps, removing the root or elevated gate, removing the report gate, and dropping the new info line, on each platform's loader.
  • python3 -m unittest discover -s tests on Linux with pwsh present: 2810 tests, OK (7 skipped). Ruff format and check, mypy, prose_lint.py --diff, repo_gate.py, spec/validate.py, build_dist.py --check, editorconfig-checker, and PSScriptAnalyzer 1.23.0 on bootstrap.ps1 are all clean.
  • The PowerShell cases ran here under Linux pwsh only. The Windows path is proven by the required Windows unit test job on this head, not claimed before it passes.

Local review

Three local-strict-review passes ran. The first raised five findings, and the second and third, on the fixed heads, raised none. Three were fixed here: the end-to-end class docstring now describes its upgrade cases, the elevated report case was added, and two long docstring sentences were split. Two were filed as their own issues, since this change may not touch the files they need. #3033 covers bootstrap.sh's untested report() agent gate and line. #3034 covers moving the unprivileged-root probe into tests/host_capability.py.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 14, 2026 17:07
… Windows

Run bootstrap.sh --upgrade whole against stub tools, asserting the package
upgrade runs before the agent tools upgrade, that a failed package upgrade
stops before it, and that a root run skips it and says so. Run bootstrap.ps1's
Invoke-Upgrade and Show-Report through its own functions the same way, with
the elevation check split into Test-Elevated so both branches run on any host.

Show-Report now prints a line when install-agents.ps1 -Report exits non-zero,
as the skills step above it and bootstrap.sh's report already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an elevated Show-Report case, so a report that stops skipping the
agent tools step when elevated fails a test. Say in TestKeptTreeEndToEnd's
docstring that its upgrade cases assert the recorded steps rather than a
kept tree, and split the new docstrings' long sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 15, 2026 00:13
@ptr727

ptr727 commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 8c66f1d47c828da31705a63d4d86114f9208177e, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a6e32b76-5453-4a32-841d-4bf852cfd7bd
📥 Commits

Reviewing files that changed from the base of the PR and between fd49353 and e76f1c5.

📒 Files selected for processing: 2
  • host-setup/bootstrap.ps1
  • tests/test_bootstrap.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved moderate findings require direct elevation-predicate coverage and shared probe relocation.

0 open findings

What changed in this PR

Adds regression coverage for Linux and Windows bootstrap upgrade/report handoffs and improves failed Windows agent-report diagnostics.

Changes:

  • Tests upgrade ordering, failure handling, and elevated-session skips.
  • Adds Windows agent-report failure messaging.
  • Refactors shared PowerShell test harness setup.
File Summary
tests/​test_bootstrap.py Adds Linux and PowerShell handoff coverage. Findings remain for exercising the production elevation predicate and relocating host capability probes.
host-setup/​bootstrap.ps1 Adds elevation helper reuse and agent-report failure messaging.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Every handoff case stands in for Test-Elevated, so a predicate that read
every host as elevated, or none, passed them all. Run the real one once
and compare it with the shell API's own answer on Windows, and with not
elevated on any other host, where the check reads $IsWindows first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727

ptr727 commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head e76f1c50975cdaf917445e74bcd009c32ee76ee8, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

Answering the headline of Copilot's round on 8c66f1d4. That round opened on Needs a closer look and stated 0 open findings, and it collapsed no block, so its (0) count is the headline and nothing else. The headline names two items, answered in turn.

  1. tests/test_bootstrap.py: "Unresolved moderate findings require direct elevation-predicate coverage". Fixed in e76f1c5. Every handoff case stood in for Test-Elevated, so the production predicate never ran. test_the_elevation_check_agrees_with_the_host now runs the real Test-Elevated and holds it to the host's own answer. On Windows that answer is IsUserAnAdmin from the shell API. Elsewhere it is "not elevated", since the check reads $IsWindows first. Forcing the predicate to $true fails the test here on Linux pwsh. The IsInRole branch itself runs only on the hosted Windows job, so this is not claimed fixed on Windows until that job passes on e76f1c5.
  2. tests/test_bootstrap.py: "shared probe relocation". Deferred to Move the unprivileged-root probe into host_capability.py #3034. The local review pass raised this too, before this pull request opened. It asks to move unprivileged_root_is_available out of tests/test_skills_install.py into tests/host_capability.py. That move touches two files this change does not own, so it is filed as one issue naming both sites. The import here reuses the existing helper rather than copying it, following the precedent of test_cli_usage.py and others importing from test_configure_archived.py.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.00%. Comparing base (fd49353) to head (e76f1c5).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3035      +/-   ##
===========================================
+ Coverage    60.98%   61.00%   +0.01%     
===========================================
  Files           17       17              
  Lines         9010     9014       +4     
===========================================
+ Hits          5495     5499       +4     
  Misses        3515     3515              
Flag Coverage Δ
python-3.13 61.00% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727

ptr727 commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit cfe8671 into develop Oct 15, 2026
13 checks passed
@ptr727
ptr727 deleted the feature/3030-bootstrap-upgrade-coverage branch October 15, 2026 00:32
ptr727 added a commit that referenced this pull request Oct 15, 2026
…ng, and backlog-burndown Re-Dispatch Rules to Main (#3030)

- #2997 adds an updater that keeps the coding-agent tools already
installed on a host current, without installing a tool the maintainer
has not chosen
- #3017 brings the agent-safety READMEs up to the write guard's #3011
readings: `--admin` read inside a quoted `eval` argument, clustered and
cut-short push options, `--branches` as `--all`, `refs/` pattern
destinations, and a double-quoted list expansion as a directory or
commit value failing closed
- #3022 pairs a Copilot overview-table or `Review findings:` entry with
a review thread by the file it names, replacing word overlap, compares
the headline count against everything the round and the pull request
account for, and makes `pr_review.py cleanup` read every page of the
head pull requests, counting only this repository's own
- #3018 has `backlog-burndown` name a new branch when an issue is
dispatched again, name the open pull request a pushed branch still heads
when cleanup reports it, and splits the long cleanup sentence
- #3028 keeps an abandoned group's issue out of the `backlog-burndown`
ranking while that group is stopped for the maintainer, and records the
release on the claim comment
- #3023 makes `gh-write-guard` read a `heads/` push destination as the
branch git completes it to, read `--prune` beside a pattern, `:`,
`--all`, or bare push as a delete of each branch matched, read
`--mirror` as a force and a delete, and read the `@{push}` target
against the configured remote names. A differential against the previous
guard found no deny-to-allow flip
- #3032 subtracts every thread id an open entry links, back-references
included, from the earlier threads `pr_review.py`'s headline shortfall
counts, so a back-referenced thread is no longer counted twice
- #3035 covers the bootstrap upgrade handoff on Linux and Windows, the
root and elevated skips included, and has `bootstrap.ps1` say when the
agent tools report fails
- #3037 makes `gh-write-guard` fail closed when a push target resolves
but the remote names cannot be read

After this merges, the host-safety installer payload changes, so the
maintainer runs the installer after promotion.

Fixes #3009
Fixes #2985
Fixes #3003
Fixes #2993
Fixes #3016
Fixes #3005
Fixes #3007
Fixes #2973

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants