Skip to content

refactor(pr-verify): simplify capture-probe, chunk-diff, find-capture and key-proxy - #14174

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14140

Summary

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

Simplified the four pr-verify scripts with behavior unchanged: one helper replaces the credential-shape test duplicated in capture-probe, find-capture builds its id and conclusion regexes from two shared fragments and picks the newest run or artifact through one helper, key-proxy strips CR inside its SSE line reader and declares the 413 drain state before the handler that uses it, and chunk-diff writes its empty-part file in one line. Outputs, exit codes, written files, printed text, flags and exported names stay the same; no file was renamed, moved or deleted. No changelog fragment: the change is to .github scripts, not a plugin, and is not user-visible.

Not verified

  • Node test suites for the four scripts (capture-probe, chunk-diff, find-capture, key-proxy and workflow tests) not run: this lane cannot run node; left to the PR's CI.
  • ci-status green on the PR: a PR CI check, left to the PR's CI.
  • tidy not run: the change is under .github/, a shared path the tidy cutoffs exclude.
  • cant-fail-scan not run: it scans test files, and this change edits none.

Fix

  • .github/scripts/pr-verify/capture-probe.mjs: credentialShaped() replaces the two inline VALUE_SHAPES.some(...) tests; scanProc builds and returns one scan object instead of three loose variables.
  • .github/scripts/pr-verify/chunk-diff.sh: the empty-chunk part-001.patch write is one \[\[ -s \]\] || line instead of an if block.
  • .github/scripts/pr-verify/find-capture.mjs: RUN_ID, CARRIED, MISS, PERMANENT and CONCLUSION are built from shared ID and ENDED_AS fragments (same patterns; MISS no longer captures the literal ended, so missReason drops that group and its always-true guard); a newest() helper replaces two…
  • .github/scripts/pr-verify/key-proxy.mjs: createUsageMeter's line() strips the trailing CR itself instead of each caller; drainTimer, answered and refuseTooLarge are declared before the data handler that uses them; the three-branch settle on upstream end is one incomplete ternary.

Verification

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

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

