Skip to content

feat(code-metrics): read the personal override from docs conventions with a dual-read window for the old paths - #18069

Merged
melodic-automation-lanes[bot] merged 6 commits into
mainfrom
work-resolve-issue/issue-18001-44954461570-1
Nov 22, 2026
Merged

melodic-automation-lanes[bot] merged 6 commits into
mainfrom
work-resolve-issue/issue-18001-44954461570-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #18001

Summary

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

The code-metrics resolver now reads the config-cascade layers: team docs/conventions/code-metrics.yaml and personal override docs/conventions/code-metrics.local.yaml. There is no user-global file layer, and the plugin declares no userConfig option. Dual-read window: the old ~/.claude/code-metrics.yaml is still read below the team layer. The old .claude/code-metrics.local.yaml is still read as the personal layer while the new file is absent or does not parse. Each run prints one warning per old file naming where its keys go; with both personal files present the new one wins and the warning names both. setup-check names each old file it finds. setup-apply gains --copy-old [--preview], which copies the old files' keys into the new personal file after a preview and leaves the old files in place. Choice and basis: the issue maps the user-global file to userConfig, but this plugin has no userConfig option and its keys are nested, which userConfig options do not fit. So the old file stays readable at its old position, and --copy-old copies its keys into this repository's personal override. It skips any key the team file sets: the team value already wins over the user-global value, and copying it into the personal override would make it win over the team. The effective configuration does not change, and each skipped key is printed with its reason. The personal override uses docs/conventions, like the existing fixed team path, rather than a pointer-bound <home>; the contract row records this.

