Skip to content

refactor(source-control): simplify babysit_verify_evidence.py part 4 of 4 - #15562

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14939-43167464786-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14939

Summary

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

Simplified the functions that start in range 4 of 4 (lines 4576-6100 of 6100 when this part started) of babysit_verify_evidence.py, without changing behavior. Repeated code now goes through shared helpers: _first_line is reused, a new _login_is replaces six inline case-insensitive login comparisons, capped_close gets local post_comment and remove_label helpers, _Pacer gets a _cap_stop message builder, and _PerRunBuild gets a _read_run checkpointed read. REPOSITORY_FIELDS is reused in _kept_run, the duplicated SHA check in main is merged into one, and a dead pr = None and an always-true config is not None are removed from _evidence_report. The gh argument lists, error and stop messages, write order, JSON keys and order, exit codes and CLI flags are all unchanged.

Not verified

  • The babysit-prs Python unit tests (scripts/tests/test_babysit_verify_*.py) were not run directly: this lane allows no interpreter. Left to the PR's CI.
  • Ruff lint and format were not run directly. check-affected passed, and the edited lines stay at or under 88 columns.
  • ci-status green is a PR check, left to the PR's CI.
  • tidy: passes 1-3 (simplify, comments, generated-code residue) ran over the code lines and found nothing more to edit. Pass 4 (docs-hygiene write-for-humans) was skipped on the changelog fragment because the issue fixes its text verbatim. Pass 5 (ai-slop fix) ran only as a rubric read, which found…
  • Left as is: the per-issue labels string in capped_close's plan reuses the name of the PR's label set computed earlier in the same function. Renaming it would touch many lines, so this run did not do it.
  • git status shows untracked runner environment files (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc). This run did not create them and they are not part of the change.

Fix

  • plugins/source-control/skills/babysit-prs/scripts/babysit_verify_evidence.py: in the range-4 functions (_capped_record, _lane_removals, _spent, not_converging_stop, capped_close, _Pacer, _kept_run, _PerRunBuild.build, main, _evidence_report), added the _login_is, _cap_stop and _read_run helpers and…
  • .changes/source-control/work-resolve-issue-issue-14939-43167464786-1-379f2b4a.md: new patch fragment, created with new-changelog-fragment, whose body is ### Changed and the line "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 5a5b34b:

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

The run reports:

  • check-changelog-fragments: all 93 fragments valid (run before and after tidy)
  • check-changed-skills: babysit-prs PASS, 0 errors, 4 pre-existing warnings about SKILL.md size and description length, none from this diff (run before and after tidy)
  • check-affected: 13 passed, 6 skipped, the rest CI only, over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff, checking edge cases (empty plan, window_reset 0, non-dict JSON, argparse error order, walrus scoping, write order): no behavior change, no syntax or name error found
  • scope: every edited function starts at or after line 4576 (range 4 of 4 equal ranges of the 6100-line file); _login_is is added at line 4639, inside that range
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43167464786

Left out: the items under Not verified.

Related

#14939

Merge-Risk: max=HIGH demote=true head=5a5b34b51ca4855a4c98a16c7ecf3ddc47b20061 rubric=8.4.9 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-review reviewed 5a5b34b51ca4855a4c98a16c7ecf3ddc47b20061: 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 and the unchanged code they call. This PR simplifies range 4 of babysit_verify_evidence.py, and I traced each edit to check that behavior stays the same:

  • _login_is / _first_line. _first_line (L1137) is exactly str(body or "").split("\n", 1)[0].rstrip("\r"), the same as the inline code it replaces. _login_is matches all six inline comparisons it replaces, including the inverted ones in not_converging_stop and capped_close.
  • _spent. The set comprehension with the walrus pr gives the same set as the loop it replaces.
  • capped_close.
    • Unpacking plan[0] with the default (None, [], None, False, "none") passes the same arguments to capped_close_bodies. For an empty plan, held.get(...) was None before and is None now.
    • remove_label builds repos/{repo}/issues/{issue}/labels/{quote(label, safe="")}, which equals the old {base}/{admission_path} and {base}/{quote(STATUS_READY)} strings, since base is built at L5034. The what strings and missing_ok are unchanged.
    • post_comment keeps the same targets and labels, and the order of writes is unchanged.
  • _Pacer._cap_stop. In open_window, self.window_reset is set to reset just before the call (L5282), and reset is already checked to be an int. So self.window_reset or 0 gives the same timestamp, including when reset == 0. The rate-limit parse still raises KeyError or TypeError on the same inputs.
  • _kept_run. REPOSITORY_FIELDS is ("repository", "head_repository") (L1000), so the keys and their order are unchanged.
  • _PerRunBuild._read_run. Same check against the checkpoint, same read and same save, at both call sites.
  • main SHA check. It now runs right after parse_args for evidence and capped-close only. No command checks its arguments before it on the old path, so the error and its order stay the same for both. Other subcommands, which have no head argument, never reach it.
  • _evidence_report. pr is assigned on both branches of if args.lane_reviews, so removing pr = None is safe. config can't be None at the removed check, because config.max_verify_fails is already read at L6013.

