Skip to content

Align the herdr Report, Share One Path-Containment Helper, and Drop a Dead Bound - #4112

Merged
ptr727 merged 3 commits into
developfrom
feature/promotion-review-cleanup
Nov 12, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/promotion-review-cleanup

Conversation

@ptr727

@ptr727 ptr727 commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Answers the attested local review of promotion PR #4096 at 6ba6179. Copilot reached its round cap there, so the policy hands that head to an attested local pass.

  • herdr report vs upgrade. The report now shows herdr's outdated-integration and restart notes for a manager-owned herdr too, on both platforms, but only when the manager plan will run. That matches the post step --upgrade runs since Honor bun's Directories, Follow mise Shims, and Share the herdr Post Step #4111.
  • Hide-Home in install-tools.ps1. It had the unbounded profile match that End Protected-Root and Profile Matches at a Path Component on Windows #4105 fixed only in install-agents.ps1, so it now gets the same component boundary. The two copies are textually identical, as host-setup/README.md requires, and a test holds them equal.
  • One path-containment helper. The new Test-PathUnder -Path -Root [-Below] in install-agents.ps1 replaces seven hand-written "at or under this root" checks, each of which normalized separators in its own way. Behavior is unchanged, including a scoop root written with a trailing separator or on an absent drive. Hide-Home stays self-contained so its two copies remain identical.
  • Resolve-FinalPath. Its depth bound and comment were dead code: a link loop throws from ResolveLinkTarget first, and the threat model rules out guarding against it. They are removed.

Verification

  • tests/test_install_agents.py passes, including the PowerShell cases under pwsh. tests/test_install_tools.py and tests/test_cli_usage.py pass too.
  • New tests cover the manager-owned herdr notes, the identical Hide-Home copies, Test-PathUnder, and a scoop root with a trailing separator. The scoop-root test fails on the intermediate commit.
  • shellcheck, shfmt, PSScriptAnalyzer and the prose gate are clean.
  • Three recorded local passes ran. The last found nothing open.

Not Verified

  • Real package-manager installs, a verification gap. The pure path helpers, Test-PathUnder included, run on the native Windows CI runner, which passed on this head. Real scoop, bun and npm installs have not been exercised. The maintainer's Windows 11 retest after this release covers the npm-installed opencode case.

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 12, 2026 13:05
The report showed herdr's outdated-integration and restart notes only for a self-updated herdr, though a manager-owned herdr runs the same post step since the manager upgrade. The notes now show for a manager-owned herdr too, on both platforms, unless the manager would not run, where the post step does not run either.

install-tools.ps1's Hide-Home still matched the profile as a bare prefix, so a sibling such as the profile name with a suffix was rewritten. It now has the component-bounded test, textually identical to the copy in install-agents.ps1, and a test holds the two copies equal.

install-agents.ps1 gets one Test-PathUnder helper, which reads either separator, ignores a trailing one and case, and matches at a path component, with a switch to leave out the root itself. Seven sites move onto it with no change in behaviour. Hide-Home stays self-contained so the duplication rule between the two scripts holds. Resolve-FinalPath loses its unreachable depth bound and its false comment.

Refs #2553

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Moving onto Test-PathUnder had switched the root join to Join-Path, which fails for a root on
a drive that is not present and so would stop the run where the old string join did not match.
The text join restores the old behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The text join kept a trailing separator, so a root written as D:\Tools\ produced a doubled
separator, and a relocated root no longer matched. That handed the tool to its own updater.
The root is trimmed first, as Get-ScoopApp does, which matches the pre-refactor behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 12, 2026
Copilot AI lite review requested due to automatic review settings November 12, 2026 21:11
@ptr727

ptr727 commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

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

@coderabbitai

coderabbitai Bot commented Nov 12, 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 35 seconds.

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

Commits

Reviewing files that changed from the base of the PR and between 6ba6179 and 6e10b70.

Files selected for processing: 4

  • host-setup/linux/install-agents.sh
  • host-setup/windows/install-agents.ps1
  • host-setup/windows/install-tools.ps1
  • tests/test_install_agents.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

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

The change affects Windows PowerShell path containment and package-manager ownership, but native PowerShell execution and real package-manager installs were not verified, so maintainer validation is needed.

No open issues 🎉

What changed in this PR

Aligns herdr reporting with actual upgrade behavior, centralizes Windows path-containment checks, and removes obsolete recursion-limit code.

Changes:

  • Reports herdr integration and restart notes only when the upgrade plan will execute.
  • Adds and applies the shared Test-PathUnder helper for Windows path checks.
  • Synchronizes Hide-Home implementations and expands focused test coverage.
  • Removes the unused Resolve-FinalPath depth bound.
File Description
tests/​test_install_agents.py Adds coverage for herdr reports, path containment, trailing Scoop roots, and synchronized Hide-Home implementations.
host-setup/​windows/​install-tools.ps1 Applies component-boundary matching when hiding user profile paths.
host-setup/​windows/​install-agents.ps1 Adds shared path containment, updates manager-aware reporting, and removes dead recursion-limit handling.
host-setup/​linux/​install-agents.sh Aligns manager-owned herdr reporting with whether the upgrade plan will execute.