Not verified

  • The plugin's Python and shell test suites (test_resolve_config.py, test_setup_apply.py, dispatch.test.sh, setup-check.test.sh, audit-size.test.sh) were not executed: this lane runs no interpreter or test runner. They were traced by reading only, and are left to the PR's CI.
  • check-affected skipped typos (not installed), comment-hygiene (network fetch denied), size-check (wrapper path missing in the lane) and three validate-plugins sub-checks that run checked-tree code; left to the PR's CI.
  • tidy skipped: the change touches 26 files and 2 areas (plugins/code-metrics with .changes/code-metrics, and docs/contracts), over the 10-file, 300-line and 1-area cutoffs.
  • verify (build and tests) skipped for the same reason as the test suites: no interpreter can run in this lane.
  • No userConfig option was added for per-person values across repositories. The plugin declares none, and its nested keys do not fit userConfig options. Until a later change adds one, the old user-global file stays readable and --copy-old copies its keys into each repository's personal override.
  • Review edge findings left as is: --copy-old refuses a symlinked old user-global file or a symlinked .claude/ directory (the resolver still reads them, so such a user sees the warning but must copy by hand); a rewrite of an existing personal file replaces its comments with the header (the preview…
  • The personal override path is fixed at docs/conventions, like the existing team path, not the pointer-bound <home>; the contract row records this.

Fix

  • plugins/code-metrics/scripts/resolve-config.py: surface_layer_paths now returns the team and docs/conventions personal files, plus the old user-global and personal files under the dual-read rules, with one warning per old file; old_layer_paths added; the docstring states the layers and the window.…
  • plugins/code-metrics/scripts/dispatch.sh: the header comment names the new layers and the dual-read window.
  • plugins/code-metrics/skills/setup/scripts/setup-check.sh: INFO row for userConfig; WARN 'layer user-global location' and 'layer local location' rows naming each old file and whether it is read; the local layer row checks the file actually read; the gitignore advice is docs/conventions/**/.local.…
  • plugins/code-metrics/skills/setup/scripts/setup-apply.py: new --copy-old [--preview] [--dir] [--home] mode that merges old user-global keys (skipping keys the team file sets), then old personal keys, keeping keys the new personal file already sets; prints each key copied or not copied; writes…
  • plugins/code-metrics/scripts/test_resolve_config.py: tests for new personal only, old personal only (value applies, one warning naming the new location), both (new wins, warning names both), an unparseable new file leaving the old one applied, and an old user-global file applying with a warning.
  • plugins/code-metrics/skills/setup/scripts/test_setup_apply.py: tests for --copy-old preview, copy, the team-shadowed key skip, an unchanged resolved configuration before and after, old files left in place, idempotence, kept existing keys, no-old-file, and argument errors.
  • plugins/code-metrics/skills/setup/scripts/setup-check.test.sh: covers the userConfig row, new personal only, old personal only, both present, and the old user-global row and value.
  • plugins/code-metrics/scripts/dispatch.test.sh: case 10b covers new personal only (no warning), old personal only (value applies, warning on stderr), both (new wins, warning names both).
  • plugins/code-metrics/skills/audit/scripts/audit-size.test.sh: the size.check personal-override case covers new only, old only with its warning, and both present.
  • plugins/code-metrics/reference/config.md: layers table (userConfig none, team, personal at docs/conventions), dual-read window table, gitignore line, ecosystem-layer and CODE_METRICS_HOME wording.
  • plugins/code-metrics/README.md: Configuration section names the new layers, the dual-read window and --copy-old; removes the stale 'still reads the .claude paths' sentence.
  • plugins/code-metrics/skills/setup/SKILL.md: purpose, check rows, a new apply step 4 (preview, explicit yes, copy), the 'does not do' list, and a description kept under 1024 characters.
  • plugins/code-metrics/skills/setup/evals/evals.json: eval 3 expects the docs/conventions/**/.local. ignore line.
  • plugins/code-metrics/skills/setup/templates/config-template.yaml: header names the new layers.
  • plugins/code-metrics/schemas/code-metrics.schema.json: description names the new personal file and the old files still read.
  • plugins/code-metrics/skills/audit/actions/{size,complexity,type-debt}.md, skills/audit-coverage/SKILL.md, skills/audit-duplication/SKILL.md, skills/principles/reference/thresholds.md, reference/several-repositories.md: layer wording updated to the team and docs/conventions personal files.
  • plugins/code-metrics/scripts/fixtures/config/{user,local}.yaml: comment lines name the old user-global file and the new personal path.
  • docs/contracts/config-cascade/README.md: the code-metrics Implementers row records the new layers, the dual-read window, what setup apply writes, the refreshed resolve-config.py line citations, and As of 2026-11-21.
  • .changes/code-metrics/work-resolve-issue-issue-18001-44954461570-1-b0a70733.md: minor changelog fragment.

Verification

The runner ran each check from the base copy against 19e9d34:

  • 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: 5 skills checked, 0 failed (first run failed because the setup description was 1076 characters, over 1024; shortened to 1001 and re-run)
  • check-affected: 16 passed, 7 skipped over 26 changed files, including validate-plugins for code-metrics
  • fresh-context review subagent over the whole diff: no code or test bug found; it confirmed three doc contradictions (the contract row's sentence order and its 'team layer only' writer claim, and a leftover README sentence), all fixed. Two edge findings were also fixed: the old personal file now…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/44954461570

Left out: the items under Not verified.

Related

#18001

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

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 44957921860, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44957921860

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/fix-ci

Run 44962695163, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44962695163

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-patch

Run 44962695163, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 2c98b0b
Run 44962695163

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #18069, incremental (98658e3 → 4facd93)

No security issues found. This lane already reviewed an earlier head, so this review reports blocking findings only. It covers the 3 files changed since 98658e30e14829645b1d81b5fbda76d5a0eecdf7, and I read every hunk of each in the incremental diff.

What changed and what I checked:

  • setup-apply.py (copy_old, lines 483-496). This change only affects which message is printed. When config_file is unset (user_target is falsy), the old user-global file now gets "keep it until the config_file option is set and --copy-old has copied its keys" instead of the advice to delete it. The old per-repository file still gets the delete advice. The change does not affect what is written or where, the preview-and-yes gate, the check_file symlink and hard-link refusal, or the O_NOFOLLOW temp-file write. No new input reaches a shell, path or command.
  • skills/setup/SKILL.md step 4. This is an instruction-surface change, and it narrows nothing. It adds an instruction to keep the old user-global file while the option is unset. Every existing prohibition stays as it was (no writes to Claude Code user settings or pluginConfigs, no .gitignore edits, no changes to old files) and so does the explicit-yes gate. No protected guardrail is removed.
  • test_setup_apply.py. This file is test-only. It adds assertions for the keep line and for the absence of the delete line.
  • Settled thread. The earlier finding at setup-apply.py lines 483-491 (delete advice printed when the option is unset) is fixed by this push, and the owner confirmed the fix in that thread.
  • Trusted paths. None of the 3 files matches a TRUSTED PATHS glob. None of them touches a trust control, a token, the kill switch or a merge hold.
Manifest lines (1)
  • manifest userConfig.config_file: settled by kyle-sexton, ## plugins/code-metrics/.claude-plugin/plugin.json, lines 29-34 at the head

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 2 inline finding(s) on 73730440903f387328db8a8c32e9f95eae77edde; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review (incremental): PR #18069, 98658e30..4facd93c

This incremental review covers the 3 files this push changed, and I read every hunk of all 3. It is blocking only: this lane already reviewed earlier heads, so advisory findings are dropped.

What changed. The push fixes this lane's finding from the last round. Before, when config_file was unset, --copy-old copied none of the user-global keys and still printed the delete advice for the old file. Now:

  • setup-apply.py (lines 483-497): when the old file is ~/.claude/code-metrics.yaml and user_target is unset, it prints left in place: <old>; keep it until the config_file option is set and --copy-old has copied its keys. The delete it once check shows the values you expect line is no longer printed in that case.
  • setup-apply.py, other cases: the delete advice stays for the old personal file, and for the old user-global file when the option is set and its keys went into the option's file. That file is read in every repository, so deleting the old user-global file drops nothing.
  • SKILL.md step 4: now states the same distinction.
  • test_copy_old_with_the_option_unset_copies_no_user_global_key: now asserts that the keep line is printed and the delete line is not.

The fix matches the earlier finding's suggested fix and #18001's criterion "No setting in an old file is silently dropped." That thread is resolved by the owner, and its lines are unchanged since the resolution.

Blocking findings: none.

I ran nothing. The author's claim that test_setup_apply passes 20/20 and setup-check 63/63 is unverified here.

Advisory and manifest lines (1)
  • Loosened checks would be marked: fail (default: the prompt had no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt had no loosened_check_decision_record: line, so the citation requirement was not checked. Nothing is loosened in this push: the test gains assertions and loses none.

Verifier dropped 0 of 0 candidates.

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 4facd93cf37822d479678b9ea728afa6835076c1. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

a pr-unblock lane stopped its head (pr-unblock/address-feedback is failure), which clears when the
  lane runs again

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 73730440903f387328db8a8c32e9f95eae77edde, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=HIGH demote=true head=73730440903f387328db8a8c32e9f95eae77edde rubric=10.4.6 rater=claude-opus-5-5 checker=claude-opus-5-5

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback

Run 44979521766, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44979521766

Failed GitHub API calls

No failed call recorded by the run job's scripts.

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM66dhq8
Lane-Thread: PRRT_kwDOTCGFQM66dhq_
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-feedback-patch

Run 44960948468, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed 3bd7277
Run 44960948468

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 3bd7277.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/publish-feedback

Run 44979521766, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44979521766

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 22, 2026
@kyle-sexton

Copy link
Copy Markdown
Member

Held by the PR lane until a session reviews the HIGH (demote=true) rating at 7373044. Its Reversibility row names docs/conventions/code-metrics.local.yaml, and a MEDIUM row says --copy-old writes that personal file without a gitignore check. The PR stays armed at a head (2c98b0b) that has no rating. The label comes off once each HIGH reason is checked against the stop list and the current head is rated.

🤖 Generated with Claude Code

@kyle-sexton

Copy link
Copy Markdown
Member

Risk review (R18) of the HIGH demote=true rating at 7373044: its one HIGH reason is Reversibility. --copy-old writes the personal docs/conventions/code-metrics.local.yaml without checking that git ignores it, so a person could commit a personal override by mistake. Accepted: the file holds code-metrics settings (reference values, scope and collectors), never a credential; a mistaken commit is reverted by deleting the file; and it changes no permission, trust boundary, security control or cost. Taking off the do-not-merge label so head 2c98b0b gets its own rating. If that rating names a credential, cost, trust-boundary or security-control reason, the label goes back on.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 22, 2026
Issue #18001 maps ~/.claude/code-metrics.yaml to the userConfig layer, so
the plugin now declares a file-typed config_file userConfig option. The
layer holds the same nested keys as the team file, which no scalar option
can carry, so the option names a YAML file, as multi-agent's role_map_file
does. Plugin options do not reach Bash commands, so each skill passes
'${user_config.config_file}' to its scripts as --user-file; the entry
scripts export it as CODE_METRICS_USER_FILE and cm_resolve_config hands it
to the resolver, the one place the value is guarded: empty or
unsubstituted is unset, a leading ~/ expands against the home, and a value
still not absolute is skipped with a warning.

The resolver reads that file as layer userConfig, below team. During the
dual-read window the old ~/.claude/code-metrics.yaml is read in its place,
labeled userConfig as docs-naming labels its old file, only while the
option's file is absent or outside the YAML subset; one warning names the
old file and the option's file, or the option itself while it is unset.
Both layers now share one dual-read helper, so the personal override keeps
its behavior and warnings.

setup-check names the userConfig layer and the old file's new location,
and its help moves into a usage() heredoc. setup-apply --copy-old copies
old user-global keys into the option's file after a preview and a yes,
never into the personal override; while the option is unset it copies
none and says to set it. Copying no longer skips keys the team file sets,
since the option's file sits where the old file did. Both preview and
write run git check-ignore on docs/conventions/code-metrics.local.yaml and
warn with the docs/conventions/**/*.local.* line when it is not ignored.

The positional first layer file is now labeled userConfig too, so
provenance uses one name for the layer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtUnz4WHB5auUnwQYq7

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 98658e30e14829645b1d81b5fbda76d5a0eecdf7; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 98658e30e14829645b1d81b5fbda76d5a0eecdf7; the summary is in this lane's pull request comment.

claude-lane: claude-review

… unset

claude-review showed --copy-old printing "delete it once check shows the
values you expect" for the old ~/.claude/code-metrics.yaml even when the
option was unset and none of its keys were copied; check still passes then
(the dual read), so deleting it would drop those settings, which #18001
forbids. The run now says to keep the file until the option is set and a
rerun copies its keys; setup step 4 says the same, and the unset-option
test asserts both lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RAoAtUnz4WHB5auUnwQYq7
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 2 of max 4 on 4facd93.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 22, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped address-feedback on this pull request: the merge gate refuses this head verify:earlier-fail, and the lane found every note of that earlier pr-verify FAIL already addressed by the diff, so it pushed nothing; only a session can move the head for the verifier to judge again. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/address-feedback status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=18069 -f activity=address-feedback

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation

Run 44979521766, attempt 1

Field Value
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none recorded
Run 44979521766

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@melodic-automation-lanes melodic-automation-lanes Bot removed the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 22, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path is about to arm native auto-merge at head 4facd93cf37822d479678b9ea728afa6835076c1, the head its arming checks judged. The arm fails if the head moves first.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Merge-Risk: max=HIGH demote=true head=4facd93cf37822d479678b9ea728afa6835076c1 rubric=10.6.0 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 22, 2026
@kyle-sexton

Copy link
Copy Markdown
Member

Merge-risk acceptance at 4facd93 (rating run 44979882831, HIGH demote=true). The only HIGH row is Reversibility: the new config_file userConfig option in plugins/code-metrics/.claude-plugin/plugin.json, --copy-old writing to the file that option names, and the provenance layer rename user-global -> userConfig. This is acceptable: #18001 asks for this contract; it is the operator's own setting, written to a path the operator chose; it grants no permission and touches no token, secret, account, billing or trust boundary. A later rename can ship with a dual-read window the same way this PR retires ~/.claude/code-metrics.yaml. The MEDIUM rows (body text describing an earlier design, untested user_config substitution) do not block. pr-verify pass-notes at this head.

Merged via the queue into main with commit 753e487 Nov 22, 2026
97 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-18001-44954461570-1 branch November 22, 2026 04:30
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

code-metrics: read config from the config-cascade layers, not ~/.claude

1 participant