Skip to content

refactor(harness-ops): simplify the inventory parser reader and known-issues scripts - #14901

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14567

Summary

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

Simplified the three listed harness-ops scripts without changing their behavior. parser_reader.py: the flow and namespace answers share one unsafe-answer builder (_unsafe), and install_command names the target and npm verb once. registry_manager.py: the result builders go through one _result, the list-type checks are a loop, and resolve_data_dir uses early returns. check-all.sh: each row now makes one jq call instead of three jq | tr pipelines. The fields are joined with the \x1f unit separator, not tab, because read would collapse an empty stateReason between tabs. No function, flag or module-level name was removed or renamed.

Not verified

  • Python unit tests (test_parser_reader.py, test_registry_manager.py, test_inventory_under_parser.py and others) and check-all.test.sh were not executed: this lane's Bash runs only the named wrappers. Left to the PR's CI.
  • ruff/mypy were not run here. The reviewer read ruff.toml (E4/E7/E9/F selected) and checked the line lengths and the annotation by hand. Left to the PR's CI.
  • check-all.sh corner case: when gh exits 0 but prints non-JSON text, jq's parse error now prints to stderr once instead of three times. The results TSV and log are unchanged. gh --json prints JSON on success, and its failures already take the FETCH_FAILED path.
  • tidy: passes 1-4 ran with no edits needed. Pass 5 (ai-slop:audit fix on the changelog fragment) ran only its rubric read (no findings), because detect.sh, digest-guard.sh and the verification-level reader cannot run in this lane's Bash.
  • ci-status green is a PR-time check, left to the PR's CI.
  • Untracked sandbox dotfiles (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) appear in git status; this run did not create or edit them and they are not part of the change.

Fix

  • plugins/harness-ops/skills/inventory/scripts/parser_reader.py: install_command computes the quoted target and the npm verb/flags once and drops the q aliases. A new private module-level _unsafe(res, lo) builds the unsafe answer that ParserReader.flow and ParserReader.namespace each duplicated, with…
  • plugins/harness-ops/skills/known-issues/scripts/registry_manager.py: _ok/_not_found/_error delegate to a new _result. validate_issue checks affected_files and related in one loop, keeping the error order. resolve_data_dir returns early. load_registry, action_stats and _parse_csv_ints have smaller…
  • plugins/harness-ops/skills/known-issues/scripts/check-all.sh: the per-row state/stateReason/closedAt extraction is one jq call that reads into three variables via IFS=$'\x1f' read, replacing three jq and three tr processes per row.
  • .changes/harness-ops/work-resolve-issue-issue-14567-42716193399-1-218c3117.md: patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

Left out: the items under Not verified.

Related

#14567

Merge-Risk: unrated reason=no-rating

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

Security review: PR #14901

I found no security issues.

I read every hunk in all 4 changed files. None of them matches a trusted-path glob, and the change touches no trust control, plugin manifest or instruction surface.

  • parser_reader.py, install_command: The target path and the manifest sources still go through _q / _ps_q, the same quoting as before. Only the npm verb and flags come from the constant NPM_CI_ARGS, and they are interpolated unquoted, as they were at base. The shell and PowerShell commands are the same as before, with no new place for input to inject.
  • parser_reader.py, _unsafe: The flow and namespace answers now share one builder for the unsafe case, and they still fail closed. An unreadable response, or any response that isn't safe, still gives safe: False. Because res.get("unreadable") is checked first, a missing safe key is never read on that path. The at + lo offset is the same as before.
  • check-all.sh: The three jq calls became one read that splits on the \x1f separator. That character isn't whitespace in IFS, so an empty field keeps its place and the columns don't shift. The values feed only the tracked/state comparisons and the TSV output, never a command or eval.
  • registry_manager.py: In resolve_data_dir, the CLAUDE_PLUGIN_DATA check is unchanged: the directory must be named harness-ops or start with harness-ops-. The placeholder rejection on --data-dir is also kept. The other changes (_result, the list-type check loop, sum of booleans, result or None) are only restructuring.
  • Changelog fragment: Text only.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read the whole diff for all 4 changed files. None of them matches a trusted-path glob. This was a full review: no earlier head had been reviewed and there were no prior findings. I did not run any tests. The PR author's verification and the run's checks are their own claims, and I have not confirmed them.

Behavior-equivalence check (the closing issue's main acceptance criterion)

  • parser_reader.py install_command: verb, *rest = NPM_CI_ARGS gives the same values as the old NPM_CI_ARGS[0] and [1:]. NPM_CI_ARGS is a non-empty 4-tuple. The quoted target is computed once and used in the same places on both platforms. The POSIX branch now uses flags where it repeated ' '.join(NPM_CI_ARGS[1:]), which is the same value.
  • parser_reader.py _unsafe:
    • The unreadable case still sets at to None, as before.
    • The unsafe case still adds lo to at when at is present.
    • The key order (safe, reason, at) is unchanged.
    • The guard res.get("unreadable") or not res["safe"] short-circuits, so res["safe"] is never read for an unreadable answer, as before.
  • registry_manager.py:
    • _ok, _not_found and _error keep their key order and the _error mapping from None to {}.
    • The validate_issue loop keeps the error order (affected_files, then related).
    • sum(_is_stale(...)) counts the same as before because _is_stale returns bool on every path (registry_manager.py:159-179).
    • result or None and the early returns in resolve_data_dir are equivalent to the old code.
  • check-all.sh:
    • \x1f is not IFS whitespace, so read does not merge adjacent separators. An empty stateReason or closedAt stays in its own column.
    • The inner read takes input from its own process substitution, so it does not consume the outer while read … done <"$SNAPSHOT" input.
    • If jq fails on non-JSON output, read sets all three variables to empty, as before. The script runs under set -uo pipefail without -e, so it continues.

Closing issue #14567, acceptance criteria

  • Behavior unchanged: met, per the review above. Existing tests cover these scripts (the PR names test_parser_reader.py, test_registry_manager.py and check-all.test.sh). I did not run them.
  • Only listed files and fragments edited: met.
  • Size (≤ 400 lines, ≤ 15 files): met.
  • ci-status green: CI checks this. I cannot see it from this lane.
  • harness-ops fragment: met. bump: patch, a ### Changed heading and the exact required line.

There are no plugin manifest changes and no .claude/rules matches. I found no embedded directives in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head e3792e8d2c2e71bb2b64cbd3faaa0f155f111e51. 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 e3792e8d2c2e71bb2b64cbd3faaa0f155f111e51, 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 c91e5b7 Nov 10, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14567-42716193399-1 branch November 10, 2026 03:11
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 1, survived 3, timeout 0, no coverage 0, invalid 0, not run 3.
Covered-code score 25%; mutation score 25%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-ops/skills/inventory/scripts/parser_reader.py 0 0 0 0 0 3
plugins/harness-ops/skills/known-issues/scripts/check-all.sh 0 1 0 0 0 0
plugins/harness-ops/skills/known-issues/scripts/registry_manager.py 1 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/harness-ops/skills/known-issues/scripts/check-all.sh:149 other productive no-assertion
plugins/harness-ops/skills/known-issues/scripts/registry_manager.py:231 LCR productive input-gap
plugins/harness-ops/skills/known-issues/scripts/registry_manager.py:479 other productive no-assertion

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit c91e5b76608d3ef4e0b19ec92188e5a687447cfe; 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 and known-issues harness-ops plugin code

0 participants