Skip to content

refactor(harness-ops): simplify check-prerequisites.mjs - #14765

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14588-42645170391-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14588

Summary

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

Simplified plugins/harness-ops/skills/prerequisites/scripts/check-prerequisites.mjs without changing its behavior. Changes: an isFile helper replaces two copies of the existsSync-and-statSync check; rootsFromSettings now builds every enabled id's install rows and makes a single rootsFromListing call, where it used to call once per id; run nests the 'no plugin roots to read' exit inside the repository-scan block instead of testing the same condition a second time. rootsFromSettings still walks the enabled ids in sorted order, so roots, their order and the error raised on malformed records all stay the same.

Not verified

  • check-prerequisites.test.sh and the harness-ops node tests were not run here: this lane's Bash runs only the named wrappers, so no node or test runner. Left to the PR's CI
  • tidy pass 5 (ai-slop:audit fix) skipped: its detect.sh cannot run under this lane's Bash restriction. The one fragment line is the issue's mandated wording and was read for tells by hand
  • ci-status green on the PR is left to the PR's CI
  • typos lint skipped by check-affected (typos not installed)

Fix

  • plugins/harness-ops/skills/prerequisites/scripts/check-prerequisites.mjs: add isFile helper and use it at both call sites; rootsFromSettings returns early when nothing is enabled or installed_plugins.json is absent, then builds all rows with flatMap over enabled.sort() and calls rootsFromListing…
  • .changes/harness-ops/work-resolve-issue-issue-14588-42645170391-1-9a9964f7.md: new patch fragment, ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against 51cadf1:

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

The run reports:

  • check-changelog-fragments: all 2 fragments valid (run before and after the review fix)
  • check-changed-skills: prerequisites PASS, 0 errors, 0 warnings
  • check-affected: 12 passed, 7 skipped, re-run after the final edit
  • fresh-context review subagent (equivalence of old and new code): found one difference. Iterating enabled unsorted changed which malformed record threw first, so a truthy non-string projectPath under two ids gave a different TypeError. Fixed by iterating enabled.sort(). The reviewer confirmed root…
  • tidy (code-tidying:tidy-diff): passes 1-3 found no further edit in the listed code lines, pass 4 (write-for-humans) left the mandated fragment line unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42645170391

Left out: the items under Not verified.

Related

#14588

Merge-Risk: max=MEDIUM demote=false head=8e94af460de7f345059ad23cfa41356448d4f0cc rubric=8.1.6 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of 8e94af460de7f345059ad23cfa41356448d4f0cc: no file of this pull request changed since the review of 51cadf1.

Security review: PR #14765, head 51cadf1

I found no security issues. I read every hunk of both changed files. Neither file matches a trusted-path glob, and neither touches a trust control, a merge hold, a plugin manifest or a standing instruction.

  • .changes/harness-ops/…-9a9964f7.md adds a changelog fragment with a patch bump and no executable content.
  • plugins/harness-ops/skills/prerequisites/scripts/check-prerequisites.mjs is a local CLI refactor:
    • isFile helper: it replaces two inline copies of the existsSync and statSync().isFile() check. The predicate is the same.
    • rootsFromSettings: it now returns early when nothing is enabled or installed_plugins.json is absent. Otherwise it builds the rows for every enabled id with flatMap over enabled.sort() and makes one rootsFromListing call instead of one call per id. The same rows are filtered from the same local files. No new input source, path construction or command execution is added.
    • run: the "no plugin roots to read" exit moved inside the roots.length === 0 && !stateRead scan block (check-prerequisites.mjs#L196-L209). The old outer check could only be true when that block had run, so the exit behaves the same.

I found no injection, path-traversal, credential or trust-boundary surface in the change. The embedded-text check found no directives in the PR context.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of 8e94af460de7f345059ad23cfa41356448d4f0cc: no file of this pull request changed since the review of 51cadf1.

Code review: no findings. I read every hunk of both changed files (complete review).

I checked by reading the head file that the refactor of check-prerequisites.mjs keeps the old behavior. I did not run anything.

  • isFile helper: its expression is the same as the two inline existsSync && statSync().isFile() checks it replaces.
  • rootsFromSettings:
    • The early return if (!enabled.length || !hasInstalled) is the inverse of the old guard, and both return { read, roots: [] }.
    • The old code called rootsFromListing once per id and concatenated the results. The new code makes one call over the rows of all ids. Results match because rootsFromListing keys best by row.id and returns its keys through the same default .sort() that enabled.sort() uses. Each id still gives at most one root, in the same order, with the same enabled/installPath filter.
    • Rows are still processed in sorted-id order, then record order. So a TypeError from a malformed projectPath (thrown by path.resolve in realOr) is raised at the same row as before.
  • run: the "no plugin roots to read" exit now sits inside the scan block. The old separate check repeated the scan block's roots.length === 0 && !stateRead condition, and nothing in the scan changes stateRead. Both copies sit inside the outer if (roots.length === 0), so the --plugin-root path is unaffected.
  • Exports: the exported names and signatures (rootsFromListing, rootsFromSettings, run) are unchanged.

Closing issue #14588:

  • Behavior unchanged: met, by the reasoning above. check-prerequisites.test.sh covers the settings fallback and the no-roots exit.
  • Only listed files plus a fragment edited: met.
  • Size limits: met (about 25 changed lines in one hand-edited file).
  • Fragment wording: met. It has bump: patch, ### Changed and "Internal simplification, no behavior change."
  • ci-status green: CI decides this, and this lane did not check it. The PR body says the tests were not run in the authoring lane; that claim is the author's and I did not verify it.

No plugin manifest changed. No security-relevant surface changed, and no file matched a trusted path.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 8e94af4

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-14765-8e94af460de7f345059ad23cfa41356448d4f0cc, expires on 2026-12-09.

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 9, 2026
Merged via the queue into main with commit 9c78587 Nov 9, 2026
46 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14588-42645170391-1 branch November 9, 2026 19:07
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 check-prerequisites.mjs harness-ops plugin code

1 participant