Skip to content

refactor(discovery): simplify the discovery check scripts - #15146

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14444-42880077497-1
Nov 10, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14444

Summary

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

Ran the /simplify checks over the 8 listed discovery scripts and applied the behavior-preserving cleanups that were there. check-coverage-complete.py keeps the accepted header as one list instead of four pieces of bookkeeping. check-dispatch-artifact.sh replaces four copies of a missing-flag-value block with one need_value helper. check-restatement-labels.py drops a filter that could never be false and a nested if, and check-claim-eligibility.py inlines a one-use list. build-view.mjs, check-author-kind.py, check-coverage-complete.sh and check-hook-registration.sh were already tight and are unchanged. No change touches a docstring or a header comment that --help prints. Moving code between files and deduping across them (for example the shared load_parser and main argument loop) is left to the sub-epic's restructuring pass, as the issue says.

Not verified

  • The discovery script test suites (plugins/discovery/scripts/*.test.sh) were not executed directly: this lane runs no interpreter or test runner. Left to the PR's CI.
  • cant-fail-scan was not run: it scans test files, no test file changed, and its wrapper takes no base argument.
  • ci-status green is a PR check, left to the PR's CI.
  • tidy pass 5 (ai-slop:audit fix): the detect.sh detector could not run here (only the named wrappers may run), so only the rubric was read; the fix flow's digest guard and semantic-diff subagent were not needed because nothing was rewritten.
  • Untracked dotfiles at the checkout root (.bashrc, .bash_profile, .profile, .zshrc, .zprofile, .gitconfig, .ripgreprc, .mcp.json, .idea, .vscode) were not created by this run; they look like sandbox mount placeholders and were left alone. They are not part of this change.

Fix

  • plugins/discovery/scripts/check-coverage-complete.py: the header_seen/header_cols/header_name/seen_head bookkeeping becomes one header list, checked with heads.count(req) == 1; done_col comes from heads.index("done"). The same tables are accepted and error messages are byte-identical.
  • plugins/discovery/scripts/check-dispatch-artifact.sh: four identical \[\[ $# -lt 2 \]\] ... exit 2 blocks become a need_value helper. Messages and exit 2 are unchanged; the helper sits outside the comment range usage() prints.
  • plugins/discovery/scripts/check-restatement-labels.py: abstract_violations drops a per-mirror != filter that is always true once the any() check fails, and claims_block merges a nested if into one condition. A stray double blank line is removed.
  • plugins/discovery/scripts/check-claim-eligibility.py: the one-use primaries list is folded into the any() that reads it.
  • .changes/discovery/work-resolve-issue-issue-14444-42880077497-1-798c7905.md: new patch fragment, ### Changed / "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 20360e2:

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

The run reports:

  • check-changelog-fragments: All 4 changelog fragment(s) under .changes/ are valid (run before and after tidy)
  • check-changed-skills: no changed skills under plugins/*/skills/, nothing to gate (run before and after tidy)
  • check-affected: 14 passed, 5 skipped over 5 changed files (run before and after tidy)
  • fresh-context review subagent over the full diff: found no input whose stdout, stderr, exit code or --help output changes, and no test that asserts on the changed source text (contract.test.sh greps only untouched docstring/printf lines)
  • code-tidying:tidy-diff over the changed lines: passes 1-3 found nothing further; pass 4 kept the issue-mandated fragment text; pass 5 rubric read found no AI-writing tell
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42880077497

Left out: the items under Not verified.

Related

#14444

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

Security review: PR #15146, head 20360e2

I found no security issues. I read every hunk of all 5 changed files. None of them falls under a trusted path, a trust control, a merge hold, a plugin manifest or a standing instruction.

What changed. The PR tidies four local discovery check scripts and adds one changelog fragment. Each script edit looks like it keeps the old behaviour:

  • check-claim-eligibility.py: a one-use list of primary sources is folded into the any() check that reads it. The predicate is unchanged.
  • check-coverage-complete.py: the header bookkeeping becomes a single header list. heads.index("done") can't raise, because "done" is in REQUIRED at L27 and that check passes first. Row width checks and the 1-based column lookups (header[i - 1]) match the old code.
  • check-dispatch-artifact.sh: four copies of the missing-value check become one need_value helper. The caller passes in its own $#, so the count is right. The messages, exit 2 and the --index-name ERE character restriction are unchanged, and no new input reaches a shell or regex.
  • check-restatement-labels.py: a != filter is dropped. It was always true once the any() check had failed, so the same violations are reported. A nested if is merged into one condition with the same short-circuit order.
  • .changes/...798c7905.md: a data-only patch fragment.

Embedded text in the PR context. None asks the lane to pass the PR, skip a check or drop a finding.

Spend. Nothing.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15146 (refactor(discovery): simplify the discovery check scripts)

No findings. I read every hunk of all 5 changed files and checked each rewrite against the code at head. Every rewrite does exactly what the code it replaces did:

  • check-coverage-complete.py: The old version tracked header_seen, header_cols, header_name and seen_head separately. These are now one header list. A row is accepted only when each REQUIRED name, "done" included, appears exactly once. That makes heads.index("done") + 1 the same column the old loop found. A rejected row still leaves done_col at 0. header[i - 1] gives the same name as header_name[i] did, and len(header) gives the same count as header_cols. A row is only accepted when it is non-empty, so if not header still means no header was seen. The error messages are byte-identical.
  • check-dispatch-artifact.sh: need_value $# runs the same < 2 check, prints the same message and exits 2. The loop runs in the main shell, not a subshell, so exit inside the helper still ends the script. The helper sits after # Output, the line where the usage() sed range stops, so --help output does not change.
  • check-restatement-labels.py: Merging the nested if into one condition does not change the logic. The != filter that was dropped could never be false: after any(... == value) fails, every mirror differs from the abstract. Removing the double blank line changes nothing.
  • check-claim-eligibility.py: The one-use primaries list is now folded into the any() that reads it. The predicate is the same.
  • Changelog fragment: bump: patch with a ### Changed line reading "Internal simplification, no behavior change.", as issue Simplify the scripts discovery plugin code #14444 asks.

Closing issue #14444, acceptance criteria:

  • Behavior unchanged: met, by my reading of the code. contract.test.sh and check-restatement-labels.test.sh assert on the changed messages, so a regression would fail them. I did not run those tests; the PR says it leaves them to CI (author-claimed, unverified).
  • Diff only touches the listed files and a fragment: met.
  • Within 400 lines and 15 files: met (about 60 lines across 4 scripts).
  • ci-status green: left to CI; not checked here.
  • Discovery fragment with the required body: met.

The PR context file contains no embedded instructions aimed at the review. There are no prior findings, no settled threads and no plugin manifest changes. None of the changed files are on a trusted path.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 20360e2

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-15146-20360e2994cba690ed89ca02c83a6ed334dcc37e, expires on 2026-12-10.

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 10, 2026
Merged via the queue into main with commit 02385e5 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14444-42880077497-1 branch November 10, 2026 19:27
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 02385e5570919515e3891dce476aa3c206871502; 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 discovery plugin code

0 participants