Skip to content

refactor(harness-ops): simplify part 4 of inventory.py - #15188

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14564

Summary

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

Simplified functions that start in range 4 of 4 of plugins/harness-ops/skills/inventory/scripts/inventory.py (file is 6847 lines, so lines 5137-6847). The edits change no behavior. extract_builtin_plugins now runs one regex match where it ran two for the factory check, and its policy-flag default is a plain branch instead of a nested ternary. detect_cli_version uses re.findall and max(default=None). check_integrity reuses _lane_status for the top-level status: problems is only filled when every lane is broken, so the result is the same. scan_config_scope drops a tuple that paired each name with itself, and extract_binary removes skill names from commands through a key-set intersection. Choice of means: I kept each edit local to one function and moved or deduplicated nothing across functions, since the issue puts that out of scope.

Not verified

  • The harness-ops Python test suite (inventory tests) was not run: this lane cannot run an interpreter. It is left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • Tidy pass 5 (ai-slop) ran only the judgment rubric on the changelog fragment. The deterministic detector detect.sh did not run because this lane's Bash allows only the named wrappers. Tidy passes 1-4 ran and found nothing to change.
  • Separate build/lint of inventory.py (ruff, py_compile) was not run: no interpreter or linter is available in this lane. It is left to the PR's CI.

Fix

  • plugins/harness-ops/skills/inventory/scripts/inventory.py: simplified extract_builtin_plugins (factory-name check, policy-flag default), detect_cli_version, check_integrity's final status, scan_config_scope's agents/commands loop and extract_binary's command/skill dedup; behavior unchanged
  • .changes/harness-ops/work-resolve-issue-issue-14564-42896406075-1-069645b4.md: patch fragment created with scripts/new-changelog-fragment.sh, body '### Changed' and 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 1fc9681:

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

The run reports:

  • check-changelog-fragments: all 9 fragments valid (run before and after tidy)
  • check-changed-skills: inventory PASS, 0 errors, 2 warnings about SKILL.md size that this diff did not cause
  • check-affected: 13 passed, 6 skipped (checks that run code from the checked tree, and typos, which is not installed)
  • fresh-context review subagent: all six hunks EQUIVALENT (checked regex lookahead, tie-breaking in max, that present is never empty, dict types and key order); no other findings
  • range check: functions edited start at lines 5229, 5489, 5509, 5942 and 6504, all inside range 4 (5137-6847) of the 6847-line file
  • diff size: 2 files, about 30 changed lines, 1 area (harness-ops)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42896406075

Left out: the items under Not verified.

Related

#14564

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

Security review: PR #15188 (head 1fc9681)

I found no security issues in this pull request.

I read every hunk of both changed files:

  • plugins/harness-ops/skills/inventory/scripts/inventory.py: the PR rewrites code inside five functions: extract_builtin_plugins, detect_cli_version, check_integrity, scan_config_scope and extract_binary. The rewrites are:

    • one regex match now does the work of two;
    • an if/else branch replaces a nested ternary;
    • re.findall with max(default=None) replaces a manual counting loop;
    • the existing _lane_status helper now sets the top-level status;
    • a loop drops a tuple that paired each name with itself;
    • a key-set intersection removes skill names from the command list.

    None of this touches a trust boundary. No input is passed to a shell, path or template in a new way, nothing new reads or writes a file, and no token, credential or network call is involved. scan_config_scope still builds the same fixed paths (root / "agents", root / "commands").

  • .changes/harness-ops/...md: a changelog fragment (patch bump, one prose line) that runs nothing.

The skip gate's "no security-relevant surface" condition applies:

  • No changed file matches a TRUSTED PATHS: glob.
  • No trust control, merge hold, plugin manifest or standing instruction is touched.
  • The PR context file contains no embedded instructions aimed at this lane.

Prior findings: none; this is the lane's first review of the PR, so it is not blocking only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings. I read every hunk in both changed files: plugins/harness-ops/skills/inventory/scripts/inventory.py and the harness-ops changelog fragment.

I checked each of the six simplifications against the code it calls:

  • extract_builtin_plugins factory check: the change uses one regex match where there were two. _IDENT is [A-Za-z_$][A-Za-z0-9_$]* (inventory.py#L3103). If the regex backtracks to a shorter identifier, the next character is another identifier character, so the (?=\s*[,}]) lookahead fails. A successful lookahead match is therefore always the full greedy identifier. ident.group(0) equals the old re.match(_IDENT, text).group(0). Equivalent.
  • extract_builtin_plugins policy-flag default: the old nested ternary picks None when key in fields or not complete, else False. The new branch leaves flag as None in the first case and sets it to False in the second. flag is reassigned on each loop pass and is not read after rec[out_key]. Equivalent.
  • detect_cli_version: max(counts, key=counts.__getitem__, default=None) breaks ties by insertion order, just like the old max(counts.items(), ...). A matched version string is never empty, so the truthiness test on best only catches the empty-dict case. Equivalent.
  • check_integrity: _lane_status(problems, advisories) (L5499-L5500) is broken if problems. problems is extended only when all_broken (L5744-L5745). A broken lane always has at least one problem, since _lane_status marks a lane broken only when its problems list is non-empty. So bool(problems) == all_broken whenever present is non-empty, which the PR body says it always is (author-claimed). Equivalent.
  • scan_config_scope: it drops a tuple that paired each name with itself. Equivalent.
  • extract_binary: extract_builtin_commands and extract_bundled_skills both return dicts (L2984, L3469-L3471), so .keys() & .keys() is valid. It builds a new set first, so deleting from commands during the loop is safe. Equivalent.

Closing issue #14564, acceptance criteria:

  • Only the listed file and a changelog fragment are edited.
  • The diff is about 30 lines.
  • The fragment is bump: patch with ### Changed / "Internal simplification, no behavior change."
  • The edited functions start inside range 4.
  • Behavior is unchanged, by my reading above.
  • ci-status green and the inventory test suite are for CI to show; the author says they did not run them. I ran nothing either: this lane has no interpreter.

No plugin manifest changed. No prompt-injection text was found in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 1fc9681

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-15188-1fc9681bf9a25d6701893bec5165b63ba6efab4c, 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 ea2fe89 Nov 10, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14564-42896406075-1 branch November 10, 2026 23:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit ea2fe894ae2aa32e7f0ca08f7090ccdc468a9b42; 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 inventory.py harness-ops plugin code (part 4 of 4)

0 participants