Review effort: Lite

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.58%. Comparing base (6ba6179) to head (6e10b70).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4112   +/-   ##
========================================
  Coverage    76.58%   76.58%           
========================================
  Files           40       40           
  Lines        14136    14136           
========================================
  Hits         10826    10826           
  Misses        3310     3310           
Flag Coverage Δ
python-3.13 76.58% <ø> (ø)

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 Nov 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 12, 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 commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Answering the round on 6e10b70, whose verdict is needs a closer look with (0) counted findings. Headline: "The change affects Windows PowerShell path containment and package-manager ownership, but native PowerShell execution and real package-manager installs were not verified, so maintainer validation is needed." Listed in the body. One part of it no longer holds: native PowerShell execution of the path helpers does run. TestInstallAgentsWindowsHelpers, which covers Test-PathUnder, Test-ProtectedPath, Hide-Home and Resolve-FinalPath, runs in the Windows unit test job, and that job passed on this head. Real scoop, bun and npm installs have not been exercised. The "Not Verified" section records that, and the maintainer's Windows 11 retest after this release covers the npm-installed opencode case.

@ptr727
ptr727 merged commit 326bb1c into develop Nov 12, 2026
14 checks passed
@ptr727
ptr727 deleted the feature/promotion-review-cleanup branch November 12, 2026 21:26
ptr727 added a commit that referenced this pull request Nov 12, 2026
… Upgrades (#4096)

## Summary

Promotes the agent-setup follow-ups and their review fixes, plus one
change from another hub session, from `develop` to `main`. Both follow a
native Windows 11 test of the one-step agent setup released as 2.0.1414.

- #4094:
- The Claude safety kit puts `"$defaults"` first in each `autoMode` list
that exists (`environment`, `allow`, `soft_deny`, `hard_deny`). Claude
Code's "learn rules" offer had written a list without it, which silently
replaced Claude Code's built-in rules. `--report` flags such a list as
not current.
  - The kit report's archive note names the commit.
- The Codex and opencode rules lines say when only an agent's config
directory makes it count as installed.
- `merge-and-release` step 7 also refreshes the Codex and opencode
rules, only where the kit reads current.
- #4095: an agent tool installed through npm, bun, scoop, Homebrew or
mise is upgraded through that manager, one package only. The manager is
asked whether it owns the tool, with every link resolved, before any
path shape is read, and the recorded package must own the file. A Node
runtime is never upgraded on an agent's behalf. Nothing elevates: choco,
a global scoop app, an unwritable npm prefix and Nix are reported with
their command. winget and apt stay with `upgrade-host`.

- #4102: answers this promotion's Copilot review. On Linux, npm is asked
before a `.bun` path, as on Windows, and a Nix agent under
`/nix/store/.../node_modules` is read as Nix before the generic npm
shape.

- #4105: answers this promotion's second Copilot round. On Windows,
`Test-ProtectedPath` and `Hide-Home` match only at a path component, so
`C:\Program FilesPortable` is no longer read as protected and a sibling
profile is no longer shortened. The pure path-helper tests now also run
on the native Windows CI runner.

- #4111: answers CodeRabbit's review of this promotion. bun's
`BUN_INSTALL` and `BUN_INSTALL_GLOBAL_DIR` are honored, including bun's
copied Windows shim. A mise shim is followed through `mise which`, and
mise's own listing is asked before any path shape. One herdr post step
runs after every successful upgrade. Scoop's configured roots are read
from its `config.json`.

- #4112: answers this promotion's attested local review. herdr's report
notes now match its post step for a manager-owned herdr.
`install-tools.ps1`'s `Hide-Home` gets #4105's component boundary. One
`Test-PathUnder` helper replaces seven hand-written containment checks.
A dead depth bound is removed.

- #4109, from another hub session: `dotnet-codestyle` now requires a
`global.json` pinning SDK `10.0.100` with `latestFeature` and
`allowPrerelease: false`. It leaves `LangVersion` unset (netstandard
generator projects excepted) and forbids `EnablePreviewFeatures`. The
audit gains the `csharp.sdk.globaljson` check, with a
`catalog/snippets/configs/global.json` snippet and its `spec/files.json`
C# baseline entry. `CODESTYLE.md`'s .NET summary line is updated.
Follow-ups #4106 and #4107 are filed and not in this promotion.

## Pre-existing Findings, Filed

- `host-setup/windows/install-tools.ps1:616` (`pre-existing`,
correctness): `Write-InstallFailure`'s profile replacement in log lines
does not stop at a path component. Filed as #4113.

## Not Verified

- Real package managers. #4095's tests use stub managers on PATH. The
Windows npm, scoop and bun layouts are modeled from their documented
formats and have not been run against real installs. The maintainer's
Windows 11 retest after this release covers the npm-installed opencode
case.

Closes #4103

🤖 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

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants