Skip to content

refactor(coupling): simplify reduce skill scripts without behavior change - #15217

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14438-42929537338-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14438

Summary

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

Simplified three of the four listed coupling:reduce scripts without changing behavior. value-sites.py now builds forms() from the existing render() helper (reuse; dict dedupe keeps the first tag in the same order), hoists the swap translation table to a module constant, counts summary rows with collections.Counter, and resolves each apply path once. derivable-list.py collapses names_path() and line_list() to single passes, and collision-hotspots.sh folds the --exclude basename/path branch into one match. test-helpers.sh is left unchanged: it is already four minimal assertion primitives whose per-plugin shape docs/contracts/shell-test-helpers/README.md fixes, so there was nothing to simplify.

Not verified

  • The skill's *.test.sh suites (collision-hotspots, derivable-list, value-sites) were not run: this lane runs no interpreter or test runner and check-changed-skills skips script tests here. Left to the PR's CI.
  • ci-status green on the PR: a CI check, left to the PR's CI.
  • tidy: ai-slop:audit ran its rubric read only; its detect.sh and digest-guard.sh are not on this lane's Bash allowlist, so the deterministic detector did not run on the fragment.
  • test-helpers.sh not edited: already minimal, and its pass/fail shape is fixed by docs/contracts/shell-test-helpers/README.md.

Fix

  • plugins/coupling/skills/reduce/scripts/value-sites.py: forms() reuses render() for every spelling and dedupes with a dict; SWAP translation table hoisted to module level; summary counts via Counter, class rows printed in CLASSES order; cmd_apply resolves each site path once
  • plugins/coupling/skills/reduce/scripts/derivable-list.py: names_path() uses removeprefix and one any() over the candidate spellings; line_list() strips each line once
  • plugins/coupling/skills/reduce/scripts/collision-hotspots.sh: --exclude matching picks basename or whole path once, then does a single glob match (one shellcheck directive instead of two)
  • .changes/coupling/work-resolve-issue-issue-14438-42929537338-1-368a2d07.md: patch fragment, ### Changed, 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 90a980b:

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

The run reports:

  • check-changelog-fragments: all 14 fragments valid (run before and after tidy)
  • check-changed-skills: CHECK-SKILL reduce PASS, 0 errors, 3 pre-existing size warnings on SKILL.md (untouched)
  • check-affected: 14 passed, 5 skipped over 4 changed files (run before and after tidy)
  • fresh-context review subagent: every hunk judged EQUIVALENT by reading the code (doubled form dedupes into exact when the value has no slash; Counter keeps first-seen order and yields 0 for absent classes; inside('') is None so None in names is False); no bugs found
  • code-tidying:tidy-diff over the 12 changed hunks: no edits needed (simplify pass none, comment pass none: only a shellcheck directive and a return-shape docstring, residue pass none, markdown passes left the mandated fragment line unchanged)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42929537338

Left out: the items under Not verified.

Related

#14438

Merge-Risk: max=MEDIUM demote=false head=90a980be363727d2075a6942b92fc31fa4b9406d rubric=8.4.0 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-security-review reviewed 90a980be363727d2075a6942b92fc31fa4b9406d: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read every hunk of all 4 changed files. None of them matches a trusted path, and none touches a trust control, a plugin manifest or a standing instruction.

  • value-sites.py cmd_apply: path.resolve() now runs once, and both the known lookup and the is_relative_to(base) root-containment check use that one result. Before, it was called twice. The symlink refusal still checks the unresolved path first, and the refusal order is the same. The path-containment guard is no weaker.
  • value-sites.py forms() / swap() / summary counts: these only change how candidate spellings and counts are built. They touch no files, run no subprocess and cross no trust boundary.
  • derivable-list.py names_path() / line_list(): these are pure string handling. inside() still gates every spelling before the membership test, so this opens no path-escape route.
  • collision-hotspots.sh --exclude: the basename-or-path match is folded into one glob test. The glob is still quoted on the left-hand side and matched only inside [[ ]], so nothing reaches eval or command execution.
  • .changes/ fragment: a changelog entry only, with no security surface.

The PR context file contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: #15217, refactor(coupling): simplify reduce skill scripts

No findings. I read every hunk of all 4 changed files. I also read the unchanged helpers the changed lines call: inside() and names_path() in derivable-list.py, and render(), DRIVE_PATH, CLASSES and cmd_find in value-sites.py. I checked each hunk by reading the code; I ran nothing.

Equivalence checks

  • value-sites.py forms(): render() gives the same text as the old inline code for exact, swap, msys and wsl. The doubled case changes in one respect: the old code added it only when the value held a slash, and render() always returns it. Without a slash, though, doubled equals exact, so the dedupe drops it. dict.setdefault keeps the first tag for each text in the same order the old seen set did. The output is unchanged.
  • value-sites.py summary: Counter keeps the order in which each file first appears, the same as the old dict. Class rows still print once per CLASSES entry, in that order, and an absent class prints 0. Every row's class comes from classify().
  • value-sites.py cmd_apply: the old code already resolved the path before the symlink check, so resolving it once changes neither the order of the checks nor their results.
  • derivable-list.py names_path(): an empty text, or a base with no base value, used to be skipped because the value was falsy. Now inside('') returns None, and None in names is False, so the result is the same. removeprefix("./") strips one prefix, as before. line_list() gives the same entries.
  • collision-hotspots.sh: a --exclude glob containing / still matches the whole path, and any other glob matches the basename. target appears nowhere else in the script. Under set -e, a false && test that is not the last command in the loop body does not exit.

Closing issue #14438 acceptance criteria

  • Behavior unchanged: met, by reading the code (see above). The existing *.test.sh suites cover these scripts. The PR says they were not run in the authoring lane, so this rests on the PR's CI.
  • Diff edits only the listed files and fragments: met. test-helpers.sh is left as it was, and the PR body says why.
  • Within 400 lines and 15 files: met (4 files, about 60 changed lines).
  • ci-status green: the PR body leaves this to CI, so I could not confirm it.
  • Fragment: met. .changes/coupling/…-368a2d07.md has bump: patch, ### Changed and the required line.

The PR body's verification results (changelog-fragment and changed-skill checks, the subagent's equivalence judgment) come from the author and I did not verify them. The PR context contains no embedded directives.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 90a980b

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-15217-90a980be363727d2075a6942b92fc31fa4b9406d, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit 0750cb1 Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14438-42929537338-1 branch November 11, 2026 01:00
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/coupling/skills/reduce/scripts/collision-hotspots.sh 0 1 0 0 0 0
plugins/coupling/skills/reduce/scripts/derivable-list.py 2 0 0 0 0 0
plugins/coupling/skills/reduce/scripts/value-sites.py 3 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/coupling/skills/reduce/scripts/collision-hotspots.sh:145 SBR productive input-gap
plugins/coupling/skills/reduce/scripts/value-sites.py:507 other productive no-assertion

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 the reduce coupling plugin code

0 participants