The run reports:

  • check-changelog-fragments: all 7 fragments valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 10 passed, 6 skipped over 4 changed files
  • fresh-context review subagent over the whole diff: no behavior change found, and no assertion in capture-probe.test.mjs, find-capture.test.mjs, key-proxy.test.mjs, chunk-diff.test.mjs or workflow.test.mjs broken; its two readability notes (the capture-probe exit expression, a 170-character line in…
  • git-read diff --numstat HEAD: 4 files, 47 added and 42 removed lines, within the issue's 400-line and 15-file limit
  • Grep of workflow.test.mjs: it reads only chunk-diff.sh's MAX_CHUNKS line from source, which is unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42497393989

Left out: the items under Not verified.

Related

#14140

Merge-Risk: max=HIGH demote=true head=8328857e6da09b247693afee6011da7f366eed7b 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 8328857e6da09b247693afee6011da7f366eed7b: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14174, pr-verify refactor

I found no security issues in this change.

I read every hunk of the four changed files. None of them is on the trusted-path list or is a trust control, a merge hold, a manifest or an instruction surface. For each file I checked that the security-relevant behavior is the same before and after:

  • capture-probe.mjs: credentialShaped() runs the same VALUE_SHAPES.some(...) test that was written out inline before. It is still used by both envHits and scanFiles, so the probe still finds credentials in process environments and stored files the same way. scanProc now builds one object, and its fields and its unreadable-/proc early return are unchanged.
  • chunk-diff.sh: [[ -s ... ]] || : >file does the same thing as the if block it replaces, including under set -e.
  • find-capture.mjs: The ID and ENDED_AS fragments rebuild the old patterns exactly, and every regex is still anchored with ^…$. The run and artifact id checks and the conclusion check, which validate API input, are no looser. The MISS destructuring was updated to match the dropped (ended) group. After the six named branches, the only match left is the ended: alternative, so returning without the guard is safe. newest() keeps the same isCaptureRun filter and the same name/expired === false/id filter on artifacts.
  • key-proxy.mjs:
    • The CR stripping moved into line(). forEach also passes an index and the array, but line ignores them.
    • drainTimer, answered and refuseTooLarge are now declared before the data handler. That handler always ran asynchronously, so there was no temporal-dead-zone problem before, and the 413 path and its answered guard work as before.
    • The new settle ternary covers the same cases as the old three branches: a non-2xx status commits meter.total(), and an incomplete 2xx commits abandoned(). The budget can't be under-counted.
    • The API key check and the body size cap are untouched.

The diff doesn't change who is trusted, what a token can do, what untrusted text reaches a lane, or any merge hold. It also spends nothing.

The PR description has no embedded instructions aimed at the review lanes. This was a full review (0 heads reviewed before, blocking only: no).

critical-findings: 0

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14174, refactor(pr-verify) simplifications

No findings. I read every hunk of all 4 changed files and checked each one for behavior equivalence against the closing issue #14140's first criterion, "Behavior is unchanged".

  • capture-probe.mjs: credentialShaped() wraps the same VALUE_SHAPES.some(...) test. The patterns have no g flag, so .test keeps no state between calls. scanProc now returns one scan object, with the same keys and values on both the early-return path and the normal path. pids no longer starts as [], but the catch branch returns before pids is used, so this is safe.
  • chunk-diff.sh: [[ -s f ]] || : >part is the same as the old if block, and it does not trip set -e, because a failing left side of || never stops the script.
  • find-capture.mjs: the patterns built from the ID and ENDED_AS strings match the old literals, and neither fragment holds a backslash that a template string would change. MISS no longer captures the literal ended, and the missReason destructuring was shifted by one group to match: bare, code, runId, endedId, conclusion. The old ended && guard was always true once the earlier branches failed to match, so dropping it changes nothing. newest() keeps the old array guard and the sort by highest id for both runs and artifacts.
  • key-proxy.mjs: line() strips the trailing CR before it checks for data:, as both callers used to do. forEach(line) passes extra arguments, but line ignores them. Moving drainTimer/answered/refuseTooLarge above the data handler changes nothing at runtime: the callbacks only ran after those declarations existed, and the 401 early-return comes before both versions. The incomplete ternary gives the same result as the old three-branch settle in every case: !ok → total; ok with the stream or body incomplete → abandoned(); otherwise → total.

Closing issue #14140 criteria:

  • Behavior unchanged: met, by the line-by-line equivalence reasoning above. The PR says the existing test suites cover these paths: capture-probe.test.mjs, find-capture.test.mjs, key-proxy.test.mjs, chunk-diff.test.mjs. That is the author's claim, and I did not check it: this lane cannot run tests.
  • Only the listed files are edited: met, the diff touches exactly the 4 listed files.
  • Within 400 changed lines and 15 files: met. By my count the diff has 41 added and 36 removed lines across 4 files. The PR body says 47 and 42; either way it is well under the limit.
  • ci-status green: not checked by this lane; left to the PR's CI.

Other checks:

  • Path-scoped rules: none of the .claude/rules/ globs match these .github/scripts/ paths.
  • Plugin manifests: no manifest is changed.
  • Paved paths: not checked; I did not resolve the standards index on this run.
  • Prior findings: this lane has not reviewed an earlier head, so this was a full review, not blocking only.
  • The PR context held no embedded instructions.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 8328857

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-14174-8328857e6da09b247693afee6011da7f366eed7b, 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 3137027 Nov 8, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14140-42497393989-1 branch November 8, 2026 17:34
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/pr-verify/capture-probe.mjs 3 0 0 0 0 0
.github/scripts/pr-verify/chunk-diff.sh 1 0 0 0 0 0
.github/scripts/pr-verify/find-capture.mjs 1 0 0 0 0 0
.github/scripts/pr-verify/key-proxy.mjs 1 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/pr-verify/key-proxy.mjs:201 other unclassified none

The run's summary has the full report.

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-verify (1 of 2)

0 participants