Skip to content

refactor(skill-quality): simplify measure-invocation.sh and skill-frontmatter.sh without behavior change - #15265

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14759

Summary

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

Simplified the two listed skill-quality scripts without changing their outputs, exit codes, messages, flags or exported names. In measure-invocation.sh: resolve_skill_md now loops over its three candidate paths; a read_query helper replaces the duplicated four-jq-call query read in score and emit-plugin-eval; a flag_ids helper replaces four copies of the 'collect bad ids, FAIL with them' block in validate; the correct flag is one comparison, since predicted is always true or false; and the per-split stats jq is one stats($s) function in place of two copied objects plus four rate lines (key order unchanged). In skill-frontmatter.sh: the frontmatter fence awk is one branch, metadata_field drops an unused local, and two comments lose history narration and #3189 back-references. Choice of means: changes that would alter stderr on malformed input (merging validate's count jq calls) or on unusual competitor names (resetting comp_listing with =()) were left out; see not_done.

Not verified

  • plugins/skill-quality/scripts/measure-invocation.test.sh, check-skill.test.sh and scripts/check-summary-reader-parity.test.sh were not run: this lane runs no interpreter or test runner; left to the PR's CI
  • ci-status green on the PR: a CI check, left to the PR's CI
  • tidy pass 5 ran the ai-slop rubric only: the lane's shell policy does not allow running ai-slop's detect.sh, so the deterministic detector was skipped on the changelog fragment
  • Latent bug left in place: cmd_score clears comp_listing with a per-key unset loop, which re-expands keys, so a competitor name containing $, a backtick, ], or * (possible through competitor_dirs) can abort, run a command substitution or leak a stale listing into the next skill. Fixing it with…
  • Build/lint step: no separate build exists for these bash scripts; check-affected's output does not name its 13 passed checks, so whether they include shellcheck/shfmt on these files is unconfirmed here; no other lint was run, left to the PR's CI

Fix

  • plugins/skill-quality/scripts/measure-invocation.sh: resolve_skill_md loops over its candidates; new read_query and flag_ids helpers replace duplicated blocks in validate, score and emit-plugin-eval; correct computed by one comparison; split stats jq folded into one stats($s) function
  • plugins/skill-quality/scripts/skill-frontmatter.sh: extract's fence awk simplified to one branch; metadata_field drops the unused mode local; two comments shortened and stripped of #3189 back-references
  • .changes/skill-quality/work-resolve-issue-issue-14759-42959410037-1-0e5114e1.md: patch fragment, '### Changed' / 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 21 fragments valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped (none failed) over 3 changed files
  • fresh-context review subagent over the whole diff: one behavior difference found (comp_listing=() reset differs from the per-key unset loop for competitor names containing $, ], or *); that edit was reverted; every other hunk confirmed equivalent, including jq key order, dynamic scoping of…
  • tidy (code-tidying:tidy-diff) over the 14 changed hunks: no further edits; passes 1-3 found nothing beyond the change itself, pass 4 kept the issue-mandated fragment text, pass 5 rubric found no AI-writing tells
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42959410037

Left out: the items under Not verified.

Related

#14759

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

Security review: PR #15265 (head ecd53f5)

No security issues found.

I read every hunk of all 3 changed files: the changelog fragment, plugins/skill-quality/scripts/measure-invocation.sh and plugins/skill-quality/scripts/skill-frontmatter.sh. None of them matches a trusted-path glob, and none is a trust control, a merge hold, a plugin manifest or a standing instruction.

The change is a refactor of local bash helpers:

  • resolve_skill_md loop: checks the same three candidates in the same order as before.
  • read_query helper: it sets variables by dynamic scoping, and both callers (cmd_score, cmd_emit) still declare local id split expect request before the call, so nothing leaks into global scope.
  • flag_ids helper: its jq filter argument is always a literal string written in the script, never input data, so there is no new jq or shell injection path. The probe file path is passed quoted, as before.
  • expect == predicted comparison: only affects scoring correctness, with no trust impact.
  • jq stats($s) refactor: a pure output-shaping change.
  • skill-frontmatter.sh: the awk fence logic is equivalent, one unused local is gone, and comments were edited. The file's mode changed from 100644 to 100755. That has no security impact: it gains no new caller and nothing new runs it.

