Skip to content

fix(ce-compound): quote YAML array items starting with reserved indicators#613

Merged
tmchow merged 2 commits intomainfrom
tmchow/fix-pr-607
Apr 20, 2026
Merged

fix(ce-compound): quote YAML array items starting with reserved indicators#613
tmchow merged 2 commits intomainfrom
tmchow/fix-pr-607

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 20, 2026

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-compound emits invalid YAML frontmatter when an array item in symptoms:, 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-yaml strict, 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):

Surface Change
references/schema.yaml Added a validation_rules entry for array-item quoting
references/yaml-schema.md New "## YAML Safety Rules" section with indicator list, ": " trap, and before/after example
assets/resolution-template.md Added a preamble comment above each frontmatter block pointing to the rule
ce-compound/SKILL.md One-line pointer at Phase 2 step 5 (Full mode) and step 3 (Lightweight mode)
ce-compound-refresh/SKILL.md Pointer to the Replace-flow subagent dispatch
tests/compound-support-files.test.ts 8 regression tests asserting rule presence across all 4 support files and both SKILL.md files

Commit 2 (addresses Codex review on #607):

Codex flagged that the ce-compound/SKILL.md assertion counted all yaml-schema.md mentions 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:

  • Anchors the ce-compound/SKILL.md assertions to the distinctive write-path phrase ("YAML-safety quoting rule for array items"), which appears only at the two write-path pointers.
  • Additionally verifies each pointer sits adjacent to the "YAML frontmatter" step that actually writes the file, so a pointer cannot drift away from its write context and still pass.
  • Scopes the ce-compound-refresh/SKILL.md assertion 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

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.

nathanvale and others added 2 commits April 20, 2026 13:09
…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]>
@tmchow tmchow merged commit d8436b9 into main Apr 20, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 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.

/ce-compound emits invalid YAML frontmatter when symptoms[] item starts with backtick

2 participants