Skip to content

fix(lib): make yaml-subset.awk refuse what yaml-subset.mjs refuses - #10914

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-10129-40837981116-1
Oct 29, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #10129

Summary

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

lib/yaml-subset.awk now refuses what lib/yaml-subset.mjs refuses on five points: a key repeated in one mapping (formerly only under -v STRICT=1, which is still accepted and now changes nothing), an unknown backslash escape in double quotes (\n is kept as written, since a record is one line), a nested flow sequence, a % directive line (formerly skipped), and a sequence-item map whose later keys sit anywhere but dash column + 2. The 20 plugin copies were regenerated with the sync script. Tests whose expectations depended on the old leniency were updated, and each carrying plugin got a patch changelog fragment.

Not verified

  • The test suites (lib/yaml-subset-awk.test.sh, lib/parse-concern-value.test.sh, lib/setup-apply.test.sh, the plugin setup-apply.test.sh files, read-pre-ready.test.sh) were not run: this lane's shell runs only the named wrappers, so awk, node and bash test runs are left to the PR's CI. Every new expec
  • The done-when names lib/yaml-subset.test.sh, but that file only runs the mjs tests (node --test yaml-subset.test.mjs). The awk changes are covered in lib/yaml-subset-awk.test.sh, the awk parser's own suite, which run-plugin-tests.sh discovers separately.
  • Tidy skipped: the change touches 75 files across 19 areas and the shared path lib/, over the 10-file, 300-line and 1-area cutoffs.
  • Build/test step (verify) skipped for the same reason as the test suites; lint and class checks ran through check-affected.
  • Callers that still pass -v STRICT=1 (resolve-convention-pattern.sh, convention-key.sh, audit-engine.sh, parse-concern-value.sh, harness-config setup SKILL.md) were left as they are: the flag is still accepted and now changes nothing.
  • read-pre-ready.sh's pre_ready item N repeats a key branch (line 138) can no longer fire because the parser refuses the repeat first. It was kept as a backstop, with no behavior change.
  • No mechanical scan for duplicate keys in tracked docs/conventions/*.yaml (this needs a backreference grep, which was not available). The read-only sweep found none in the files it read, and CI's convention-yaml-schema check covers them.

Fix

  • lib/yaml-subset.awk: always runs dupcheck; qscan fails on an escape other than " \ / \t \n; flow() fails on a nested \[ (value() calls fseq directly); a % line is a parse error; a sequence-item map's column is ind + 2; header comments updated to match
  • lib/yaml-subset-awk.test.sh: duplicate-key cases now run without STRICT (plus one with STRICT and one with an empty first value); new cases for known and unknown escapes in a value, a key, a flow item and single quotes; nested flow sequences; % directives; sequence-item map columns
  • lib/parse-concern-value.sh: --strict usage text no longer says a repeated key is an error only under --strict
  • lib/parse-concern-value.test.sh: a %YAML directive and a duplicate key now read as unset (fallback) in default mode
  • lib/setup-apply.mjs: quotedKey comment notes that only \n reaches the kept-as-written branch in a file the parser accepted
  • lib/setup-apply.test.sh: the nested key set twice case is now a one-line refusal naming line 4: duplicate key session.uploads (first at line 3)
  • plugins/{review,verification,planning,discipline,session-flow}/skills/setup/scripts/setup-apply.test.sh: duplicate-key cases expect the parser's duplicate key error (review: no PASS line for any key)
  • plugins/source-control/skills/pull-request/scripts/read-pre-ready.test.sh: a key repeated inside a pre_ready item now fails closed with the parse error
  • plugins/review/reference/config.md: a key written the same way twice is now a whole-file parse error; only a trimmed-name duplicate stays a per-key WARN
  • plugins//**/yaml-subset.awk (20 copies), plugins//**/parse-concern-value.sh (16 copies), plugins/*/lib/setup-apply.mjs (8 copies): regenerated by scripts/sync-shared-copies.sh
  • .changes/{ai-slop,attribution,discipline,discovery,docs-hygiene,education,guardrails,harness-config,harness-memory,harness-ops,multi-agent,planning,review,session-flow,source-control,testing,verification,work-items}/work-resolve-issue-issue-10129-a7c3e915.md: patch fragment for each plugin carrying

Verification

The runner ran each check from the base copy against 2edfc89:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • read https: //github.com/melodic-software/claude-code-plugins/issues /8677: the parent issue lists the five awk/mjs grammar gaps and the acceptance criteria this part copies
  • read https: //github.com/melodic-software/claude-code-plugins/issues /10128 and https: //github.com/melodic-software/claude-code-plugins/issues /10130: parts 1 and 3 cover yaml-subset.mjs and setup-apply's typed scalars, so they do not overlap with this part
  • .lane/verify/bin/sync-shared-copies: regenerated 44 copies, exit 0
  • .lane/checks/bin/check-changelog-fragments: all 20 fragments valid (run before and after the final edits)
  • .lane/checks/bin/check-affected: 12 passed, 6 skipped, the rest CI-only, over 75 changed files (run before and after the final edits)
  • fresh-context review subagent: hand-traced every new and changed test case against the awk program and lib/yaml-subset.mjs and found no correctness bugs; its one stale-doc finding (plugins/review/reference/config.md) is fixed
  • read-only sweep subagent: searched the awk parser's callers, their tests and the repo's YAML config for the five shapes; found lib/parse-concern-value.test.sh:77,205 and plugins/review setup-apply.test.sh:578 beyond the known cases (all updated) and no real config file using any of the shapes
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40837981116