Closing issue #14939, criteria against the diff:

  • Behavior unchanged: met, as traced above. The existing test_babysit_verify_*.py suites cover these paths. I didn't run them (no interpreter here). The author also says they weren't run; that's left to CI.
  • Only listed files plus a fragment are edited: met.
  • Within 400 changed lines: met.
  • The fragment's body matches the required text, with bump: patch: met.
  • Range 4 only: the edited functions all start after about line 4576. This is the author's claim; it's consistent with the hunk positions I saw.
  • ci-status green: depends on the PR's CI, not checked here.

There's no plugin.json or marketplace.json change, so no manifest lines apply. I found no instructions embedded in the PR context. babysit_verify_evidence.py is on a trusted path. I gave it extra scrutiny, and it changes no gating outcome.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: no security issues found

critical-findings: 0

This is a refactor of plugins/source-control/skills/babysit-prs/scripts/babysit_verify_evidence.py, plus a new patch changelog fragment. The script is on the trusted-path list and backs the merge holds (/source-control:babysit-prs's babysit_verify_evidence.py), so I read its whole change. For each edit I checked whether it weakens, narrows or removes a hold. None does: every edit gives the same result as the code it replaces.

What I checked

  • The new _login_is helper. It does the same case-insensitive login check as the six inline comparisons it replaces, on user or actor as before. That covers _capped_record, _lane_removals, _spent, not_converging_stop and the capped_close author check. The negations in not_converging_stop and capped_close keep their logic. The check that only the lanes App's own records count (identity binding) is unchanged.
  • _capped_record. _first_line (line 1137) is identical to the deleted inline split and rstrip("\r").
  • capped_close's new remove_label and post_comment helpers. remove_label builds repos/{repo}/issues/{issue}/labels/<quote(label, safe="")>. That equals the old {base}/{admission_path}, since base at line 5034 is the same string and admission_path was the same quote. missing_ok=True and the error-message text are kept. The gh POST arguments are the same, and so is the write order.
  • capped_close's first-plan unpacking. The empty-plan default (None, [], None, False, "none") gives the same None/False/None arguments as the old conditionals.
  • _Pacer._cap_stop. At the first call site, self.window_reset is set to reset just before the call, so the message is the same.
  • _kept_run. It now loops over REPOSITORY_FIELDS = ("repository", "head_repository") (line 1000), giving the same keys in the same order.
  • _PerRunBuild._read_run. It keeps the same skip-if-checkpointed logic and saves after each read.
  • The SHA check in main, now done once (babysit_verify_evidence.py:5949). It is now checked up front for evidence and capped-close. Before, capped-close checked inside its branch, and evidence checked after every other subcommand had returned, so the same two commands are still validated. The only difference is that an evidence call with both a bad SHA and --lane-queue without --lane-reviews now gets the SHA error first. Both errors exit through parser.error, so no check is lost.
  • _evidence_report. pr is set on both branches of if args.lane_reviews, so the deleted pr = None did nothing. config is either set or the function has already returned, so config is not None was always true.

Changelog fragment: documentation only, no security surface.

PR context: nothing embedded there tries to direct the review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5a5b34b

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-15562-5a5b34b51ca4855a4c98a16c7ecf3ddc47b20061, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 3749963 Nov 12, 2026
70 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14939-43167464786-1 branch November 12, 2026 07:31
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 37499632328751eb5e4d00cda50f77d0b6631fd8; 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 babysit_verify_evidence.py source-control plugin code (part 4 of 4)

0 participants