Skip to content

refactor(disk-hygiene): simplify deep_inventory.py row building - #15145

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14448

Summary

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

Simplified plugins/disk-hygiene/skills/clean/scripts/deep_inventory.py with no behavior change (75 lines added, 119 removed). In superseded_versions, plugin_cache_versions, tmp_entries and project_transcripts, each branch now sets disposition, reason and evidence, and one make_row call builds the row. Before, every branch had its own make_row call, often with a shared **common dict. plugin_cache_versions also uses functools.partial(_read_guarded, claude_dir) in place of a one-line closure, and reads known.doubt directly instead of copying it to a local. Row contents, key order, when the optional evidence key appears, exception paths, call order and all public signatures are unchanged. No code was moved between files.

Not verified

  • test_deep_inventory.py and the deep-inventory tests in test_hygiene.py were not run directly: this lane allows no interpreter, so the suites are left to the PR's CI
  • tidy (code-tidying:tidy-diff) ran passes 1-4 and changed nothing. Pass 5 (/ai-slop:audit fix on the fragment) was read by hand only, because the lane cannot run its detect.sh and digest-guard.sh scripts. The fragment's one line is the wording the issue requires
  • ci-status green is checked on the PR's CI, not in this run
  • The lane system prompt says to leave changes uncommitted for the runner to turn into a patch, so nothing was committed, although ci-mode says to commit

Fix

  • plugins/disk-hygiene/skills/clean/scripts/deep_inventory.py: each of the four row producers now builds its row with one make_row call; a functools.partial replaces the read closure; the doubt local and the per-iteration common dicts are gone
  • .changes/disk-hygiene/work-resolve-issue-issue-14448-42880107949-1-f27d841e.md: new patch fragment made by new-changelog-fragment, with body '### Changed' and '- Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 0213fc4:

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

The run reports:

  • check-changelog-fragments: all 4 fragments under .changes/ valid (run after the last edit)
  • check-changed-skills: CHECK-SKILL clean PASS, 0 errors, 3 warnings that this change did not cause (SKILL.md size and description length)
  • check-affected: 13 passed, 6 skipped over 2 changed files (run after the last edit)
  • fresh-context review subagent over the full diff against HEAD and the original file: no behavior difference found. It checked evidence-key presence, per-iteration resets, call order of orphan_marker, _orphan_reason and make_row, the early binding of functools.partial (no test patches…
  • git-read diff --stat HEAD: 1 code file changed, 75 insertions, 119 deletions; plus 1 new fragment file
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42880107949

Left out: the items under Not verified.

Related

#14448

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

Code review: refactor(disk-hygiene): simplify deep_inventory.py row building

I read every hunk of both changed files and found nothing to report. This was a full review, not a blocking-only one, because the lane has not reviewed an earlier head.

Behavior check (from reading the code; I ran no tests)

  • Row shape and key order. make_row → _stat_row builds each dict with its keys in a fixed order (deep_inventory.py:186-199). Moving producer and category from **common to the front of the call therefore doesn't change the output's key order.
  • When the evidence key appears. Passing evidence=None explicitly has the same effect as leaving it out, because the key is only added when the value is not None (deep_inventory.py:197). Every branch gets the same evidence as before:
    • in superseded_versions and project_transcripts, the per-iteration reset to None is followed by assignment only in the KEEP-with-evidence branches;
    • in the plugin_cache_versions CANDIDATE branch, evidence is still the orphan_marker result, which may be None.
  • tmp_entries. match or (None, "unknown", None) is safe because a matched producer is always a non-empty 3-tuple. The producer when nothing matches is still "unknown". The order of the keep_reason / used / age / running is None checks is unchanged, and so is every reason string.
  • plugin_cache_versions. Using functools.partial(_read_guarded, claude_dir) instead of the closure only changes when _read_guarded is looked up. No code in plugins/disk-hygiene patches _read_guarded, so nothing sees the difference. The calls to orphan_marker and _orphan_reason still happen in the same order.
  • project_transcripts. The walrus elif (source := decode_project(...)) is None gives the same branching as the old early continue. functools was already imported (deep_inventory.py:31).

Closing issue #14448, acceptance criteria

  • "Behavior is unchanged": met, judging from the reading above. The existing suites (test_deep_inventory.py, test_hygiene.py) run in CI; the author says they did not run them locally, and I could not run them either.
  • "The diff edits only the listed files … and changelog fragments": met. The diff touches only deep_inventory.py and one fragment.
  • "Within 400 changed lines and 15 hand-edited files": met, at about 194 changed lines in one code file.
  • "ci-status is green": not checkable from this lane, so it is left to CI.
  • Fragment criterion: met. The fragment has bump: patch, ### Changed and "Internal simplification, no behavior change."

Rules and manifests

  • Path-scoped rules. .claude/rules/ruff-pin.md matches **/*.py, but it is about the ruff version pin, which this change doesn't touch. The skill-body rules match plugins/*/skills/**, but they cover skill and agent text, not a Python script. Neither applies.
  • Plugin manifests. No manifest changed. The patch bump fits a change with no behavior difference.

Embedded text. I found no embedded instructions in the PR context or the prior-findings file.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15145 (head 0213fc4)

I found no security issues. I read every hunk of both changed files. Neither file matches a trusted-path glob, and the diff touches no trust control, workflow, plugin manifest or instruction surface.

What changed. This is a behavior-preserving refactor of the four row builders in plugins/disk-hygiene/skills/clean/scripts/deep_inventory.py, plus a patch changelog fragment. Since these rows decide which paths the clean skill offers to delete, I checked that each one gets the same disposition (KEEP / CANDIDATE / UNKNOWN) as before:

  • superseded_versions: every branch either sets its own disposition or keeps the KEEP default set at the top of each loop pass. Evidence is reset to None on every pass, so nothing carries over from the previous path.
  • plugin_cache_versions:
    • functools.partial(_read_guarded, claude_dir) binds the same root argument the old closure passed. functools is already imported at L31.
    • The bounded, link-refusing read (_read_guarded, L338) is unchanged.
    • A registry doubt still forces UNKNOWN before the installPath check runs.
  • tmp_entries: match or (None, "unknown", None) only unpacks once match is known to be None or the 3-tuple, and the match is None → UNKNOWN branch still runs first.
  • project_transcripts: the walrus decode_project only runs when the name passes the decodability check, which is the same order as before.
  • Evidence key: passing evidence=None explicitly is the same as leaving it out. make_row only adds the key when it is not None (L197-198).

No branch now marks as CANDIDATE a path it used to keep or mark UNKNOWN, so the change creates no new path to deleting files.

PR context. The description is consistent with the diff. I found no embedded directives aimed at the review lane.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 0213fc4

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-15145-0213fc42ffe4c4d5448e42366f26d712d3c6d37f, 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 9363335 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14448-42880107949-1 branch November 10, 2026 19:27
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 93633352b15dee939dd75c93ccde3b890e00e67b; 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 deep_inventory.py disk-hygiene plugin code

0 participants