The PR text mentions a latent issue in cmd_score's per-key unset loop over comp_listing (competitor names containing $ or a backtick). That code is unchanged and pre-existing, so it is not reported here.

Nothing in the PR context reads as an instruction to the lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15265 (refactor of skill-quality scripts)

I read all 3 changed files. I checked each rewritten hunk against the code it replaces, and none of the refactors changes behavior.

measure-invocation.sh

  • resolve_skill_md: the loop tries the same three paths in the same order and returns the same result.
  • read_query: it assigns id, split, expect and request through bash dynamic scoping. Both callers declare those names local before the call (measure-invocation.sh:405 and :681), so nothing leaks into the global scope.
  • flag_ids: the error text it builds, "$f ($skill): <msg>: <ids>", matches the four blocks it replaces byte for byte, and the jq filters are the same.
  • correct: predicted can only be set to true or false (measure-invocation.sh:411-427). So expect == predicted gives the same result as the old two-branch check, including when expect holds a value that isn't a boolean.
  • stats($s): rate($hits; $n) runs on the stats object, and the keys keep their old order (n, n_positive, n_negative, trigger_hits, false_triggers, trigger_rate, false_trigger_rate, with train before validation). The output JSON is the same.

skill-frontmatter.sh

  • The awk fence change if (++fence == 1) next; exit matches the old fence++; if (fence==1) next; if (fence>=2) exit.
  • The mode local that was removed had no other reader.
  • The two comment edits are fine.

Changelog fragment: bump: patch with ### Changed / "Internal simplification, no behavior change.", as the issue requires.

Finding (advisory, not on a changed line)

  • Unexplained file-mode change on a sourced library. The diff changes plugins/skill-quality/scripts/skill-frontmatter.sh from 100644 to 100755.
    • The file has no shebang. Its header says it is sourced (by check-skill.sh, measure-invocation.sh and the parity test).
    • Neither the PR body nor the fragment mentions the change, and it has nothing to do with the simplification.
    • Issue Simplify the scripts skill-quality plugin code (2 of 2) #14759 asks for "Behavior is unchanged", and making a sourced library executable falls outside that.
    • Fix: restore mode 100644, or say in the PR why the file should now be executable.

Closing issue #14759 criteria

  • Behavior unchanged: met for the code edits, apart from the mode change above. I did not run anything. The PR's own test-coverage claims are author-claimed and unverified: measure-invocation.test.sh, check-skill.test.sh and check-summary-reader-parity.test.sh were not run by the authoring lane either.
  • Diff edits only the listed files plus fragments: met.
  • Within 400 lines / 15 files: met.
  • ci-status green: left to CI, so I could not verify it here.
  • Fragment present with the required body: met.

No settled threads or earlier findings applied. The PR context contained no embedded directives.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for ecd53f5

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-15265-ecd53f543c2e508cd32bdcd3edeef4a706c97120, 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 7fd9512 Nov 11, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14759-42959410037-1 branch November 11, 2026 05:33
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/skill-quality/scripts/measure-invocation.sh 3 2 0 0 0 0
plugins/skill-quality/scripts/skill-frontmatter.sh 1 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/skill-quality/scripts/measure-invocation.sh:280 SBR productive input-gap
plugins/skill-quality/scripts/measure-invocation.sh:433 ROR productive no-assertion
plugins/skill-quality/scripts/skill-frontmatter.sh:127 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 7fd951207d0042b5efc7c294a7fa7c0e8760cac1; 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 scripts skill-quality plugin code (2 of 2)

0 participants