Skip to content

fix(run): read frontmatter without YAML 1.1 booleans or non-text keys (SR-2f) - #99

Merged
jothimani-rajendran merged 1 commit into
mainfrom
sr-2f-frontmatter-yaml11
Oct 25, 2026
Merged

jothimani-rajendran merged 1 commit into
mainfrom
sr-2f-frontmatter-yaml11

Conversation

@jothimani-rajendran

@jothimani-rajendran jothimani-rajendran commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: yaml.safe_load follows YAML 1.1, so a frontmatter key no (also yes/on/off/y/n) was read as a bool, and true/false/null keys as bool/None. The round-trip property failed on meta={'no': 'A'}.
  • Fix (src/context_report/run/evalcases.py): a SafeLoader subclass whose mapping keys stay the text written and whose booleans are only true/false, so the 1.1 words stay text as keys and values.
  • Test (tests/test_properties.py): @example per kind (no, yes, on, off, y/n, true/false, null as keys; the 1.1 words as values). The property is unchanged except it now also compares values (edge spaces stripped, as YAML plain scalars do).
  • The pinned examples fail on main (8 explicit examples fail) and pass here.
  • Overlap with Harden manifest endpoints, hook paths, cleanup, linked dirs and regex graders #98 (sr-2c-hardening): that branch does not touch these files; git merge-tree of the two heads reports no conflicts.

Value true/false/null stay YAML 1.2 bool/null by design.

yaml.safe_load read a key such as `no` as False, so the frontmatter
round-trip property failed on meta {'no': 'A'}. Load with a SafeLoader
subclass whose mapping keys stay the text written and whose booleans are
only true/false, so yes/no/on/off/y/n stay text as keys and values.

Pin one @example per kind in tests/test_properties.py.

Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review October 25, 2026 14:12
@jothimani-rajendran
jothimani-rajendran merged commit 5d7fdc6 into main Oct 25, 2026
15 checks passed
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.

1 participant