Skip to content

refactor(disk-hygiene): simplify resume-notice and run-python-hook - #14547

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14446-42595487264-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14446

Summary

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

Simplified the two disk-hygiene hook files without changing behavior. In resume-notice.mjs, main() now calls decide() directly, because decide() already returns null for a falsy payload. In run-python-hook.sh, the single-use _under_windowsapps helper is folded into _is_store_alias_stub as one test. The probe-result check that resolve_python3 repeated in its python3/python and py branches is now one helper, _use_probed_executable. Two comment blocks that described earlier versions of the code now describe what it does.

Not verified

  • run-python-hook.test.sh, resume-notice.test.mjs and the Python suites that run the launcher were not run here (the lane's Bash allows only the named wrappers); left to the PR's CI
  • tidy: passes 1-3 dropped both code files, because each is wired as a hook command in hooks.json, which tidy's GLOBAL HARD exclusions forbid under enforce. Pass 5's ai-slop detector could not run under the lane's Bash restriction; I read the fragment against the rubric myself and found no findings
  • verify step: no build or test run was possible in this lane beyond check-affected; behavior equivalence rests on the review and the CI suites

Fix

  • plugins/disk-hygiene/hooks/resume-notice.mjs: main() passes the payload straight to decide(), which already returns null for a falsy payload.
  • plugins/disk-hygiene/hooks/run-python-hook.sh: folded _under_windowsapps into _is_store_alias_stub as one [[ ]] test; added _use_probed_executable in place of the probe-result check that was written out twice in resolve_python3; rewrote the SCRIPT_DIR comment and the…
  • .changes/disk-hygiene/work-resolve-issue-issue-14446-42595487264-1-0e70c6e4.md: patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 0b0bbb0:

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

The run reports:

  • check-changelog-fragments: all 2 fragments under .changes/ valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped (typos not installed, ruff and changed-skills not applicable, 3 validate-plugins steps reported by the check), the rest CI-only; run again after the review fixes with the same result
  • fresh-context review subagent: no behavior difference found in any hunk (decide() falsy payload, _is_store_alias_stub truth table, _use_probed_executable return codes, PYTHON values and local shadowing under set -uo pipefail); it flagged two comment inaccuracies, both fixed
  • grep of the repository: no test or script reads the removed function names or the reworded comment text; test_owner_registry.py's launcher rm count (2) is unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42595487264

Left out: the items under Not verified.

Related

#14446

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

Security review: PR #14547, no security issues found

I read every hunk of all 3 changed files. None of them matches a trusted path, and the PR touches no manifest, no trust control, no merge hold and no instruction surface.

plugins/disk-hygiene/hooks/resume-notice.mjs: main() now passes the payload straight to decide(). decide() already returns null for a falsy payload (resume-notice.mjs#L49: if (!payload || payload.source !== 'resume') return null). The output is the same, and the session-id check and the marker-path checks are unchanged.

plugins/disk-hygiene/hooks/run-python-hook.sh:

  • _is_store_alias_stub: the new single test [[ -f "$1" && ! -s "$1" && "${1,,}" == *windowsapps* ]] gives the same answer as the old three-step version for every input.
  • _use_probed_executable (run-python-hook.sh#L424-L427) keeps every check the old inline code made before it accepted the probed sys.executable:
    • strip the trailing CR;
    • reject a multi-line value;
    • require the file to be executable (-x) and non-empty (-s);
    • require an interpreter-shaped basename (_interpreter_shaped).
  • python3/python branch: PYTHON is still set to the PATH lookup first and still returns 0 either way.
  • py branch: it now returns the helper's exit status, which matches the old return 0 / return 1.
  • local exe: the helper's local copy shadows the caller's exe without leaking it.

Nothing that decides which interpreter the always-on PreToolUse guard launches got weaker.

The rest of the diff is comment rewording and a changelog fragment, neither of which is security-relevant.

No embedded instructions found in the PR context.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14547: refactor(disk-hygiene): simplify resume-notice and run-python-hook

No findings. I read every change in all 3 files and checked each simplification against the code it replaces at head 0b0bbb0a.

Is behavior unchanged?

  • resume-notice.mjs main(): the change drops the payload ? … : null check before decide(). decide() already returns null when payload is falsy (resume-notice.mjs#L49). readPayload returns undefined when the input is not valid JSON, so the output is the same. The existing 'not json' case in resume-notice.test.mjs runs this path.
  • _is_store_alias_stub: the single test [[ -f && ! -s && ${1,,} == *windowsapps* ]] has the same truth table as the old three steps (-f || return 1, -s && return 1, case-insensitive windowsapps match). _under_windowsapps had no other caller in the plugin. The Python _under_windowsapps in python3_alias_probe.py is a separate function.
  • _use_probed_executable:
    • python3/python loop: PYTHON="$_LOOKUP" is still set first, the helper overwrites it only when the probed path passes, and return 0 still follows unconditionally. The script uses set -uo pipefail with no -e, so a failing && chain does not abort it.
    • py branch: the function's exit status is now the helper's, which is 0 on success and non-zero otherwise. Before, it returned exactly 0 or 1. The only caller is resolve_python3 || PYTHON="" (run-python-hook.sh#L644), which only checks success or failure, and PYTHON stays "" on failure because it is reset at entry.
    • Shared logic: the CR strip and the shape, executable and newline checks are copied exactly. The helper's local exe shadows the caller's variable, but the caller passes the value as an argument, so this has no effect.
  • Rewritten comments: they match the code. For example, "hardcoded floor applies when the engine is unreadable or has no MIN_PYTHON line" matches the probe's except OSError and its no-match fallback to (3, 11).

Closing issue #14446: acceptance criteria

  • Behavior unchanged, no renames or deletions of listed files, no changes to exported names or flags: met, per the checks above.
  • Diff edits only the two listed files and one changelog fragment: met.
  • Within 400 lines and 15 files: met.
  • Fragment has bump: patch, ### Changed and "Internal simplification, no behavior change.": met.
  • ci-status green: not checked here, because this lane has no CI access.

Verification

I ran no tests. This lane has no shell. The PR's verification section and its "Not verified" list are the author's claims, which I have not confirmed. The test suites (run-python-hook.test.sh, resume-notice.test.mjs, the Python launcher suites) are left to CI.

Other checks

  • No plugin manifest changed.
  • No .claude/rules/ rule or paved-path entry applies.
  • No changed file matches a trusted path.
  • Nothing in the PR context reads as an instruction to the lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 0b0bbb0

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-14547-0b0bbb0a8244cb26e065b635bd85cc0f174df240, 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 9, 2026
Merged via the queue into main with commit c42dee5 Nov 9, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14446-42595487264-1 branch November 9, 2026 11:59
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
plugins/disk-hygiene/hooks/resume-notice.mjs 1 0 0 0 0 0
plugins/disk-hygiene/hooks/run-python-hook.sh 2 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/disk-hygiene/hooks/run-python-hook.sh:401 other productive input-gap
plugins/disk-hygiene/hooks/run-python-hook.sh:425 other productive input-gap
plugins/disk-hygiene/hooks/run-python-hook.sh:470 SBR productive input-gap

The run's summary has the full report.

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 hooks disk-hygiene plugin code

0 participants