Skip to content

fix(yaml-subset): keep empty sequence items as null and honor quoted-key escapes - #10325

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-8678-40372449056-1
Oct 26, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #8678

Summary

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

lib/yaml-subset.mjs no longer nests an empty sequence item's same-indent siblings under it: a:\n -\n - b now parses to {"a":[null,"b"]}, while a deeper-indented line still belongs to the empty item. Quoted keys now find their closing quote with unquote()'s rules (a doubled '' in single quotes, a backslash escape in double quotes), so 'guest''s' and "a"b" parse as the keys guest's and a"b, matching the awk reading pinned in lib/setup-apply.test.sh:379-380. The four plugin copies were regenerated, and each carrying plugin got a patch changelog fragment.

Not verified

  • node --test lib/yaml-subset.test.mjs, lib/config-cascade.test.mjs and bash lib/setup-apply.test.sh were not run: this lane's Bash runs only the named wrappers, and check-affected runs without --tests. The new and changed cases were traced by hand, and the reviewer traced them independently. Left to
  • scripts/new-changelog-fragment.sh refused to run on the detached HEAD (it names fragments after the branch), so the four fragments were written by hand in its format; check-changelog-fragments validates them.
  • Out of scope, not changed: plugins/code-metrics/scripts/yaml_subset.py, which the mjs header calls its grammar source, still has both old behaviors (content.find(quote, 1) at :190, and _nested for empty items). The Python and mjs parsers now read these inputs differently; #8677 tracks converging the

Fix

  • lib/yaml-subset.mjs: sequence() pushes null for an empty item unless the next line is indented deeper; new closingQuote() helper scans a quoted key with unquote()'s escape rules and is used by splitKey(); a sequence item whose opening quote never closes skips the key scan and goes to scalar(), so `-
  • lib/yaml-subset.test.mjs: new cases for the empty item with a same-indent sibling (both orders), an empty item with deeper children, a single-quoted key holding '', a double-quoted key holding ", two unterminated-quoted-key errors, and quoted sequence scalars; the old "200000 empty items at one ind
  • plugins/corrections/scripts/lib/yaml-subset.mjs: regenerated by scripts/sync-shared-copies.sh
  • plugins/domain-driven-design/scripts/lib/yaml-subset.mjs: regenerated by scripts/sync-shared-copies.sh
  • plugins/user-experience/scripts/lib/yaml-subset.mjs: regenerated by scripts/sync-shared-copies.sh
  • plugins/user-interface/scripts/lib/yaml-subset.mjs: regenerated by scripts/sync-shared-copies.sh
  • .changes/corrections/fix-8678-yaml-subset-escapes-4b7e21c9.md: patch fragment (Fixed)
  • .changes/domain-driven-design/fix-8678-yaml-subset-escapes-a93d0f56.md: patch fragment (Fixed)
  • .changes/user-experience/fix-8678-yaml-subset-escapes-1e5c8d02.md: patch fragment (Fixed)
  • .changes/user-interface/fix-8678-yaml-subset-escapes-7f2a6b38.md: patch fragment (Fixed)

Verification

The runner ran each check from the base copy against 835edc9:

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

The run reports:

  • .lane/verify/bin/sync-shared-copies: exit 0, regenerated the four yaml-subset.mjs copies listed in scripts/shared-copies.txt (run again after the review fix)
  • .lane/checks/bin/check-changelog-fragments: all 11 fragments under .changes/ valid
  • .lane/checks/bin/check-affected: first run failed markdownlint MD038 (a - code span in the fragments); after rewording, 9 passed, 7 skipped, 0 failed over 10 changed files
  • .lane/verify/bin/cant-fail-scan --file lib/yaml-subset.test.mjs --check: PASS, 25 test blocks parsed, no gating findings
  • fresh-context review subagent over the whole diff: hand-traced every new test (including the MAX_DEPTH line-66 arithmetic) as passing and found one regression, a quoted sequence scalar such as - "x\" throwing "unterminated quoted key"; fixed in sequence() and pinned by a new test
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40372449056

Left out: the items under Not verified.

Related

#8678

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

