Skip to content

refactor(github): simplify upkeep and merge-base scripts - #14200

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14114

Summary

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

Behavior-preserving simplifications in three of the six listed files. batch.mjs: push and publish now share a readPlan helper instead of each repeating the parseAreas plus validatePlan read. upkeep.mjs: areaOf's four-way if/else is now two expressions with the same results, and a single-use local in plan() is inlined. context.sh: keep() now sets omitted=true itself, which removes the kept flag and the three caller lines that checked it. I reviewed prepare.sh, run-prepare.sh and tree-entries.sh and left them unchanged. In run-prepare.sh I tried dropping the ${VAR:?} reassignment line, which repeats the set-variables loop, and in prepare.sh the ${GIT_AUTHOR_NAME:-} default. The repository's shellcheck rcfile flags SC2154 without them, so I reverted both. The other candidates (temp files around git diff-tree and cat-file) exist so that pipefail and set -e catch git failures, so they stay.

Not verified

  • Tidy skipped: the change is under .github/, a listed shared path for the tidy cutoffs
  • Test suites (upkeep.test.mjs, batch.test.mjs, context.test.sh, write-runner-never-rules.test.sh) were not run directly here, because this lane runs only the named wrappers; check-affected reported its selected checks passed, and the PR's CI runs the suites
  • ci-status green on the PR is left to the PR's CI
  • Changes are left uncommitted in the working tree, as this lane's runner instructions require; the runner turns them into the patch

Fix

  • .github/scripts/maintenance-tidy-code-upkeep/batch.mjs: adds readPlan(env), used by push and publish in place of each one's own parseAreas/validatePlan read
  • .github/scripts/maintenance-tidy-code-upkeep/upkeep.mjs: areaOf's branch chain becomes nested/area/glob expressions with an early root return; plan() inlines the swept local
  • .github/scripts/merge-base/context.sh: keep() sets omitted=true when it leaves a file out; drops the kept global and the three [[ $kept == kept ]] checks

Verification

The runner ran each check from the base copy against 390a4e3:

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

The run reports:

  • check-changelog-fragments: all 2 fragments under .changes/ valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: first two runs failed shellcheck SC2154 on my run-prepare.sh and prepare.sh edits; after reverting both, 10 passed, 6 skipped over 3 changed files (shellcheck included)
  • fresh-context review subagent: read the three changed files and their tests (upkeep.test.mjs areaOf cases, context.test.sh omitted assertion), found no behavior difference: same areaOf results for root, plugins/x, plugins/x/y, a/b/c, plugins//x and dot paths, same error order in readPlan, and…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42508840079

Left out: the items under Not verified.

Related

#14114

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

Security review: PR #14200 (head 390a4e3)

I found no security issues.

critical-findings: 0

I read every hunk of all 3 changed files. None of them matches a trusted-path glob, and none of them is a trust control, merge hold, manifest or instruction surface. The PR description says the change is a behavior-preserving refactor. I checked that claim against the code.

  • .github/scripts/maintenance-tidy-code-upkeep/batch.mjs: push and publish now both call a shared readPlan(env). The helper reads the same env vars (AREAS, PLAN_FILE, DATE, BASE_SHA) and calls parseAreas then validatePlan in the same order as before. Plan validation still runs before any write or pull request is opened, so nothing skips validation now.
  • .github/scripts/maintenance-tidy-code-upkeep/upkeep.mjs: the rewritten areaOf gives the same {area, glob} results as the old branch chain. That covers root files, plugins|docs/<x>, plugins|docs/<x>/<y>..., other top-level directories and dot-prefixed paths, which still return null. One difference: the root case now returns before the SAFE_AREA test. The literal "root" passes SAFE_AREA anyway, so the check that keeps unsafe area names out of branch slugs is unchanged. A path such as plugins//x still produces the area plugins/, which still fails SAFE_AREA and returns null. The inlined swept local changes nothing.
  • .github/scripts/merge-base/context.sh: keep() now sets omitted=true itself when the total cap is spent, and the kept global and its three caller checks are gone. omitted=false is still reset for each path (L99). keep runs in the same shell, not a subshell, so the flag set inside it reaches the caller. The cap on what the conflict context writes and the omitted flag it reports to the next step behave as before. jq --argjson omitted still only ever gets true or false.

The PR context file has no embedded instructions aimed at this lane. This was the lane's first review of the PR (prior findings: none, not blocking only).

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read all three changed files in full. Each change keeps the old behaviour.

  • batch.mjs: readPlan(env) makes the same calls as before, in the same order: parseAreas(env.AREAS), then validatePlan with env.PLAN_FILE, env.DATE and env.BASE_SHA. So the errors come out in the same order. push no longer destructures date and PLAN_FILE, and nothing in its body used either one (batch.mjs#L272-L307). publish passes env.GITHUB_REPOSITORY straight through, and the result doesn't change.

  • upkeep.mjs: I compared the old and new areaOf for every kind of path:

    • a single-part path gives root / *.
    • plugins|docs with more than 2 parts gives p0/p1 / p0/p1/**.
    • plugins|docs with exactly 2 parts gives p0 / p0/*.
    • any other path gives p0 / p0/**.
    • a dot-prefixed path gives null.

    The new early root return skips SAFE_AREA, which doesn't matter: the pattern at upkeep.mjs#L30 matches "root", so the old check always passed there. Inlining swept in plan() changes nothing.

  • context.sh: omitted=false is still reset for each path before its keep calls (context.sh#L99). keep now sets omitted=true only on the path where it previously set kept=omitted. A file that gets cut is still not marked omitted, as before. Under set -e, both of keep's exits still return 0: the bare return after an assignment, and the closing written=$((...)) assignment.

Closing issue #14114, acceptance criteria:

  • Behavior unchanged: met, per the walkthrough above. The existing upkeep.test.mjs areaOf cases and the context.test.sh omitted assertion cover the changed logic (the PR's summary says so; I did not run them).
  • Edits only listed files: met. All 3 changed files are on the issue's list, and no tests or fragments were touched.
  • Within 400 lines and 15 files: met.
  • ci-status green: I can't check this from inside the lane. The PR's CI will show it.

The PR's verification (shellcheck, check-affected, check-changelog-fragments) is the author's claim; I did not verify it. No plugin manifests, userConfig fields or paved-path entries are touched. There is no cost-class change.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 390a4e3

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-14200-390a4e3b60a4d684a4fb163aa490167090a529b1, 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 c55c26c Nov 8, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14114-42508840079-1 branch November 8, 2026 19:02
@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/maintenance-tidy-code-upkeep/batch.mjs 0 1 0 0 0 0
.github/scripts/maintenance-tidy-code-upkeep/upkeep.mjs 5 0 0 0 0 0
.github/scripts/merge-base/context.sh 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/maintenance-tidy-code-upkeep/batch.mjs:269 other productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit c55c26c95c6df4da0772b21741f06d241abeac03; 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: maintenance-tidy-code-upkeep, merge-base

0 participants