fix(ce-compound): quote YAML array items starting with reserved indicators (#613)
Some checks failed
CI / pr-title (push) Has been cancelled
CI / test (push) Has been cancelled
Release PR / release-pr (push) Has been cancelled
Release PR / publish-cli (push) Has been cancelled

Co-authored-by: Nathan Vale <hi@nathanvale.com>
This commit is contained in:
Trevin Chow
2026-04-20 14:01:11 -07:00
committed by GitHub
parent e1524287f7
commit d8436b9a3c
10 changed files with 313 additions and 3 deletions

View File

@@ -228,3 +228,4 @@ validation_rules:
- "date must match YYYY-MM-DD format"
- "rails_version, if provided, must match X.Y.Z format and only applies to bug-track docs"
- "tags should be lowercase and hyphen-separated"
- "Array-of-strings frontmatter items (symptoms, applies_when, tags, related_components, or any future array field) must be wrapped in double quotes when the value starts with a YAML reserved indicator (`, [, *, &, !, |, >, %, @, ?) or contains the substring `: ` — otherwise strict YAML parsers reject the file"

View File

@@ -89,3 +89,30 @@ Docs created before the track system may have `symptoms`/`root_cause`/`resolutio
7. Array fields must respect min/max item counts.
8. `date` must match `YYYY-MM-DD`.
9. `rails_version`, if present, must match `X.Y.Z` and only applies to bug-track docs.
## YAML Safety Rules
Strict YAML 1.2 parsers (`yq`, `js-yaml` strict, PyYAML) reject array items
that start with a reserved indicator character as unquoted scalars. When
writing items for any array-of-strings field (`symptoms`, `applies_when`,
`tags`, `related_components`, or any future array field), wrap the value in
double quotes if it starts with any of:
`` ` ``, `[`, `*`, `&`, `!`, `|`, `>`, `%`, `@`, `?`
Also quote if the value contains the substring `": "` — that punctuation
confuses flow-style parsers.
Example — before (breaks strict YAML):
symptoms:
- `sudo dscacheutil -flushcache` does not restore in-container mDNS
Example — after (parses cleanly):
symptoms:
- "`sudo dscacheutil -flushcache` does not restore in-container mDNS"
This rule applies to all array-of-strings frontmatter fields. Scalar string
fields like `description:` have their own quoting rules (see plugin
`AGENTS.md` under "YAML Frontmatter").