fix(ce-compound): quote YAML array items starting with reserved indicators#613
Merged
fix(ce-compound): quote YAML array items starting with reserved indicators#613
Conversation
…ators Array items in frontmatter fields like `symptoms:` that start with a backtick or other YAML 1.2 reserved indicator (`, [, *, &, !, |, >, %, @, ?) or contain `: ` must be wrapped in double quotes — otherwise strict parsers (`yq`, `js-yaml` strict, PyYAML) reject the file. `ce-learnings-researcher`'s grep-first retrieval still matches, masking the problem until a structural consumer fails. Encode the rule in the support-file contract that every ce-compound and ce-compound-refresh subagent reads at write time: - Add a validation rule to `references/schema.yaml` - Add a "YAML Safety Rules" section to `references/yaml-schema.md` with indicator list, `: ` trap, and before/after example - Add preamble comments above each frontmatter block in `assets/resolution-template.md` - Add one-line pointers at the three SKILL.md spots that write or dispatch writes of frontmatter - Add 8 regression tests asserting the rule is present in every surface; mutation-tested by removing the rule and confirming failure Support-file edits are applied to both skill copies in the same commit to keep `tests/compound-support-files.test.ts` drift assertions green. Fixes #606. Co-Authored-By: Claude <[email protected]>
…ntext
The prior test counted all `yaml-schema.md` mentions in ce-compound/SKILL.md
and passed when the count was >= 2. Because the file already contains 4 such
mentions (support-file description, inputs list, Full-mode step 5,
Lightweight-mode step 3), dropping either of the two frontmatter-write
pointers still left 3 matches, silently defeating the regression guard.
Anchor the assertions to the distinctive write-path pointer phrase
("YAML-safety quoting rule for array items") and additionally verify each
pointer sits adjacent to the "YAML frontmatter" step that actually writes
the file. For ce-compound-refresh/SKILL.md, scope the pointer check to the
Replace Flow section so a drifted pointer is caught even if the phrase
still appears elsewhere in the doc.
Mutation-tested: removing the Lightweight-mode pointer fires the new
assertion. Full suite remains 889/889 passing.
Addresses Codex review feedback on #607.
Co-Authored-By: Nathan Vale <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #607 (original author @nathanvale). Nathan's work is preserved as-is in the first commit; the second commit addresses the Codex review.
Fixes #606 —
/ce-compoundemits invalid YAML frontmatter when an array item insymptoms:,applies_when:,tags:,related_components:(or any future array-of-strings field) starts with a backtick or other YAML 1.2 reserved indicator. Strict parsers (yq,js-yamlstrict, PyYAML) reject the file;ce-learnings-researcher's grep-first retrieval still matches on substrings, so users silently accumulate unparseable files until a structural consumer fails.Changes
Commit 1 (Nathan Vale, unchanged from #607):
references/schema.yamlvalidation_rulesentry for array-item quotingreferences/yaml-schema.md": "trap, and before/after exampleassets/resolution-template.mdce-compound/SKILL.mdce-compound-refresh/SKILL.mdtests/compound-support-files.test.tsSKILL.mdfilesCommit 2 (addresses Codex review on #607):
Codex flagged that the
ce-compound/SKILL.mdassertion counted allyaml-schema.mdmentions and passed when the count was>= 2. Because the file already contains 4 such mentions (support-file description, inputs list, plus the two write-path pointers), dropping either of the two frontmatter-write pointers still left 3 matches — silently defeating the regression guard.This commit:
ce-compound/SKILL.mdassertions to the distinctive write-path phrase ("YAML-safety quoting rule for array items"), which appears only at the two write-path pointers.ce-compound-refresh/SKILL.mdassertion to the "### Replace Flow" section, so a drifted or deleted pointer is caught even if the phrase survives elsewhere.Mutation test: removing the Lightweight-mode pointer fires the new assertion as expected. The original PR's mutation scenarios still fire.
Test plan
bun test tests/compound-support-files.test.ts— 11/11 passbun test tests/frontmatter.test.ts— 192/192 passresolve-base.shflake called out in fix(ce-compound): quote YAML array items starting with reserved indicators #607 is no longer failing on this checkout)Credit
Nathan Vale (@nathanvale) did the substantive work — investigation, rule encoding, support-file edits, and the original regression test scaffolding. Both commits credit him via
Co-Authored-By.