Skip to content

refactor(maintenance-monitor-signals): fold repeated readers, checks and masks into helpers - #14226

Merged
melodic-automation-lanes[bot] merged 3 commits into
mainfrom
work-resolve-issue/issue-14111-42514645656-1
Nov 8, 2026
Merged

melodic-automation-lanes[bot] merged 3 commits into
mainfrom
work-resolve-issue/issue-14111-42514645656-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14111

Summary

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

Simplified the four maintenance-monitor-signals scripts, keeping every output, error message, exported name and signature as before. monitor.mjs now shares one yq leaf reader between readHoldRule and readIncidentRules, runs readJobsCarry's three carry parses in one loop, and builds the empty write result in one place. issues.mjs planIssues works out each signal's fingerprint match and hours once. signals.mjs shares one digit mask, reason fallback and usage share across detectors, and stops copying the lane-stop group array on every push. collect.mjs hoists the duplicated time validator and the annotation and api-budget helpers, and holds a stalled-stop pull's head as a plain sha. I added no changelog fragment: this is a refactor with no behavior change, and the pr-pipeline fragments describe changes users can see. Nothing moved between files. The total line count is unchanged (74 added, 74 removed): monitor.mjs and collect.mjs are shorter, and issues.mjs and signals.mjs each gained 2 to 3 lines for the shared helpers that took out their repeated expressions.

Not verified

  • node --test over collect/issues /monitor/signals/workflow .test.mjs: this lane runs no node or test runner, so the suites are left to the PR's CI
  • Tidy skipped: the change is under .github/, a listed shared path, so tidy-diff did not run
  • cant-fail-scan not run: it scans test files and this change edits none (its wrapper also takes no base-ref argument)
  • ci-status green on the PR: a PR check, left to the PR's CI

Fix

  • .github/scripts/maintenance-monitor-signals/monitor.mjs: readHoldRule and readIncidentRules share readMonitorLeaf, with the same messages and defaults; readJobsCarry runs its three parses in one loop over a single carry object; a nothingDone() factory replaces the two copies of the empty write…
  • .github/scripts/maintenance-monitor-signals/issues.mjs: planIssues works out the fingerprint match (unchanged), onFor and clearFor once per signal instead of in each branch
  • .github/scripts/maintenance-monitor-signals/signals.mjs: share, masked and reasonOf helpers replace the repeated used/limit ratio, digit mask and 'no reason recorded' fallback; laneStopFindings pushes into its group instead of copying the array each time
  • .github/scripts/maintenance-monitor-signals/collect.mjs: one module-level isTimeOrNull replaces the two copies of the local time check; levelAndMessage and budgetReading helpers replace repeated annotation mapping and api-budget parsing; a stalled-stop pull holds head as the sha string, and a…

Verification

The runner ran each check from the base copy against 46f2745:

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

The run reports:

  • check-changelog-fragments: all 1 fragment under .changes/ valid (run before and after the review fixes)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 8 passed, 8 skipped over 4 changed files; the rest are CI only
  • git-read diff --numstat HEAD: 4 files, 74 added and 74 removed (148 changed lines), within the issue's 400-line and 15-file limit
  • fresh-context review subagent over the whole diff: two differences, both on malformed input only (a non-string listing-held reason no longer threw, and a non-array annotation list was handled differently); both fixed so behavior matches the original, and it confirmed the test imports and the…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42514645656

Left out: the items under Not verified.

Related

#14111

Merge-Risk: max=MEDIUM demote=false head=3047cf7fef17e785e05edd2742ade21740312bf8 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 3047cf7fef17e785e05edd2742ade21740312bf8: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14226 (maintenance-monitor-signals refactor)

I read every hunk in all four changed files (collect.mjs, issues.mjs, monitor.mjs, signals.mjs under .github/scripts/maintenance-monitor-signals/). I found no security issues.

