Skip to content

refactor(user-experience): read team config through lib config-cascade.mjs - #8172

Merged
kyle-sexton merged 11 commits into
mainfrom
work-resolve-issue/issue-7027-39106111522-1
Oct 20, 2026
Merged

kyle-sexton merged 11 commits into
mainfrom
work-resolve-issue/issue-7027-39106111522-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7027

Summary

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

user-experience's detect.mjs now reads its team file through a generated copy of lib/config-cascade.mjs (registered with one new line), keeping --team FILE as the test seam and the output for existing cases unchanged. code-metrics' Python YAML reader stays its own implementation, with the reason in its header, and now honors backslash-escaped quotes.

Not verified

  • sync-shared-copies --check-bump is left to the PR's CI, as the issue says
  • Behavior changes from the shared resolver: a user-experience.local.yaml beside the team file and a user-layer file now apply over team keys, and an in-project symlinked team file is refused (skipped as unreadable); both are noted in the CHANGELOG
  • code-metrics _split_key still closes a quoted mapping key at an escaped quote (predates this change, outside the flow-sequence scope)

Fix

  • scripts/shared-copies.txt: one new line copying lib/config-cascade.mjs into user-experience
  • plugins/user-experience/scripts/lib/config-cascade.mjs: generated copy
  • plugins/user-experience/scripts/detect.mjs: team file resolved via the shared resolver; --team copied under a scratch home so no other layer is read; causes and warnings kept
  • plugins/user-experience/tests/detect.test.mjs: tests for resolver reads (local layer), --team override and isolation, symlinked team file, empty and scalar routing
  • plugins/user-experience/.claude-plugin/plugin.json, CHANGELOG.md: 0.1.9 and entry
  • plugins/code-metrics/scripts/yaml_subset.py: escaped quote handling in flow sequences and comment stripping; header states why it stays Python
  • plugins/code-metrics/scripts/test_yaml_subset.py: test that x: ["a",b", c] yields two items
  • .changes/code-metrics/fix-yaml-subset-escaped-quote-3b9d1f64.md: patch fragment

Verification

The run reports:

  • run-test-file plugins/user-experience/tests/detect.test.sh: 51 pass, 0 fail (existing cases unchanged)
  • run-test-file plugins/code-metrics/scripts/test_yaml_subset.py: 10 passed; test_resolve_config.py: 21 passed
  • sync-shared-copies generated the copy; sync-shared-copies --check: all 494 copies match
  • check-changelog-fragments: all fragments valid
  • cant-fail-scan --check on both changed test files: pass
  • review: one fresh-context subagent reviewed the diff; its confirmed findings (empty routing warning, scalar routing cause, --team layer isolation, top-level error text) were fixed and tested
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/39106111522

Left out: the items under Not verified.

Related

#7027

…e.mjs

Vendor config-cascade.mjs into user-experience and resolve the team file
through it, keeping --team FILE as the test seam. Port the escaped-quote
fix into code-metrics' Python YAML reader and state why it stays its own.

Refs #6594

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 95920a52429e2a4b1e32f50ae68863c2e85417e5: 0 finding(s), 0 as inline comments.

Security review: PR #8172 at 95920a5

No security findings.

I read the full diff (9 files) and the code around it.

  • plugins/user-experience/scripts/detect.mjs: The team file is now read through the shared config-cascade.mjs resolver. The resolver refuses symlinked and non-regular files for repository layers and rejects a convention home that resolves outside the project, so this narrows the file-read surface compared with the old direct readFileSync.
    • Values from the new .local layer and the user layer still go through the existing usable() path checks for output_home, research_paths and persona_paths.
    • routing and version are teamOnly, so a local or user file cannot override the deny floor or routing.
    • The --team FILE path is an operator-supplied CLI flag. It copies the file into a mkdtempSync scratch directory (a private directory) and removes it in finally, and the user home is pointed at that scratch directory so other layers are not read. This adds no trust-boundary crossing.
  • plugins/user-experience/scripts/lib/config-cascade.mjs: This is a new generated copy. It matches plugins/user-interface/scripts/lib/config-cascade.mjs byte for byte, and differs from the canonical lib/config-cascade.mjs only by the two-line GENERATED header.
  • plugins/code-metrics/scripts/yaml_subset.py: The change adds backslash-escape handling inside double-quoted strings in _strip_comment and _flow_sequence. This is a parsing-correctness fix with no injection or authorization surface. It handles only the quote that ends the string. A parser difference here would affect config values, not security decisions.
  • Registry and shared-copies lists, changelog fragments, tests: No security relevance.
  • Instruction-surface lens: The diff removes no standing instruction, guardrail, hook allowlist or rule. The register at docs/conventions/instruction-exception-register/README.md was not needed.
  • Actions hardening: The diff changes no workflow files.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 95920a52429e2a4b1e32f50ae68863c2e85417e5: 0 finding(s), 0 as inline comments.

Code review: PR #8172 (head 95920a5)

Findings: 0. I found nothing a careful reviewer would block on. I read the diff and .claude-lane/pr-context.md, plus the vendored resolver and detect.mjs where they interact. I could not run any test: the sandbox refused approval for node --test and python3. Every "tests pass" claim in the PR body is author-claimed and unverified by me.

Issue #7027 acceptance criteria

  • Resolver copy: lib/config-cascade.mjs is registered with one new line in scripts/shared-copies.txt, and the generated copy is in place. detect.mjs now calls resolve() and keeps --team FILE as the seam, copying it under a scratch home so no other layer is read.
  • Python twin: yaml_subset.py stays its own implementation, with the reason in its header. _strip_comment and _flow_sequence now honor backslash-escaped double quotes. _unquote already unescapes \", so x: ["a\",b", c] yields a",b and c, and the added test covers that case plus a trailing \\.
  • Tests: detect.test.mjs adds tests for the resolver read with --team override, the local layer, the symlinked team file, and empty and scalar routing.
  • Changelog: user-experience is in scripts/fragment-plugins.txt, so the .changes/ fragment is the right mechanism. The Fix section's "plugin.json … 0.1.9 and CHANGELOG.md" does not match the diff, which has no plugin.json or CHANGELOG.md change; the fragment path is the one this repo uses.
  • Not checked: sync-shared-copies --check-bump is left to CI, as the issue says.

