Lesson frontmatter is a strict core plus two open maps (when, meta)
Context#
Designing lesson frontmatter for rkb.
Decision#
Lesson frontmatter is a small strict core plus two open maps. The core carries schema: 1 for later rkb migrate, and an unknown top-level key fails lint to catch typos. when is an open condition map: any key is allowed, all keys must match (AND), a list means any-of, and a version range uses Spack syntax such as 1.12:1.14.2. meta is free for user data that rkb stores and never acts on. A when key with no fact source gives unknown, never yes, so a new key is safe on day one. Free-text environment notes go in a body ## Environment section.
Why#
Mature systems (Hugo params, Kubernetes labels, Backstage annotations) keep the core strict and make conditions open, so new keys need no change to old files.
Rejected options#
valid_from/invalid_from dates (git and version ranges already record this), a JSON Schema file (the Rust types are the schema), and Dataview-style key:: value fields in the body (hard to parse).
Also found by searching
- unknown top-level key fails lint
- when map keys AND any-of list version range
- meta free user data in frontmatter
- when key with no fact source gives unknown