Skip to content

refactor(docs-naming): load the configuration through one sourced helper - #15596

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #15587

Summary

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

The git-checked root resolution, the configuration load and the cfg jq reader, which inventory.sh, sweep.sh, emit-gate.sh and apply-rename.sh each repeated line for line, now live once in a new sourced plugins/docs-naming/lib/load-config.sh as resolve_git_root, load_config and cfg. Each script sources the lib beside its other SCRIPT_DIR paths and calls the functions where the old blocks sat. sweep still reads --pairs between the root and the config, and emit-gate keeps its own root block, which has no git-dir check. The functions call each script's own die, so every message keeps its script prefix. Flags, output, exit codes and error text are unchanged. The lib uses the source guard and header form of plugins/architecture/lib/record-layout.sh.

Not verified

  • inventory.test.sh, sweep.test.sh, emit-findings.test.sh, emit-gate.test.sh and apply-rename.test.sh were not run: this lane's Bash runs only the named wrappers, so the suites are left to the PR's CI
  • ci-status green is a PR CI check, left to the PR's CI
  • tidy pass 5 (ai-slop fix) ran only its rubric read on the changelog fragment; its deterministic detector and digest guard cannot run under this lane's Bash limits. Passes 1-4 ran and made no edits

Fix

  • plugins/docs-naming/lib/load-config.sh: new sourced helper with resolve_git_root, load_config and cfg, the bodies moved verbatim from the four scripts; source guard plus a scoped SC2154 directive for the caller's CONFIG_FILE and RESOLVER
  • plugins/docs-naming/skills/audit-file-names/scripts/inventory.sh: sources the lib; the root, config and cfg blocks become resolve_git_root and load_config calls
  • plugins/docs-naming/skills/audit-file-names/scripts/sweep.sh: sources the lib; resolve_git_root before the --pairs read and load_config after it, as before
  • plugins/docs-naming/skills/generate-file-name-gate/scripts/emit-gate.sh: sources the lib; keeps its own root block; the config and cfg blocks become a load_config call
  • plugins/docs-naming/skills/realign-file-names/scripts/apply-rename.sh: sources the lib; the root, config and cfg blocks become resolve_git_root and load_config calls
  • .changes/docs-naming/work-resolve-issue-issue-15587-43243198418-1-554f3b29.md: patch fragment, ### Changed, "Internal restructuring, no behavior change."

Verification

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

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

