Skip to content

fix(lib): skip kind file retirements at a home or non-repository root - #13510

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-13504-42046572559-1
Nov 5, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #13504

Summary

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

lib/check-retirements.sh no longer evaluates kind: file records when the resolved root is $HOME, or has no .git and is not inside a git work tree. There a .claude/<name>.json path is the live user-global layer, not a retired team file. Each skipped record prints &lt;id&gt;: skipped: root is not a repository on stderr, writes no TSV row, and --clean of it exits 2. dir and line records are still evaluated. Design choices: the refusal covers only kind file records, because those are the records detection skips, so dir and line rows that detection still reports stay cleanable. A .git at the root counts as a repository even when git is missing or refuses the repository for dubious ownership, so a skip cannot turn a real leftover into a false PASS. The seven plugin copies were regenerated with scripts/sync-shared-copies.sh. The retired-conventions contract goes to 2.0, since its versioning rule calls a change to a kind's detection semantics or an exit code's meaning a major bump. The third done-when item, dropping the attribution setup SKILL.md paragraph, cannot be done yet: that paragraph is not on the default branch. #13476 is still open and its PR #13505 has not merged, so that part is listed in remaining.

Remaining work

  • Remove the "root that is the home directory or not a repository" paragraph from plugins/attribution/skills/setup/SKILL.md once PR #13505 (for #13476) merges and adds it; it is not on the default branch yet

Not verified

  • plugins/harness-config/lib/check-retirements.test.sh (including the new case 23), lib/check-retirements-worktree.test.sh and the other helper callers were not executed: this lane runs no test scripts, so the suites are left to the PR's CI
  • tidy skipped: the change has 18 files across several areas and touches the shared lib/ path, which is over the tidy cutoffs
  • the GitHub page was read with WebFetch, not /discovery:read-docs, which does not resolve in this lane