Checks I traced in checkTeam against the resolver (reading only)

  • Cause mapping: the error-prefix logic maps the resolver's refusals back to the old causes: symlink, outside the project, not found, "top level is not a mapping" and version mismatch.
  • Local version: version is team-only, so a local version cannot admit a team file at an unknown version.
  • Local routing: routing is team-only, so a local file cannot weaken the deny floor.

Notes, not findings

  • The PR body says "a user-layer file now applies over team keys". The vendored resolver has no user-global file layer (its header says a file under <userHome>/docs/conventions is never read), and the PR's own test "a user-global file is not read" confirms it. The "user" entry in checkTeam's layer filter in detect.mjs is therefore dead code, and the body's claim is inaccurate.
  • Under --team, a failure of mkdtempSync or writeFileSync (for example a read-only temp dir) would throw out of readTeam. Before this change, every read failure became a degraded cause. This only affects the test seam.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of 3 on 3a4f12e.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 2 of 3 on 3a4f12e.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 18, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: a review finding is uncertain or deferred, so a person decides it.

  • Reason: feedback-uncertain
  • Resume key: 3a4f12e0cee206d70e36afbac54a84a2939c3c88 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=8172 and activity=address-feedback:

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

kyle-sexton and others added 6 commits October 18, 2026 20:54
…ster

check-cross-plugin-source-drift.sh failed check-plugins: the copy this PR
adds makes scripts/lib/config-cascade.mjs byte-identical across
user-experience and user-interface with no registry entry. Register it like
the other sync-shared-copies clusters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main moved user-experience to changelog fragments, so after merging it the
direct 0.1.9 bump and CHANGELOG entry failed check-changelog-fragments
--check-required. Move the same entry into a patch fragment and leave
plugin.json and CHANGELOG.md as main has them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rnings

checkTeam turns refusals from the local and user layers into warnings, and
nothing exercised that path. The new case puts a team-only routing key in
both layers and fails if either layer is dropped from the warning filter.

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

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: the lane has addressed review threads on this pull request as many rounds as its cap allows.

  • Reason: feedback-round-cap
  • Resume key: 7d54f8de396d291eff6ced32ce361d7f5f62284a (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=8172 and activity=address-feedback:

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

Main's #8525 changed lib/config-cascade.mjs (no user-global layer) and
made resolve-convention-home.sh return "not applicable" outside a git
work tree. Regenerate the stale shared copy, git-init the scratch
projects in the three new team-surface tests, assert that a user-global
file is not read, and point the changelog fragment at ADR 0075.

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

Copy link
Copy Markdown
Member

Attended session (Attended Build) is fixing this PR's open threads overnight; please leave the needs-human hold in place until it posts that it is done.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped on this pull request and needs a person: the lane has addressed review threads on this pull request as many rounds as its cap allows.

  • Reason: feedback-round-cap
  • Resume key: 31a67e97f4587ef98aa910282ba3699c66048be8 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=8172 and activity=address-feedback:

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

kyle-sexton and others added 2 commits October 20, 2026 03:24
The version gate read the merged values, so a local file with
`version: 1` admitted a team file at `version: 2`. `version` is now
team-only, so the local value is refused and the team version gates.
An empty team file is again malformed (the top level is not a
mapping) rather than reported as version null. A warning for a
setting the local layer supplied names that layer and its file.

Tests: a rejected local `output_home` warns naming the local layer and
the key takes its default (ADR 0075); a clean local layer adds no
warnings; a local version cannot admit a version-2 team file; an empty
team file is malformed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WyWcv2NwzrPQ4dChfwFjM7
# Conflicts:
#	plugins/user-experience/scripts/detect.mjs
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 6c7937c Oct 20, 2026
30 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-7027-39106111522-1 branch October 20, 2026 07:49
@kyle-sexton kyle-sexton removed the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 20, 2026
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.

refactor(user-experience): read team config through lib/config-cascade.mjs

1 participant