Skip to content

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

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14558

Summary

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

Simplified functions that start in lines 1-1732 of plugins/harness-ops/skills/inventory/scripts/inventory.py (range 1 of 4 equal ranges of its 6928 lines), with no behavior change. A new private helper _close_paren_before replaces the same whitespace-walk-back-to-')' prelude that _opens_function, _catch_params, _for_params and _params_before each repeated. _brace_pairs now shares one branch for opening and resuming a template literal. _select_longest_run uses a frozenset of printable bytes in place of a hand-filled 256-entry table. _array_join's per-call re.compile is hoisted to the module constant _JOIN_CALL_RE, and _for_head_names drops a redundant alias. Means chosen on evidence from the code: only exact-equivalence edits inside range 1, since the lane cannot run Python here; _graph_sources stays because test_parser_reader.py calls it.

Not verified

  • Python unit tests for inventory.py (test_inventory.py, test_parser_reader.py) were not executed: this lane's Bash runs only the named wrappers, so they are left to the PR's CI
  • ci-status green on the PR: a CI check, left to the PR's CI
  • tidy pass 5: the ai-slop deterministic detector (detect.sh) could not run because the lane allows only named wrappers in Bash; the fragment got a manual rubric read instead, so tidy is recorded as skipped
  • Untracked dotfiles (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are in the checkout root but were not created by this run and are not part of the change

Fix

  • plugins/harness-ops/skills/inventory/scripts/inventory.py: add _close_paren_before and use it in _opens_function, _catch_params, _for_params and _params_before; merge the duplicated template branches in _brace_pairs; replace the printable bytearray table in _select_longest_run with a frozenset;…
  • .changes/harness-ops/work-resolve-issue-issue-14558-42696048889-1-04d48c42.md: 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 c0347e2:

  • 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 pre-existing size warnings on SKILL.md, which this change does not touch
  • check-affected: 13 passed, 6 skipped, rest CI-only, over 2 changed files
  • fresh-context review subagent over the whole diff: each of the five edits is exactly equivalent (edge cases checked: empty templates list, ')' at index 0, brace at 0, bytes >= 0x80); no test references a removed or renamed name
  • Grep for _graph_sources, _unescape and _STR across plugins/harness-ops: _graph_sources is used by test_parser_reader.py, so it was kept
  • tidy-diff over the 14 changed hunks: passes 1-4 found nothing to change; pass 5 was a manual rubric read of the fragment, with no tells
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42696048889

Left out: the items under Not verified.

Related

#14558

Merge-Risk: max=MEDIUM demote=false head=c0347e21b4a82686ea4e924976357e7ca3685fd8 rubric=8.2.0 rater=claude-opus-5-5 checker=claude-opus-5-5

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 c0347e21b4a82686ea4e924976357e7ca3685fd8: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: no security issues found

I read every hunk of both changed files:

  • .changes/harness-ops/work-resolve-issue-issue-14558-42696048889-1-04d48c42.md is a new patch-bump changelog fragment containing only prose.
  • plugins/harness-ops/skills/inventory/scripts/inventory.py is a local refactor of the inventory script's source-text parser:
    • a new _close_paren_before helper replaces the same whitespace-skip-then-) check that four functions each repeated;
    • the ` and template-resume branches in _brace_pairs are merged into one;
    • the printable-byte lookup table in _select_longest_run becomes a frozenset;
    • the .join( regex is compiled once as the module constant _JOIN_CALL_RE instead of on every call;
    • a redundant alias is dropped in _for_head_names.

Why there is nothing to report:

  • No new attack surface. None of the changes adds a shell call, subprocess, file path built from input, network access, secret handling or a deserialization sink.
  • The new regex is safe. _JOIN_CALL_RE is a fixed pattern with no nested quantifiers, so it cannot cause catastrophic backtracking (ReDoS).
  • No bounds-check regression. _close_paren_before keeps the j >= 0 guard, and the set membership test covers every byte value the old 256-entry table did.
  • No trust controls touched. Neither file matches a trusted-path glob or touches the trusted-trigger check, the lane token, the kill switch, the token broker or the merge holds.
  • No instruction surface touched. No CLAUDE.md, AGENTS.md, rules file, skill or agent body, or hook list is changed, so the instruction-surface lens does not apply.
  • No plugin manifest changed.
  • PR text is clean. The PR context holds no embedded instructions aimed at the review lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

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

No findings. I read every hunk of both changed files and checked each of the five edits against the base code for exact equivalence.

  • _select_longest_run: the frozenset holds the same byte values as the old 256-entry table: \t\n\r and 0x20–0x7E. Indexing bytes gives ints, so data[i] in printable gives the same answers as printable[data[i]]. Bytes ≥ 0x80 test as non-printable in both versions.
  • _brace_pairs: the merged branch keeps the order of the two old branches. A backtick is still checked before the resume check. On a resume, templates.pop() runs before _scan_template_text, which is the old order. The prev_sig/prev_word updates are unchanged. When templates is empty, resumes_template is [], which is falsy, so the old short-circuit behaviour holds.
  • _close_paren_before: it returns j only when j >= 0 and src[j] == ")". A ) at index 0 returns 0, not None. All four callers (_opens_function, _catch_params, _for_params, _params_before) test it with is None, so they behave as before.
  • _for_head_names: dropping the j = close alias changes nothing.
  • _array_join: moving the regex to the module constant _JOIN_CALL_RE doesn't change the pattern or how it's matched.

Closing issue #14558, acceptance criteria:

  • Behavior unchanged: met, by my reading. Only private helpers changed. No exported name, flag or output changed. I didn't run anything; the PR's test results are its author's claim and I haven't checked them.
  • Edits only the listed file and changelog fragments: met.
  • Stays within 400 changed lines and 15 files: met (about 50 lines, 1 hand-edited file).
  • ci-status is green: left to CI, not checked here.
  • Changelog fragment: met. .changes/harness-ops/… has bump: patch, ### Changed, and the exact required line.
  • Only functions starting in range 1 of 4 (base lines 1–1732) are changed: met. Every edited function, and the new helper and constant, sits at or below about line 1660.

No embedded instructions found in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c0347e2

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-14858-c0347e21b4a82686ea4e924976357e7ca3685fd8, expires on 2026-12-09.

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 f8017a9 Nov 10, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14558-42696048889-1 branch November 10, 2026 01:00
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 1 of 4)

0 participants