Skip to content

feat(scripts): count the captures a wider control-skill sources pattern would cause - #16135

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-16116-43553307355-1
Nov 14, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #16116

Summary

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

Adds scripts/count-capture-sources.py, which lists the pull requests merged on a ref in the last N days (default origin/main, 14 days) and runs each one's changed files through the capture's own matcher (plugins/app-control/scripts/affected_features.py) twice: once against the control skill's sources globs as written, and once with each plugins/<plugin>/skills/*/SKILL.md glob widened to plugins/<plugin>/skills/, scripts/ and agents/**. For each pattern it reports how many pull requests match at least one feature and how many feature drives that comes to, then the extra captures and each pull request whose features change. It reads git history and the control skill only and starts no capture. I put it in scripts/ rather than the app-control plugin because the widening rule and the default hub belong to this repository, and it imports the capture's Mapper so the counts match what the capture would select, sub-features included. A pull request is a first-parent commit whose subject ends in (#n), the repository's squash-merge form, or starts 'Merge pull request #n '. Command for the owner: python3 -I scripts/count-capture-sources.py --ref origin/main --days 14

Remaining work

  • Run python3 -I scripts/count-capture-sources.py --ref origin/main --days 14 on an up-to-date main and post the counts on this issue as a comment, with that command
  • Label the issue needs-owner-decision and wait for the owner's reply before anything else is built
  • After the owner says yes: give the control skill's plugin feature lines the wider pattern through whatever generates them, get /app-control:map check to pass, and add a test showing that a change to plugins/<plugin>/skills/<skill>/scripts/<file> selects that plugin's feature

Not verified

  • scripts/test_count_capture_sources.py was not executed: this lane runs no interpreter, so the suite is left to the PR's CI
  • The script was not run against this repository's history, so no counts exist yet. The lane cannot run Python and its checkout has no origin/main
  • Tidy skipped: the change sits under scripts/, a shared path in the tidy cutoffs
  • Ruff and the CI-only whole-repo scanners (fixture-git-isolation, test-tmp-cleanup and others) did not run here and are left to the PR's CI. The test clears GIT_DIR, GIT_WORK_TREE and GIT_CONFIG from os.environ, which is what the fixture-git-isolation gate asks of Python suites
  • Changes are left uncommitted in the working tree, as the runner instructs; the runner turns them into the patch

Fix

  • scripts/count-capture-sources.py: new script that counts the pull requests and feature drives under the current and the widened sources globs, with text and --json output
  • scripts/test_count_capture_sources.py: new unittest suite with a temporary git fixture covering widen(), per-pull-request counts under both patterns (including a skill scripts/ change that only the wider pattern selects), the report text, --json, exit 1 for a missing hub or ref, and usage exit 2

Verification

The runner ran each check from the base copy against 09b0919:

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

The run reports:

  • check-changelog-fragments: all 39 fragments valid (scripts/ carries no fragment)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 12 passed, 6 skipped over 2 changed files
  • fresh-context review subagent over both files: no high or medium findings; it hand-traced the test's expected values against the code. Three low notes: a parentless root commit in the window with a (#n) subject would fail the diff; a direct push whose subject ends in (#n) would be counted as a pull…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43553307355

Left out: the items under Not verified.

Related

#16116

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #16135, feat(scripts): count the captures a wider control-skill sources pattern would cause

I found no blocking or advisory issues. I read both changed files in full in the diff: scripts/count-capture-sources.py and scripts/test_count_capture_sources.py.

What I checked

  • Calls into the capture matcher. The script uses INDEX, git, Mapper, unfenced and Refused from plugins/app-control/scripts/affected_features.py. The calls match their definitions there, at lines 26, 34, 67, 120 and 140.
  • widen() output. It keeps the - prefix and the field layout. index_lines strips each field, so the extra space before a fifth field does no harm. skills/** covers skills/*/SKILL.md, so the wider set always includes the current one and the "extra captures" difference can't go negative.
  • Sub-features. Widening applies only to the hub's index lines, so it would undercount if a feature file had its own sources: sub-feature lines. In this repository, no feature file under .claude/skills/control-claude-code-plugins/features/ has a sources: line, so the counts are not affected.
  • Hand-traced test values. I checked the fixture's expected values against the code:
  • Test isolation. The test removes GIT_* variables and passes a clean environment to its git calls. af.git already removes GIT_* variables from its own environment.
  • Path rules. Only .claude/rules/ruff-pin.md matches these files. It covers how ruff is run, which the changed code doesn't touch.

Not verified. I had no shell, so I didn't run the test suite or the script. The PR body says the same of the authoring lane: it ran neither, so no counts against this repository's history exist yet. The checks the PR lists as passing are the author's claims, and I haven't confirmed them.

Closing issue. The PR body says Refs: #16116 and closes no issue, so there were no acceptance criteria to check.

Low-risk notes the author already listed (not counted as findings):

  • A parentless root commit inside the time window with a (#n) subject would stop the whole run on sha^.
  • A direct push whose subject ends in (#n) would be counted as a pull request.

Neither is likely on origin/main over 14 days.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #16135

I found no security issues in this pull request.

Scope. I read both changed files in full: scripts/count-capture-sources.py and scripts/test_count_capture_sources.py. Neither matches a trusted-path glob. The pull request adds a read-only command-line script that an operator runs by hand, plus its test suite. It changes no workflow, action, manifest, hold or instruction surface. Nothing in CI or a lane runs it.

What I checked:

  • Command injection. All git calls go through af.git (affected_features.py#L34-L40). It passes a list of arguments with no shell, removes GIT_* variables from the environment, sets core.fsmonitor=false and uses --no-replace-objects.
  • Argument injection. --ref is rejected if it starts with - (count-capture-sources.py#L160). The git log and git diff calls also pass --end-of-options, and git diff adds --no-ext-diff and --no-textconv, so the repository's config can't make it run a diff or textconv driver.
  • Path handling. --hub and --repo are paths the operator supplies on their own command line. No untrusted actor reaches them.
  • Import path. The script adds an in-repository directory to sys.path and is documented to run with python3 -I. This is not a new trust boundary.
  • Tests. The tests build a temporary git repository and clear the GIT_* variables. They read no secrets.

Nothing in the PR context file tries to give instructions to this lane. Prior findings: none; this is the lane's first review of the pull request, so all severities were in scope (not blocking-only).

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 09b0919

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-16135-09b0919bd4dcd3a136846421a70c6b11a0f1ecfb, expires on 2026-12-14.

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=MEDIUM demote=false head=09b0919bd4dcd3a136846421a70c6b11a0f1ecfb rubric=9.0.0 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 2e96bc0 Nov 14, 2026
49 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-16116-43553307355-1 branch November 14, 2026 04:55
@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
scripts/count-capture-sources.py 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
scripts/count-capture-sources.py:51 other productive input-gap
scripts/count-capture-sources.py:152 ROR 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 2e96bc02450b5e19bb5029f004ea80f918039947; 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.

0 participants