Skip to content

fix: Simplify the parser_helper.cjs harness-ops plugin code (part 2 of 2) - #15307

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14566-42987345625-1
Nov 11, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14566-42987345625-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14566

Summary

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

Simplified the second half of parser_helper.cjs (functions starting at line 1445 or later of 2889) without changing behavior. Four hand-written AST child loops in freshnessOf's ownClass, sinkHits, scanOf and computedLoads now call the existing forEachChild helper (reuse). The onlyInit closure that freshnessOf and sinkHits each defined is now one module-level const. sinkHits reuses its holder local in place of a second parents.get(node), and scanOf computes an ObjectPattern key once in place of calling keyName twice. A harness-ops patch changelog fragment was added.

Not verified

  • The harness-ops inventory test suites were not run here, because this lane's Bash runs only the named wrappers (no node or pytest). They are left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • Tidy pass 5 (ai-slop fix on the changelog fragment) ran only as a rubric read: detect.sh and digest-guard.sh are not allowed wrappers in this lane. The rubric found no tells, and the issue fixes the fragment text word for word.
  • The working tree has untracked files this run did not create (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc). They are runner environment files, not part of this change, and the tidy measurement left them out.

Fix

  • plugins/harness-ops/skills/inventory/scripts/js/parser_helper.cjs: replaced four inline child-traversal loops with forEachChild; hoisted the duplicated onlyInit helper to module scope; reused holder in sinkHits' vm-runner check; computed the scanOf ObjectPattern key once (net -21 lines)
  • .changes/harness-ops/work-resolve-issue-issue-14566-42987345625-1-7e496b07.md: new patch fragment, ### Changed / Internal simplification, no behavior change.

Verification

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

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

The run reports:

  • check-changelog-fragments: All 52 changelog fragments valid (run before and after tidy)
  • check-changed-skills: inventory PASS, 0 errors, 2 pre-existing size warnings on SKILL.md, which this change does not touch
  • check-affected: 12 passed, 7 skipped over 2 changed files (run before and after tidy)
  • fresh-context subagent review of the full diff: no behavior difference found. forEachChild keeps the same key order and filter. The added c !== node guard in ownClass is a no-op for ESTree nodes. The top-level onlyInit has no TDZ or shadowing risk. holder equals parents.get(node) at the vm-runner…
  • range check: every changed function (freshnessOf, sinkHits, scanOf, computedLoads) and the hoisted onlyInit start after line 1445 of the 2889-line file, so all edits fall in range 2 of 2
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42987345625

Left out: the items under Not verified.

Related

#14566

Merge-Risk: max=MEDIUM demote=false head=b1a08eb7e2db7950e03af5bfe6fa3417a083b847 rubric=8.4.2 rater=claude-opus-5-5 checker=claude-opus-5-5

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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed b1a08eb7e2db7950e03af5bfe6fa3417a083b847: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15307 (head b1a08eb)

No security issues found. This is a full review, not blocking-only: prior findings show 0 earlier heads reviewed.

I read every hunk of both changed files. Neither matches a trusted-path glob. The PR changes no trust control, plugin manifest, workflow or standing instruction.

parser_helper.cjs is part of the inventory's sink scanner, which flags eval, Function, vm and definer use. A refactor that quietly changed what it detects could hide a dangerous sink from the inventory, so I checked each change against the code at head:

  • Four AST child loops now call forEachChild. The helper is defined at parser_helper.cjs#L159-L166. It walks the same keys in the same order with the same filter (c && typeof c.type === "string" && c !== node). The c !== node guard is new for the loop in freshnessOf, but it changes nothing because an ESTree node never contains itself. In scanOf, parents.set plus push still run once for each child, as before.
  • onlyInit moved to module scope at L1712. It is a pure function of its argument and used none of the enclosing function's variables. There is now one declaration, no shadowing, and its four call sites are unchanged.
  • The vm-runner check now reuses holder. holder is const holder = parents.get(node) at L2280, in the same loop pass as the check at L2355. Being const, it cannot have changed, so vm-string-code detection is unchanged.
  • The ObjectPattern key in scanOf is computed once. For a non-computed key, prop.key.name ?? String(prop.key.value) can never be null, so the new key !== null guard always adds it, as before. The computed branch behaves as before.

The changelog fragment is prose only, with a bump: patch front matter field.

The PR text contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed b1a08eb7e2db7950e03af5bfe6fa3417a083b847: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of both changed files in the full diff and checked each rewrite against the unchanged code it now calls. I found no behavior change.

  • forEachChild reuse (4 sites). The helper at parser_helper.cjs#L159 uses the same Object.keys order, array flattening and c && typeof c.type === "string" && c !== node filter as the loops it replaces in sinkHits, scanOf and computedLoads. In scanOf, both the parents.set and the push still run for each child. The old loop in freshnessOf/ownClass had no c !== node guard. Adding it changes nothing, because an ESTree node never holds itself as a child.
  • onlyInit hoisted to module scope (#L1712). The two removed closures were identical and captured nothing from their enclosing function. No other binding in the file uses the name, so nothing is shadowed.
  • holder reuse in the vm-runner check (#L2355). holder is const holder = parents.get(node) at #L2280, in the same loop body, and nothing reassigns it in between. The nearby checks at L2323 and L2342 already use it the same way.
  • scanOf ObjectPattern key. A non-computed key gives key.name ?? String(key.value), which is never null, so it is always added, as before. A computed key gives keyName(prop.key, true) and is added only when that is non-null, also as before. keyName has no side effects, so calling it once instead of twice changes nothing.

Closing issue #14566 acceptance criteria

  • Behavior unchanged: met, from reading the code; I could not run anything (see below). The rewrites are pure refactors of internal code, and no exported names change.
  • Edits only the listed file plus fragments: met.
  • Within 400 lines and 15 files: met (2 files, net about −21 lines).
  • ci-status green: left to the PR's CI; I did not see it.
  • Fragment body is ### Changed / "Internal simplification, no behavior change." with a patch bump: met.
  • Only functions starting in range 2 of 2 are changed: consistent with the diff. Every edited function, and the hoisted onlyInit at L1712, sits past L1445. I did not measure the range boundary myself.

The author's verification (changelog-fragment and changed-skills checks, check-affected) is author-claimed and unverified here. This lane has no shell, so I could not run the inventory test suites.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for b1a08eb

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-15307-b1a08eb7e2db7950e03af5bfe6fa3417a083b847, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit ef4a137 Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14566-42987345625-1 branch November 11, 2026 08:57
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit ef4a137d77667e1b3fb40f9a8dc0c458ae975f5b; 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 parser_helper.cjs harness-ops plugin code (part 2 of 2)

0 participants