Fix

  • lib/check-retirements.sh: compute ROOT_IS_REPO ($HOME, or no .git and not inside a git work tree, means not a repository); skip kind file records in detect mode with a stderr skipped: root is not a repository line and a skipped count in the summary; refuse --clean of a kind file record there…
  • plugins/{harness-config,source-control,plugin-quality,harness-ops,attribution,docs-naming,guardrails}/lib/check-retirements.sh: regenerated byte-identical copies via sync-shared-copies
  • plugins/harness-config/lib/check-retirements.test.sh: case 23 covers a fake $HOME that is itself a git repo, a plain non-repository directory (no file row, dir row kept, skip reported, --clean refused, file left in place), a repository root that still reports the row, and a .git that git rejects,…
  • docs/contracts/retired-conventions/README.md: new paragraph on the repository-root requirement for kind file records; detection exit 0 and clean exit 2 rows updated
  • docs/contracts/retired-conventions/CHANGELOG.md: [2.0] entry for the changed kind file detection and clean exit 2 meaning
  • .changes/{harness-config,source-control,plugin-quality,harness-ops,attribution,docs-naming,guardrails}/work-resolve-issue-issue-13504-*.md: patch fragments (### Fixed) for each plugin that carries the copy

Verification

The runner ran each check from the base copy against 03e549e:

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

The run reports:

  • sync-shared-copies: regenerated all 7 copies from lib/check-retirements.sh, exit 0
  • check-changelog-fragments: all 13 fragments valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped (skips: typos not installed, no changed .py, checks that run code from the checked tree), the rest CI only
  • cant-fail-scan --file plugins/harness-config/lib/check-retirements.test.sh --check: PASS, no gating findings
  • fresh-context review subagent over the whole diff: no correctness bugs; four low findings (dubious-ownership false PASS, stale detection exit-table rows, untested .git fallback, CDPATH-unsafe cd), all fixed
  • read https: //github.com/melodic-software/claude-code-plugins/pull /13476: #13476 is an open issue and its linked PR #13505 is open, so the SKILL.md paragraph this issue asks to drop is not on the default branch yet
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42046572559

Left out: the items under Not verified.

Related

#13504

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

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #13510, no security issues found

What the change does. lib/check-retirements.sh now works out a ROOT_IS_REPO flag. The root counts as not a repository when its physical path equals $HOME, or when it has no .git and git rev-parse --is-inside-work-tree doesn't print true. When the flag is 0, detection skips every kind: file record, and --clean of one exits through die before it can delete or migrate anything. The other changes are the seven plugin copies (same content), a new test case 23, the contract README and its 2.0 CHANGELOG entry, and changelog fragments.

What I checked:

  • Destructive path. The new refusal in --clean (lib/check-retirements.sh#L619-L621) runs before the migrate check and before any unlink or rewrite. It only adds a refusal and widens no deletion. In a repository, dir and line records behave as they did on the base, so nothing new can be removed.
  • Path and command handling. $ROOT and $HOME are resolved with CDPATH='' cd -- … && pwd -P and passed quoted to git -C. I found no word splitting, glob expansion or option injection. A $ROOT the caller controls already reached these same commands on the base.
  • Can the skip hide something? At a root git refuses, a .git entry still counts as a repository (L202). So a skip can't turn a real leftover into a false PASS there. Skipped records are named on stderr. This is a detection-accuracy concern only: no leak, compromise or charge.
  • Trust controls and instructions. None of the changed files is on a trusted path or a hold path. The diff doesn't touch the trusted-trigger check, the lane token, the kill switch, the token broker or the merge holds. It deletes or softens no standing instruction: the README exit-table edit only rewords one sentence and adds the new exit-2 case.
  • Manifests. No plugin.json or marketplace.json changed.
  • Embedded text. The PR context contains no embedded directives aimed at the lane.

Copies. The six .changes/* fragments are copies of .changes/attribution/…. The seven plugins/*/lib/check-retirements.sh files are copies of plugins/attribution/lib/check-retirements.sh, whose hunks match lib/check-retirements.sh apart from line offsets. Every copy is a changelog fragment or a shared library script, the same role as the first path, so no copy's path changes what its content does.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #13510, no findings

The change makes lib/check-retirements.sh stop evaluating kind: file records when the root is $HOME, or has no .git and is not inside a git work tree. In that case it prints <id>: skipped: root is not a repository on stderr, writes no row, and --clean of such a record exits 2 through die. dir and line records are evaluated as before. I found no correctness problems.

What I checked

  • The repository check (lib/check-retirements.sh:192-206):

    • It runs after ROOT is resolved and its trailing slash is removed.
    • Both sides are compared as physical paths (pwd -P). CDPATH is cleared and an empty $HOME is handled.
    • A .git at the root counts as a repository even when git rejects it, so a real leftover cannot turn into a false PASS.
    • The script uses set -uo pipefail without -e, so a failed cd inside the command substitution cannot end the run silently.
  • The clean path: kind is set at lib/check-retirements.sh:613, before the new refusal at line 619, so the refusal reads a defined value.

  • Existing callers: I looked at every fixture that runs the helper against a root:

    • the guardrails eval scaffolds and retired-installs.test.sh
    • lib/check-retirements-worktree.test.sh
    • scripts/pilot-plugin-quality-sim.test.sh
    • the earlier cases of check-retirements.test.sh

    Each one either runs git init or goes through mkrepo. mkrepo now creates .git when git is missing. The pilot sim already needs git for its resolver cases, so it is not newly affected.

  • Test case 23: it covers a fake $HOME that is a git repository, a plain directory (with GIT_CEILING_DIRECTORIES set so a surrounding repository can't leak in), a repository root that still reports the row, and a .git that git rejects. Each of these would fail if its branch of the new check broke.

  • Plugin copies: the seven copies are byte-identical to one another (per the identical-files list). Their only differences from lib/ are header line offsets, which is consistent with output from sync-shared-copies.sh.

  • Contract docs: the README and CHANGELOG match the code. The 2.0 major bump follows the contract's own versioning rule. I found nothing in the repository that pins a contract_version and would break.

Closing issue: the PR body only says Refs: #13504, and the PR context file has no closing-issue section, so I had no acceptance criteria to check. The author lists one remaining item: removing the attribution setup SKILL.md paragraph once PR #13505 merges. A person should track that.

Manifests: no plugin.json or marketplace.json changes. The seven changelog fragments use bump: patch, which fits a fix.

Not verified: I ran none of the test suites, including case 23. The author's verification list (sync, fragment checks, cant-fail-scan) is the author's claim and I did not confirm it.

No text in the PR context or prior-findings files asked the lane to do anything.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 03e549ea56f85a8119a13d9c90d3b9b5acc98160.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 5362df8 Nov 5, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-13504-42046572559-1 branch November 5, 2026 15:12
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5362df8e569f9aa2a9bf12cd255e845b54bb1494; 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.

0 participants