Skip to content

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

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14562

Summary

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

Simplified the functions of plugins/harness-ops/skills/inventory/scripts/inventory.py that start in range 3 of 4 (lines 3450-5174 of the 6898-line file as it stood when this part started), with no behavior change. Three scanners (_split_top, _statement_end, _expr_end) now share one new _skip_nested helper for skipping strings, brace blocks and bracket groups. Five sites that wrapped _binding_value in the same try/except with SHORT_IDENT_LOCALITY_BYTES now call one new _local_binding helper; _string_of keeps its own try/except because its exception path differs from its not-found path. Smaller cleanups: extract_bundled_workflows computes the call offset once and reads fields through a local helper instead of repeating its unresolved and anchor expressions; _loader_guards.walk merges two branches that did the same descend-then-poison step; extract_builtin_tools no longer sets flag_driven only to delete it; the _same_registration key tuple is now built once at module level. Each choice follows from code duplicated within the range; nothing moved between files.

Not verified

  • test_inventory.py and test_inventory_under_parser.py were not run: this lane cannot run Python or a test runner. Left to the PR's CI.
  • ruff and a Python syntax or compile check were not run, because this lane has no interpreter. The review subagent checked the diff by reading it. Left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • The verify step (build and tests) was skipped because this lane cannot execute Python.
  • Tidy pass 5 (ai-slop:audit fix) ran without its detector: this lane cannot run detect.sh or digest-guard.sh. A manual rubric read of the 7-line fragment found no AI tells.
  • The tidy measurement left out the untracked .bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile and .zshrc at the checkout root. They look like runner sandbox placeholders, not part of this change. Without them the change is 2 files, about 244 lines and 1…

Fix

  • plugins/harness-ops/skills/inventory/scripts/inventory.py: added the _skip_nested and _local_binding helpers, used them in _split_top, _statement_end, _expr_end, _object_value, _merged_string, _bool_of, _gate_flags and _array_elements; simplified extract_bundled_workflows, _loader_guards.walk, the…
  • .changes/harness-ops/work-resolve-issue-issue-14562-42883534378-1-d3737130.md: new patch fragment, created with new-changelog-fragment harness-ops patch, body '### Changed' and 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 3 fragments valid (before and after tidy)
  • check-changed-skills: inventory PASS, 0 errors, 2 warnings about the size of the existing SKILL.md, which this change did not touch (before and after tidy)
  • check-affected: 13 passed, 6 skipped, 0 failed over 2 changed files (before and after tidy)
  • git-read diff --numstat HEAD: 93 lines added, 144 removed in inventory.py, the only tracked file changed; every edited function starts between lines 3450 and 5174 of the original file
  • review: a fresh-context subagent read the full diff against HEAD and found no behavior change in any hunk (return values, exceptions, dict key order, public names), no line over 88 characters, and no ruff F/E4/E7/E9 violation
  • tidy (code-tidying:tidy-diff over 26 hunk rows): no edits and no proposals. Pass 1 found nothing more to simplify, pass 2 found no class-A comment, pass 3 found no residue, and pass 4 (write-for-humans) left the fragment's required wording as written
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42883534378

Left out: the items under Not verified.

Related

#14562

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

Security review: PR #15159 (head d246190)

I found no security issues. I read every hunk of both changed files.

What the change does: It refactors plugins/harness-ops/skills/inventory/scripts/inventory.py, a static scanner that reads a JavaScript bundle and lists what it registers. It also adds a patch changelog fragment. The refactor:

  • adds two helpers, _skip_nested and _local_binding, which replace code that was copied in several places;
  • moves _same_registration's key tuple to the module level as _REGISTRATION_IDENTITY;
  • tidies extract_bundled_workflows, _loader_guards.walk and the flag_driven assignment in extract_builtin_tools.

