Skip to content

refactor(harness-ops): simplify audit-native-overlap discover.py - #14850

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14512

Summary

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

Simplified plugins/harness-ops/skills/audit-native-overlap/scripts/discover.py without changing its behavior, and every exported name and computed score stays the same. Module constants (SCORED_FIELDS, CAMEL_RE, ROUTE_ONLY_CLASSES) now sit together at the top. The private _norm helper is merged into _vector, which returns (vector, norm). The IDF document-frequency and vector tables are built with comprehensions. score_pair takes the name score with one max over a small name_coverage helper, still floored at 0.0 so the old left fold is matched exactly. invocability reads each per-registration flag through small helpers instead of three accumulator lists. Basis for each choice: the callers (overlap.py, test_overlap.py) use only the public names, never _vector or _norm, so merging the private pair is safe, and every float expression keeps its original operands and evaluation order.

Not verified

  • test_overlap.py (python unittest) was not run here: the lane allows no interpreter; left to the PR's CI
  • ci-status green on the PR: a PR CI check, left to the PR's CI
  • tidy: tidy-diff ran passes 1-4; pass 5 (ai-slop fix) ran its rubric read only, because the lane's Bash cannot run detect.sh or digest-guard.sh. No edits were needed on the mandated one-line fragment
  • ruff check/format were not run directly (no interpreter); line lengths and lint rules were checked by reading against ruff.toml

Fix

  • plugins/harness-ops/skills/audit-native-overlap/scripts/discover.py: grouped module constants at the top; merged _norm into _vector; Counter comprehension in idf_table; dict comprehension for vectors in score_all; name_coverage helper plus max() in score_pair; flag/model_flag/hint helpers in…
  • .changes/harness-ops/work-resolve-issue-issue-14512-42681209417-1-c4a25247.md: new patch fragment from new-changelog-fragment, body '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 48d8a35:

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

The run reports:

  • check-changelog-fragments: all 10 fragments under .changes/ valid
  • check-changed-skills: audit-native-overlap PASS, 0 errors, 4 pre-existing warnings (description length, body size, stale fresh-eyes directive), none from this change
  • check-affected: 13 passed, 6 skipped over 2 changed files
  • fresh-context review subagent over the full diff: no reachable behavior change in score_all, discover, select, invocability or the callers; no ruff issues (ruff.toml default line length 88, longest new line 85). Its one theoretical note (the old fold floored name_score at 0.0 even for a hand-built…
  • grep of callers: overlap.py and test_overlap.py reference only Surface, Component, tokenize, split_words, scored_text, score_all, select, discover, invocability, recommended_integration, Scored and the DEFAULT_* constants, all unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42681209417

Left out: the items under Not verified.

Related

#14512

Merge-Risk: unrated reason=no-run

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14850

I read every hunk of both changed files:

  • plugins/harness-ops/skills/audit-native-overlap/scripts/discover.py is a behavior-preserving refactor of a local scoring script. The changes:

    • Module constants (SCORED_FIELDS, CAMEL_RE, ROUTE_ONLY_CLASSES) move to the top of the file.
    • _norm is merged into _vector.
    • idf_table and score_all now build their tables with comprehensions.
    • score_pair uses a name_coverage helper with max(), still floored at 0.0.
    • invocability reads each flag through small helper functions.

    The diff adds no I/O, subprocess, path handling, network access, credentials or trust decisions. The values ROUTE_ONLY_CLASSES holds are unchanged.

  • .changes/harness-ops/...c4a25247.md is a new changelog fragment containing only prose.

Neither file matches a trusted path. The diff changes no trust control, merge hold, plugin manifest, workflow or standing instruction, so the instruction-surface and manifest lenses do not apply.

No security issues found.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14850, a behavior-preserving simplification of discover.py

No findings. I read every hunk of both changed files: discover.py and the new changelog fragment.

Behavior equivalence (checked by reading the code; nothing was run)

  • idf_table: Counter(t for bag in bags for t in bag) walks each bag's keys, the same keys df.update(bag.keys()) counted. The document frequencies are identical.
  • _vector / _norm merge: the vector comprehension and the norm expression (with its or 1.0 fallback) are unchanged. The norm is now returned in the tuple. A search of plugins/harness-ops found no caller of _vector or _norm outside this file. score_all builds the same id(item) -> (vec, norm) map that score_pair unpacks.
  • score_pair: name_coverage computes the same hit / total value per name set. reachable hoists a set union that was the same on every loop pass. max([0.0, *map(...)]) matches the old fold, which started at 0.0, including when there are no name sets.
  • invocability: model_flag keeps the same order: model_invocable first, then not disable_model_invocation, else None. The helpers for user_invocable and argument_hint apply the same type and empty-string checks as before. Each agreed(...) call gets lists of the same values in the same order.
  • Moving the constants up: SCORED_FIELDS, CAMEL_RE and ROUTE_ONLY_CLASSES are only read inside function bodies at runtime. Defining them earlier changes nothing about when they are evaluated. No exported name changed.

Closing issue #14512 acceptance criteria

  • Behavior unchanged, exported names kept: met, per the reading above. Existing tests in test_overlap.py already exercise score_all, discover, invocability and recommended_integration, so a regression there could fail a test. I did not run them; the author also says they were not run.
  • The diff edits only the listed file plus a changelog fragment: met.
  • Within 400 changed lines and 15 files: met.
  • ci-status green: not something this lane can see; it is left to CI.
  • Fragment for harness-ops: met. It has bump: patch, the ### Changed heading, and the required line.

Notes

  • The path-scoped rule .claude/rules/ruff-pin.md matches *.py. It covers how linting is run, not what the code says, so it has nothing to check here. The author says ruff was not run directly (unverified). The longest new line, at discover.py:217, appears to fit within 88 characters.
  • No plugin manifest changed, so there are no manifest lines.
  • The PR context contains no embedded instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 48d8a35a7b2e40b00878ccaee92f994e237cc687. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@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 dc30397 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14512-42681209417-1 branch November 10, 2026 03:06
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit dc3039793dc6038e420d128e004412be8acf6c44; 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 discover.py harness-ops plugin code

0 participants