Left out: the items under Not verified.

Related

#10129

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

Copy link
Copy Markdown
Contributor

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

No security issues found. critical-findings: 0

I read the whole diff (75 files) and the PR context. None of the 75 changed files is on the trusted-path list.

What changed. lib/yaml-subset.awk now refuses five more inputs, matching yaml-subset.mjs:

  • a repeated key, with or without STRICT
  • an unknown backslash escape in double quotes
  • a nested flow sequence
  • a % directive line
  • a sequence-item map whose later keys are not at dash column + 2

Everything else is regenerated copies of that parser, parse-concern-value.sh and setup-apply.mjs, plus test expectations, one reference doc and changelog fragments.

Checked and cleared:

  • Parser logic. The new checks only add fail() calls or tighten the item column. There is no new shell-out, eval, file or path handling, or new input channel to the parser, so no new injection surface. The n++ / inds[n] = ind + 2 change in the sequence-item branch only moves where continuation keys are read. It does not widen what the parser accepts.
  • Fail-open behaviour. I read the one enforcement consumer, plugins/guardrails/hooks/resolve-convention-pattern.sh:293. It already ran awk -v STRICT=1, so duplicate keys were already refused there. For the other four refusals, an awk parse error takes the existing "does not parse … enforcement disabled" path and exits 1 with empty stdout (lines 293–299). That is the documented posture for a bad team file, and the file is written by a repository committer. No new untrusted party can use it, and yaml-subset.mjs already refused these inputs.
  • Default-mode callers. parse-concern-value.sh now returns the caller's fallback instead of a lenient value on these inputs. The input is committed repo config. The only path that could use this is a committer who already controls the config, and no new attacker input reaches it.
  • Manifests, trust controls and the instruction surface. No plugin.json or marketplace.json change, no workflow or action change, and no instruction-surface deletion. The only prose edits are plugins/review/reference/config.md and header comments, and they follow the new parser behaviour.
  • PR text. The PR description holds no embedded instructions.

Spend: no cost-bearing change.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 2edfc89f4c10252f58f863aded2b65bc8e690bda: 0 finding(s), 0 as inline comments.

No blocking findings. I read the whole diff and checked the core awk change against lib/yaml-subset.mjs; I did not run any tests.

Closing issue #10129 criteria (lib/yaml-subset.awk and lib/yaml-subset-awk.test.sh):

  • Duplicate keys without -v STRICT=1: met. dupcheck(path) is now unconditional (lib/yaml-subset.awk:200). Tests cover default mode, STRICT, an empty first value, a nested key and a sequence item.
  • Unknown backslash escape: met. qscan keeps \n as written and fails on any other escape. The mjs ESCAPES table (lib/yaml-subset.mjs:61) has n, t, ", \, /. The awk differs only in keeping \n literal, because a record is one line. The PR notes this. Tests cover a value, a key, a flow item and single quotes.
  • Nested flow sequence: met. flow() now fails on [, and value() calls fseq directly, so a top-level [ still reads. Tests cover [[1, 2]], [x, [y]] and a flat sequence.
  • % directive lines: met. The line is now a parse error (lib/yaml-subset.awk:230). A % inside a value stays legal, and a test covers that.
  • Sequence-item map past dash column + 2: met. The item map's column is ind + 2 (lib/yaml-subset.awk:270-271). I traced the wide-item test inputs: j at column 6 against an expected column of 4 gives "unexpected indentation", and a nested value deeper than the key still reads.
  • Tests cover each awk change: met. The issue names lib/yaml-subset.test.sh, but that file only runs the mjs tests. The PR coverage is in lib/yaml-subset-awk.test.sh, as the PR body says. Each criterion has a test that fails if the change is reverted.

Other checks

  • read-pre-ready.sh: the top-level pre_ready repeat is still caught by the grep before the parser runs (line 117), so that unchanged test still holds. The in-item repeat test expects the parser's duplicate key message, which the fail_closed path at line 121 produces. The repeats a key branch at line 138 is now unreachable, as the PR says. It is kept as a backstop and is harmless.
  • Behavior change: configs with a repeated key, a % line, an unknown escape or a nested flow sequence now fail to parse. Callers that used a fallback take it (the updated parse-concern-value.test.sh) or refuse (setup-apply). The patch fragments describe this accurately. Whether patch is the right level for a stricter parser is a call for the maintainers. I am not flagging it.
  • plugins/review/reference/config.md: the new wording is accurate. It still lists "an unknown key set twice" as a separate whole-file case, though that is now also the parse error. This is harmless redundancy.
  • Plugin copies: the 20 yaml-subset.awk copies in the diff are consistent with the root file as far as I read them. I spot-checked the other synced copies and did not diff every one.
  • Manifests: no plugin.json or marketplace.json change in this diff, so no manifest <field> lines apply.

Unverified: the PR's test results and its fresh-context review claims are author-claimed. I ran nothing.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 2edfc89f4c10252f58f863aded2b65bc8e690bda. The lanes clear this reason on their own; the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 2edfc89f4c10252f58f863aded2b65bc8e690bda.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 0edb332 Oct 29, 2026
49 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-10129-40837981116-1 branch October 29, 2026 09:45
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.

Converge the awk and mjs YAML grammars before setup-apply uses yaml-subset.mjs - part 2 of 4

0 participants