What I checked:

  • No trusted paths: neither changed file matches a TRUSTED PATHS: glob.
  • No trust controls: the change touches no trusted-actor check, token request or broker, kill switch, merge hold, Actions workflow or plugin manifest.
  • No instruction surface: no CLAUDE.md, skill body, agent body or hook is changed.
  • No new risky calls: the script gains no subprocess, network, file-write, eval or deserialization calls. Bundle text is still matched with regexes and brace tables, as before.
  • Same error handling: _local_binding catches the same (ValueError, IndexError, RecursionError) as the five copies it replaces, and returns None as they did. In extract_bundled_workflows, a _split_args failure or an out-of-range meta_i now sets meta = -1. Because name is then None, the call still lands on the same unresolved.append(...) and continue as before, so nothing new gets recorded unchecked.
  • Same walk behaviour: in _loader_guards, the merged branch still descends into the body with the guard added and then marks the walk poisoned when the body exits. That is the same order and result as before.
  • Changelog fragment: plain text with no executable content.

Embedded text: the PR context contains no instructions aimed at the review lane.

Prior findings: this lane has posted none on this PR, and this is not a blocking-only review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15159, refactor(harness-ops): simplify inventory.py part 3 of 4

No findings. I read every hunk of both changed files, inventory.py and the new changelog fragment. Where a hunk calls unchanged code, I read that code at head too. I found no change in behavior.

How each hunk was checked (by reading the code; I did not run any tests or tools):

  • _REGISTRATION_IDENTITY moved to module level. It only depends on _INVOCATION_FIELDS, which is defined earlier in the file at inventory.py#L3419. The key tuple is the same.
  • extract_bundled_workflows:
    • A _split_args failure or a missing or out-of-range meta_i now sets meta = -1. That path ends at the same unresolved.append(f"{callee}(...) at {at}") and continue as before, with the same message.
    • The field closure runs only inside its own loop iteration, so the late-bound meta and at are safe.
  • extract_builtin_tools: flag_driven is now set only when it is non-empty. It is inserted at the same point as before, so dict key order is unchanged.
  • _skip_nested:
    • _read_literal(...)[1] and _match_close are both typed to return int, never None. So the helper's None means only "no nested construct here", as before.
    • The , (_split_top), ; (_statement_end) and ,;)]} (_expr_end) terminators are still checked only after skipping.
  • _loader_guards.walk: the merged else still descends (walk if braced, record otherwise) and then sets poisoned when exits, in the same order. nxt = end + 1 is the same for both body forms.
  • _local_binding:
    • Its default deferred=False matches _binding_value's own default at inventory.py#L2175. That keeps _merged_string the same; its old call passed no deferred.
    • At every converted call site, the old exception path and the not-found path end the same way. Two sites return None (_object_value, _array_elements). The other three continue with v = None (_bool_of, _merged_string, _gate_flags), and their following code already handles None.

Closing issue #14562 acceptance criteria:

  • Behavior unchanged: holds by reading (see above). The existing test_inventory*.py suites run in CI. The author says they did not run them; I did not run them either.
  • Only the listed file plus a changelog fragment edited: met.
  • Within 400 changed lines: met (+93/−144 in inventory.py, plus the 7-line fragment).
  • ci-status green: a CI check, not judged here.
  • Fragment: met. bump: patch with a ### Changed body and "Internal simplification, no behavior change."
  • Only functions starting in range 3 of 4 changed: met. Every edited function sits between _same_registration and _array_elements. _binding_value (line 2169) is called but not edited.

Path-scoped rules: ruff-pin.md matches *.py, but it governs how lint is run, not the code. skill-bodies-state-current-rules.md and cost-claims.md match the path but cover skill prose and cost claims, which this change does not touch. Nothing to report under any of them.

Other checks:

  • Paved paths: none apply to this change.
  • Plugin manifests: neither is changed.
  • Prior findings: none (first review, not blocking-only).
  • PR text: the PR body and issue text contain no instructions aimed at this review lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for d246190

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-15159-d24619093d2d6f6ac766cd5c706ae99b9c535868, 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 242e966 Nov 10, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14562-42883534378-1 branch November 10, 2026 20:29
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 242e9664fe410fe6037879d5bb7555160bb129a7; 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 3 of 4)

0 participants