The run reports:

  • check-changelog-fragments: all 6 fragments valid
  • check-changed-skills: 3 docs-naming skills checked, 0 failed (warnings only: description lengths that predate this change)
  • check-affected: first run failed shellcheck SC2154 (RESOLVER referenced but not assigned) in lib/load-config.sh; I added a scoped disable directive, and the final run shows 13 passed, 6 skipped, 0 failed
  • Grep for line citations of the four scripts (name.sh:NN or #LNN) across the repo: none, so no citation went stale
  • Grep of scripts/shared-copies.txt: load-config.sh is not a generated copy; the generated config-root.sh and check-retirements.sh were left alone
  • fresh-context review subagent over the diff: no correctness findings (source paths resolve, calls run at top level rather than in a subshell, no shadowed names, set -u safe, call order kept, tests run the scripts in place and inspect none of their source text); I fixed the one wording note, the lib…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43243198418

Left out: the items under Not verified.

Related

#15587

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

Security review: PR #15596 (refactor(docs-naming): load the configuration through one sourced helper)

I found no security issues.

What the change does. Four docs-naming scripts (inventory.sh, sweep.sh, emit-gate.sh, apply-rename.sh) each had the same code to find the git root, load the config and read it with cfg. That code now lives in one new file, plugins/docs-naming/lib/load-config.sh, as resolve_git_root, load_config and cfg, and each script sources it. The PR also adds a patch changelog fragment.

What I checked:

  • Function bodies match the old code. They are character-for-character the blocks they replace. The quoting is the same: "$ROOT", "$CONFIG_FILE" and "$RESOLVER" are all quoted. bash "$RESOLVER" resolve --root "$ROOT" and jq -r "$1" behave the same way, and cfg still gets only literal filters from the scripts. No new injection surface.
  • Where the lib is loaded from. Each script sources it from "$SCRIPT_DIR/../../../lib/load-config.sh". SCRIPT_DIR comes from BASH_SOURCE, not from user input or the environment, so the source path can't be pointed at an attacker's file. The lib defines functions only and runs nothing when sourced. If it is executed directly, its guard prints a message and exits 2.
  • Order of checks. The functions call each script's own die at call time. die is defined before the first call in all four scripts, so the fail-closed checks still run. Those checks are the git-dir check, the readability and valid-JSON checks on --config, and the exit when the resolver is missing or fails. emit-gate.sh keeps its own root block, as before. sweep.sh still reads --pairs between the root check and the config load.
  • Trust controls and other surfaces. None of the changed files matches a TRUSTED PATHS glob. The PR touches no workflow, action, token request, kill switch, merge hold, trusted-actor list, plugin manifest or standing instruction.

The PR context file contains no embedded instructions aimed at the lane. Prior findings: none, and this is not a blocking-only review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read all 6 changed files in full. This change moves the root resolution, the config load and cfg out of inventory.sh, sweep.sh, emit-gate.sh and apply-rename.sh into one sourced helper, plugins/docs-naming/lib/load-config.sh. I found no correctness problems.

What I checked:

  • Same behavior as before. The function bodies match the removed blocks line for line. Each call sits where its old block sat:
    • sweep.sh still calls resolve_git_root, then reads --pairs, then calls load_config.
    • emit-gate.sh keeps its own root block, which has no git-dir check, and only calls load_config.
  • Safe under set -u. All four scripts set CONFIG_FILE="" and ROOT="" before they parse options, and RESOLVER before the source line. So the lib never reads an unset variable.
  • Error messages keep each script's prefix. The lib is sourced before each script defines die, but the functions only look die up when they run, so they reach the caller's die.
  • Exit codes are unchanged. load_config and resolve_git_root are called at top level, not in a subshell, so exit 2 and die still end the script with the same codes.
  • --help still works. usage() reads ${BASH_SOURCE[0]} inside a function the script itself defines, so it still prints the script's own header. The lib's source guard compares its own BASH_SOURCE[0] with $0, which do not match when the lib is sourced.
  • The tests reach the lib. They run the scripts in place through $SCRIPT_DIR, so the relative path ../../../lib/load-config.sh resolves. No test copies a script somewhere else.
  • The changelog fragment's bump: patch fits an internal refactor.

Closing issue #15587, criterion by criterion:

  • The three blocks exist once and the four scripts use them: met.
  • Behavior unchanged: met as far as I can tell by reading. The existing *.test.sh suites run the scripts and could catch a regression.
  • Only the listed files are edited: met.
  • Size limits: met, at about 120 changed lines across 6 files.
  • The test suites pass and ci-status is green: not verified. I had no shell, and the PR author says they did not run them either, leaving both to the PR's CI.

Other checks:

  • Paved paths: the standards index has no paved-path row, so nothing to check.
  • Path-scoped rules: no .claude/rules file matches the changed paths.
  • Plugin manifests: none changed.
  • No changed file matches a trusted-path glob.
  • Neither the PR context file nor the prior-findings file contained any instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for bf5e38d

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-15596-bf5e38ddb246909b1d218761163277ef2b168f99, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 9ad753f Nov 12, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15587-43243198418-1 branch November 12, 2026 15:35
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
plugins/docs-naming/lib/load-config.sh 1 5 1 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/docs-naming/lib/load-config.sh:23 SBR productive input-gap
plugins/docs-naming/lib/load-config.sh:25 SBR productive input-gap
plugins/docs-naming/lib/load-config.sh:26 SBR productive no-assertion
plugins/docs-naming/lib/load-config.sh:32 SBR productive no-assertion
plugins/docs-naming/lib/load-config.sh:35 SBR productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

Load the docs-naming configuration through one sourced helper

0 participants