None of these files matches a trusted-path glob. None of them is a trust control, merge hold, token request, kill switch or plugin manifest. The change only reorganizes the parsing and reporting code of the read-only monitoring lane. I checked the parts that touch a trust boundary:

  • monitor.mjs readMonitorLeaf:
    • Both callers still pass yq queries that are hardcoded constants.
    • The call still runs through execFileSync with an argument array, so no shell is involved and no outside input reaches it.
    • A failed read still fails closed: it returns an Error, and the message text is the same as before.
  • monitor.mjs readJobsCarry: the carry still comes only from newestTrustedRun, which this diff does not change. Each of the three parses still falls back on its own to its safe default (an empty Map, null, or {}), just as the separate try/catch blocks did.
  • collect.mjs parseEpisodeCarry / parseHeldCarry: the module-level isTimeOrNull is identical to the two local time checks it replaces. The shape checks on carried artifact data are no weaker.
  • collect.mjs stalled-stop matching:
    • Comments are still filtered on c.user?.login !== agentIdentity before the head SHA is compared (collect.mjs#L657).
    • head is now a plain string, and every reader uses it that way.
    • Dropping the ?. on listed.pullRequests.nodes is safe: the guard at collect.mjs#L641 throws first when the list is missing.
  • issues.mjs / signals.mjs:
    • unchanged is worked out with match?. and still requires a match, where the old code checked match &&.
    • The masked, reasonOf and share helpers are pure extractions of the expressions they replace.
    • Neither file changes what text reaches an issue.

The PR description and closing-issue context contain no embedded instructions to the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: no findings. I read every hunk of all 4 changed files under .github/scripts/maintenance-monitor-signals/ (collect.mjs, issues.mjs, monitor.mjs, signals.mjs). None of them match a trusted-path glob. The diff at this head is the same refactor this lane already reviewed at earlier heads. This head is a merge of main, and I re-checked the changed code against the current files.

What I checked against closing issue #14111's criterion that behavior must not change:

  • collect.mjs: pull.head is now the sha string, and each of its readers is local to the stalled-stops source: the marks closure at collect.mjs:660 and the destructured head at collect.mjs:677. comments is still read after the older-page rounds, as before, so the gap message at L705 counts the same thing. Dropping ?. on listed.pullRequests.nodes is safe because L641 throws first when pullRequests is missing. isTimeOrNull, budgetReading and levelAndMessage match the expressions they replace.
  • issues.mjs: unchanged, onFor and clearFor are now worked out for every signal. This throws nothing: hoursSince (L152) gives NaN for a null timestamp, and that value is only read in branches where the timestamp is set. With no match, unchanged is false, which keeps the old match && … guard.
  • monitor.mjs: readMonitorLeaf builds the same error text that monitor.test.mjs L438 matches. readHoldRule and readIncidentRules stay exported under the same names. readJobsCarry returns the same shape and the same warnings on every path.
  • signals.mjs: share, masked and reasonOf match the expressions they replace, and the lane-stop grouping still produces the same arrays.

Closing issue #14111 criteria:

  • Behavior unchanged, exported names kept, no file renamed or moved: met as far as reading the code shows. The existing *.test.mjs suites in that directory cover these exports.
  • The diff edits only the 4 listed files: met.
  • Within 400 lines and 15 files: met (4 files, 74 added and 74 removed).
  • ci-status green: I can't confirm this here, so it is left to the PR's CI. The PR body says no node tests were run; that is the author's claim and I haven't checked it.

I ran no tests or commands; this review comes from reading the code. No plugin manifest changed, there is no cost or hold class, and the PR context contains no embedded instructions.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 46f274572bdea81a58127fa042abd778f280b38b. The lanes clear this reason on their own; 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 653c93575241026d1b84d7af1c85eea28d1dfefd, the head its arming checks judged.

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor Author

Verification evidence for 3047cf7

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-14226-3047cf7fef17e785e05edd2742ade21740312bf8, expires on 2026-12-08.

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

Lane-Activity: pr-unblock/resolve-conflicts
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 8, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

Merged via the queue into main with commit 9228dfe Nov 8, 2026
59 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14111-42514645656-1 branch November 8, 2026 21:56
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 maintenance-monitor-signals .github script

1 participant