Skip to content

refactor(pr-merge-risk): simplify changedFiles dedupe and hoist the iso helper - #14202

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14117-42508848640-1
Nov 8, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14117

Summary

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

input.mjs changedFiles now dedupes the diff's paths with a Set instead of a loop that called includes on every match. That replaces an O(n^2) scan with a linear one, and the order is unchanged because a Set keeps insertion order. write-rating.mjs moves the pure iso helper out of buildRating to module scope, so it is no longer rebuilt on every call. Both files were already compact and use no shared helper that fits. The issueText rewrite I tried changed the order in which values are converted, which a direct caller with getters could observe, so I reverted it and left issueText as it is on main. Outputs, exit codes, written files, printed text, flags and exported names are unchanged.

Not verified

  • Tidy skipped: the change sits under .github/, a shared path the tidy cutoffs exclude.
  • node --test for input.test.mjs and write-rating.test.mjs was not run directly, since this lane runs no interpreter. It is left to the PR's CI unless check-affected's passed set already covered it.
  • ci-status green: a PR check that only the PR's CI can show.
  • No changelog fragment added: .github/scripts is repository infrastructure, not a plugin, and check-changelog-fragments passes without one.
  • Working tree left uncommitted as the runner instructs; the runner turns it into the patch.

Fix

  • .github/scripts/pr-merge-risk/input.mjs: changedFiles dedupes with a Set over the matchAll results, same order and content.
  • .github/scripts/pr-merge-risk/write-rating.mjs: the iso epoch-seconds-to-ISO helper moved from inside buildRating to module scope.

Verification

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

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

The run reports:

Left out: the items under Not verified.

Related

#14117

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

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

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14202, no security issues found

I read every hunk of both changed files. Both files match the trusted-path globs, so I read their whole change and checked what they feed:

  • .github/scripts/pr-merge-risk/input.mjs: changedFiles now removes duplicate paths with [...new Set(...)] instead of a loop that checked includes on each match. The regex is unchanged, and a Set keeps the order in which paths first appear, so the function returns the same paths in the same order as before. The merge-risk facts built from this list are unchanged, so no path is hidden from or added to the rating input.
  • .github/scripts/pr-merge-risk/write-rating.mjs: the pure iso helper moved from inside buildRating to module scope. Its body is identical and it captures no state. started_at and ended_at come out the same, and the version check and checkResult validation still run first.

No trust control is widened. The change touches no trusted-actor check, token scope, kill switch, merge hold, or path where untrusted text reaches a lane. It changes no plugin manifest and deletes no instruction text.

Embedded text: none in the PR context. The body of closing issue #14117 was withheld by the wrapper because its author is not on the allowed list.

Spend: none.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings.

This pull request makes two refactors that keep behavior the same. Both changed files are on trusted paths, so I read every hunk of each.

  • .github/scripts/pr-merge-risk/input.mjs: changedFiles now removes duplicate paths with [...new Set(Array.from(matchAll(...), m => m[1]))] instead of a loop that called includes on each match. A Set keeps the order paths were first added, so the output keeps its content and order. The regex and the String(diff) coercion haven't changed. input.test.mjs:13-16 covers removing duplicates, order and the new path of a renamed file.
  • .github/scripts/pr-merge-risk/write-rating.mjs: the pure iso helper moved from inside buildRating to module scope. No other iso exists in the module, so there is no shadowing or name clash. The helper never depended on local state. buildRating still runs its checks before converting the timestamps, so it throws the same errors in the same order. write-rating.test.mjs:26-27 checks the started_at and ended_at output.

Closing issue #14117 acceptance criteria

  • Behavior unchanged: met. Same outputs, same exported names, no file renamed, and the tests above cover both changes.
  • The diff edits only the listed files: met. It touches exactly the two listed files.
  • Within 400 lines and 15 files: met, at about 5 changed lines in 2 files.
  • ci-status green: I couldn't check this from here, and the PR body lists it as not verified by its author either. CI has to show it.

I didn't run the tests myself. The verification steps in the PR body are the author's claims, and I haven't checked them.

No plugin manifests changed. No embedded instructions were found in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for efab497

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-14202-efab4978870e872c44025969129edb79e09e1800, expires on 2026-12-08.

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 8, 2026
Merged via the queue into main with commit ea71555 Nov 8, 2026
67 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14117-42508848640-1 branch November 8, 2026 19:04
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit ea71555cbeff5ba04a4eb27f9cafbd0db0b4d095; 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 .github: pr-merge-risk

0 participants