Skip to content

refactor(harness-ops): simplify the first half of install_state.py - #15674

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14509-43295609274-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14509

Summary

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

Simplified the functions that start in lines 1-1048 of install_state.py (range 1 of 2 of the 2097-line file at the start of this part) without changing behavior. read_retention's duplicated cleanupPeriodDays parse for user and managed settings is now one nested apply_setting helper; deny_roots dedupes with dict.fromkeys (same first-seen order); under_deny uses any(); count_by_entry uses collections.Counter; walk_tree picks SECRET before calling classify_entry instead of overwriting the result; and three history-narrating comments in read_retention and rollup now state only the rule they guard. No public name, flag, output, exit code or printed text changed, and every edited function starts in range 1 (the last is rollup, at original line 978).

Not verified

  • Python test suite (test_install_state.py, install_state.test.sh) not executed here: the lane runs 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 pass 5 (ai-slop:audit fix) skipped: its detector scripts cannot run under this lane's Bash restriction; a manual read of the fragment's single mandated line found no tells. Tidy passes 1-4 ran with no further edits
  • Build/lint of the touched Python file not run locally (no interpreter or linter available in this lane); left to the PR's CI

Fix

  • plugins/harness-ops/skills/audit-install-state/scripts/install_state.py: deduplicated read_retention's user/managed setting parse into a nested apply_setting helper; simplified deny_roots, under_deny, count_by_entry and walk_tree's surface pick; shortened the comments in read_retention and rollup…
  • .changes/harness-ops/work-resolve-issue-issue-14509-43295609274-1-a0f5289b.md: new patch fragment from new-changelog-fragment, body ### Changed with the line "Internal simplification, no behavior change."

Verification

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

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

The run reports:

  • check-changelog-fragments: all 8 fragments valid (run before and after tidy and review fixes)
  • check-changed-skills: audit-install-state PASS, 0 errors, 1 pre-existing warning (SKILL.md body length, untouched by this change)
  • check-affected: 13 passed, 6 skipped (tools absent or code-from-tree checks), rest CI-only; run before and after the final edits
  • fresh-context review subagent over the full diff: no behavior difference found (checked ordering, short-circuiting, bool/int handling, exceptions inside try blocks, test_install_state.py assertions on deny_roots/under_deny/retention); it found two comment inaccuracies, both fixed
  • diff measured with git-read diff --numstat: 2 files, about 100 changed lines, 1 area (harness-ops), inside the issue's 400-line / 15-file cap
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43295609274

Left out: the items under Not verified.

Related

#14509

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15674

I found no security issues.

I read every hunk of both changed files. Neither matches a trusted-path glob. The PR touches no workflow, action, manifest, trust control or merge hold.

plugins/harness-ops/skills/audit-install-state/scripts/install_state.py. I checked each refactor for any change in behavior on the secret-handling paths:

  • walk_tree surface pick (L936): the new SECRET if is_never_read(rel) else classify_entry(rel)[0] gives the same result as the old code, which computed the surface and then promoted it to SECRET when the path was never-read. classify_entry (L621) only looks up SURFACE_TABLE and has no side effects, so calling it only on the else branch changes nothing. Never-read rows are still classified SECRET.
  • under_deny / deny_roots: any(...) keeps the same predicate and short-circuits the same way. dict.fromkeys over string keys keeps the same first-seen dedupe order. The deny-root protection is unchanged.
  • read_retention's apply_setting helper: it does the same validation and assignment for user and managed settings. An invalid value still doesn't drive effective_days. Settings are still read through read_text_guarded, and the managed-settings exception handling is unchanged.
  • count_by_entry via Counter: equivalent.
  • Comment rewording in rollup: comments only. SECRET-member promotion of the entry line is unchanged.

.changes/...md: a changelog fragment. Nothing in it is security-relevant.

The PR context file contains no embedded directives aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings. This is a complete review: I read every hunk of both changed files.

I checked each simplification in plugins/harness-ops/skills/audit-install-state/scripts/install_state.py against the code it replaces:

  • deny_roots: list(dict.fromkeys(...)) keeps the same first-seen order and the same case-sensitive dedupe as the old loop.
  • under_deny: any(...) uses the same predicate and short-circuits the same way.
  • read_retention / apply_setting: the nested helper is defined after result is set up, so its closure is safe. It writes the same keys in the same cases: on an invalid value, result[field] = "invalid: <repr>"; on a valid one, it sets field, effective_days and effective_evidence (MEASURED). Both calls stay inside their original try blocks, so the exception handling is unchanged. The helper's local raw does not clash with the outer raw used later for .last-cleanup. The reworded comment ("the previously effective value stands") is more accurate for the managed-settings path, where the value that stands may be the user setting.
  • count_by_entry: dict(Counter(...)) gives the same counts in the same insertion order.
  • walk_tree: SECRET if is_never_read(rel) else classify_entry(rel)[0] matches the old overwrite. classify_entry, is_never_read and top_level_name are pure functions (install_state.py:143, :617, :621), so skipping the classify_entry call for never-read paths changes nothing.
  • rollup: only the comments changed.

Closing issue #14509, acceptance criteria:

  • Behavior unchanged: by reading the code I found no difference in output, exit code or printed text. I did not run the tests. The author also states that test_install_state.py / install_state.test.sh were not run and left to CI, so that is unverified.
  • Only listed files plus a fragment: met.
  • Size cap: met, at about 100 changed lines in 2 files.
  • Changelog fragment: met. .changes/harness-ops/...a0f5289b.md has bump: patch, ### Changed and the required line.
  • Only functions that start in range 1 changed: met. The last edited function, rollup, starts around line 978, inside lines 1–1048.
  • ci-status green: I could not check this from this lane; it is left to CI.

No plugin manifest changed, and I found no embedded instructions in the PR context. Spend: none beyond this review run.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fe15946

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-15674-fe15946a474b0d689324089b41ef562db650b078, expires on 2026-12-12.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=LOW demote=false head=fe15946a474b0d689324089b41ef562db650b078 rubric=8.4.12 rater=claude-opus-5-5 checker=claude-opus-5-5

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 8e4e7dd Nov 12, 2026
50 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14509-43295609274-1 branch November 12, 2026 20:29
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 8e4e7dd4cf0c5b7d6ad8cc02ce6bee2099193d98; 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 install_state.py harness-ops plugin code (part 1 of 2)

0 participants