Copy link
Copy Markdown
Contributor

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

No security issues found in this pull request.

The change is a bug fix to the yaml-subset.mjs parser. It reads an empty - item as null when the next line sits at the same indent. It also scans quoted keys with unquote()'s escape rules. The diff includes the four regenerated plugin copies, tests and changelog fragments.

  • Trusted paths and trust controls: none of the 10 changed files match a trusted-path glob or touch a trust control. There are no workflow, action, merge-hold, pr-pipeline.yaml or manifest changes, so no manifest <field> lines apply.
  • Parser safety:
    • closingQuote() is a single linear scan, so it adds no ReDoS or quadratic surface.
    • The empty-item path is now iterative, so 200000 sibling - lines no longer nest. The MAX_DEPTH guard still applies to genuinely indented nesting, and the new test covers it.
    • The unterminated-quote path still raises YamlSubsetError with a line number, or hands the text to scalar(), which rejects it.
    • Keys still go through the existing __proto__-safe own-data-key handling.
  • Behaviour shift: the change only affects parse results for an empty sequence item followed by a same-indent item, and for quoted keys that hold an escaped quote. Before the fix, those inputs either nested the following items or threw. The parser is used for plugin config and convention reading, but I found no consumer that makes a trust decision from those inputs.
  • Instruction-surface deletions: none. No rule, guardrail or allowlist is removed.
  • Cost: none. The change has no billing effect.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 835edc98899384e9c0414f0c447c19eab6c6cced: 0 finding(s), 0 as inline comments.

No findings. I read the whole diff, the PR context and the full head lib/yaml-subset.mjs.

Closing issue #8678 criteria

  • Empty item is null: sequence() now calls nested() only when the next line is indented deeper than the dash, which gives {"a":[null,"b"]} for a:\n -\n - b. A sequence at the parent's indent (a:\n- \n- b) takes the same path. The tests cover both orders, a deeper child under an empty item, and 200000 flat empty items. The old test that expected those 200000 items to nest and fail at line 66 was replaced. The new 66-level indented chain still reaches the depth limit at line 66. I traced the MAX_DEPTH arithmetic by hand: nested() runs at depth 0 when it reaches line 2 and at depth 64 when it reaches line 66.
  • Quoted keys use unquote()'s rules: closingQuote() skips a doubled '' in single quotes and a backslash escape in double quotes. 'guest''s' gives the key guest's and "a\"b" gives a"b. Tests pin both. The two unterminated cases ('it''s: 1 and "a\": 1) still throw "unterminated quoted key", and tests pin those too.
  • Tests exist: every criterion has a test that fails if it breaks.
  • Copies are in sync: the four plugin copies are identical in the diff to the lib/ source, hunk for hunk. The four patch fragments are well formed.

What I did not verify

I had no shell, so I did not run node --test, lib/setup-apply.test.sh or any other check. The PR's own claims that checks passed are author-claimed and unverified by me. I hand-traced the new and changed cases and they hold.

Notes, not counted as findings

  • A scalar item - "x\" now parses to x\ without an error, while the quoted key "a\": 1 throws. The first comes from unquote() not checking whether the final quote is escaped. That behavior is pre-existing for values, and the new test pins it. If the author wants strict rejection later, it belongs with Converge the awk and mjs YAML grammars before setup-apply uses yaml-subset.mjs #8677.
  • plugins/code-metrics/scripts/yaml_subset.py still has both old behaviors, so the Python and .mjs parsers now read these two inputs differently. The PR says Converge the awk and mjs YAML grammars before setup-apply uses yaml-subset.mjs #8677 tracks this, and it is out of scope here.
  • No manifests changed, so no manifest <field> lines apply.
  • No paved-path rows or path-scoped rules were checked beyond the diff.
  • The PR body contains no embedded instructions.
  • Spend: this change adds no cost and no billing change.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 835edc98899384e9c0414f0c447c19eab6c6cced.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 36fa761 Oct 26, 2026
42 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-8678-40372449056-1 branch October 26, 2026 19:13
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.

yaml-subset.mjs: nested empty sequence items and quoted-key escapes

0 participants