Skip to content

refactor(machine-health): simplify audit and setup monthly-run scripts - #14990

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14653-42758086303-1
Nov 10, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14653-42758086303-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14653

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified the three listed machine-health scripts without changing what they do. In Restart-StoppedService.ps1 I removed two null early-returns that Get-PropertyValue already covers, and inlined three temporary variables in the -Human output. In Install-MonthlyRun.ps1 the scheduler folder's FullName is now read once. In the monthly-run.ps1 template a path variable used only once is inlined. The files were already short, so the diff is small; a fresh-context review confirmed that outputs, exit codes, printed text, parameters and tests are unchanged.

Not verified

  • Pester suites for the three scripts were not executed: this lane has no pwsh test runner. Left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • tidy-diff pass 5 (ai-slop): detect.sh is not a runnable wrapper in this lane, so the 2-line changelog fragment was checked by the rubric only, with no findings.
  • Editing the monthly-run.ps1 template changes its bytes, so setup check (Test-MonthlyRunCurrent) will report an already-installed wrapper copy as not current until setup refreshes it. Any edit to this template does this, and the issue lists the template for editing. The wrapper still behaves the…

Fix

  • plugins/machine-health/skills/audit/scripts/windows/remediations/Restart-StoppedService.ps1: removed the redundant null checks on $FindingData and $detail in Resolve-FindingTarget (Get-PropertyValue returns $null for a $null input, and the existing $services null check returns ()); inlined…
  • plugins/machine-health/skills/setup/scripts/Install-MonthlyRun.ps1: $dir now holds the scheduler folder's FullName string, so it is read once instead of twice
  • plugins/machine-health/skills/setup/templates/monthly-run.ps1: inlined the single-use $latestPath into the File.Open call
  • .changes/machine-health/work-resolve-issue-issue-14653-42758086303-1-769d4e61.md: new patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against a0eb00d:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 6 fragments valid (run before and after tidy)
  • check-changed-skills: machine-health audit and setup PASS, 0 errors (the warnings were already there and are unrelated to this diff)
  • check-affected: 12 passed, 7 skipped, 0 failed over 4 changed files
  • fresh-context review subagent: read the three files and their Pester tests (Restart-StoppedService.Tests.ps1, Install-MonthlyRun.Tests.ps1, monthly-run.Tests.ps1) and found no behavior change, no StrictMode 3.0 error and no broken assertion
  • tidy-diff over the 5 changed hunks: all passes ran and none made an edit
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42758086303

Left out: the items under Not verified.

Related

#14653

Merge-Risk: max=MEDIUM demote=false head=084dcbd2d534285355bcdfe22c5233337843427c rubric=8.3.3 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of 084dcbd2d534285355bcdfe22c5233337843427c: no file of this pull request changed since the review of a0eb00d.

Security review: no security issues found

I read the whole diff for all 4 changed files. None of them matches a trusted-path glob, and the diff touches no plugin manifest, trust control, merge hold or standing instruction.

  • Restart-StoppedService.ps1: Two $null early-returns are removed. Get-PropertyValue already returns $null for a $null input (L68), and the $services null check that remains still returns @(). The set of services the script targets for restart is unchanged. The -Human output now builds its line inline with a ternary; this changes only display text and adds no injection surface.
  • Install-MonthlyRun.ps1: $dir now holds the scheduler folder's FullName string, read once. The wrapper and settings-file paths come out the same as before, so nothing new is written or deleted.
  • templates/monthly-run.ps1: The single-use $latestPath is inlined into File.Open. The path, the open mode and the share flags are unchanged.
  • Changelog fragment: A new prose-only patch fragment, nothing to review.

The PR context holds no embedded directives aimed at this lane. No prior findings apply: this is the first review, not blocking only.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of 084dcbd2d534285355bcdfe22c5233337843427c: no file of this pull request changed since the review of a0eb00d.

Code review: no findings

I read every hunk in all 4 changed files and checked each edit against the head files and the code it calls.

Restart-StoppedService.ps1

  • Removing the $null -eq $FindingData and $null -eq $detail early returns does not change behavior. Get-PropertyValue returns $null for a $null input (L68). A null finding, a JSON "null" string, or a missing detail all still reach the $services null check at L98 and return @(). Nothing in that path touches a property that StrictMode 3.0 would throw on.
  • The inlined -Human output prints the same text. The ternary operator needs PowerShell 7, and the script already declares #Requires -Version 7.4 and uses a ternary at L111.

Install-MonthlyRun.ps1

  • $dir now holds the .FullName string. Its two uses (the wrapper path and the cleanup of the old scheduled-settings.json) build the same paths as before.

templates/monthly-run.ps1

  • Inlining $latestPath into the File.Open call keeps the Join-Path inside the same try, so a failure still lands in the same catch with the same message.
  • Any edit to this template changes its bytes. Test-MonthlyRunCurrent compares bytes, so wrappers that are already installed will show as stale until setup check or a new schedule run refreshes them. That is the update path the module documents, the issue lists this file for editing, and the PR body states the side effect, so I am not counting it as a finding.

Closing issue #14653 acceptance criteria

  • Behavior unchanged: met, judged by reading the code. I did not run any tests (this lane has no shell). The PR says it did not run the Pester suites, and its other verification claims are the author's and unverified.
  • Diff edits only the listed files plus fragments: met.
  • Within the 400-line / 15-file limit: met.
  • ci-status green: not something this lane can see; left to CI.
  • machine-health fragment with ### Changed and "Internal simplification, no behavior change.": met.

Path-scoped rules: .claude/rules/skill-bodies-state-current-rules.md and cost-claims.md match these paths. The diff changes only script logic, not skill prose or cost claims, so neither rule applies.

No plugin manifests changed. The PR context contains no embedded instructions.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 084dcbd2d534285355bcdfe22c5233337843427c. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 084dcbd2d534285355bcdfe22c5233337843427c, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 084dcbd

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14990-084dcbd2d534285355bcdfe22c5233337843427c, expires on 2026-12-10.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 9be3999 Nov 10, 2026
59 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14653-42758086303-1 branch November 10, 2026 07:04
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 9be3999624d0b8cbd8bbec3bc4b21e86f1275b78; later checks count it verified from this comment.

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.

Simplify the audit and setup machine-health plugin code

1 participant