Skip to content

Add comprehensive documentation and catalog reference validation#5

Merged
michaeljgrimm merged 4 commits into
mainfrom
claude/admiring-hopper-dqbapc
Jun 9, 2026
Merged

Add comprehensive documentation and catalog reference validation#5
michaeljgrimm merged 4 commits into
mainfrom
claude/admiring-hopper-dqbapc

Conversation

@michaeljgrimm

Copy link
Copy Markdown
Contributor

Summary

This PR adds extensive documentation for the OPF format and implements catalog reference validation with warnings. It introduces three new documentation files explaining how OPF works, how design resolution works, and provides a complete technical example. The validator now checks catalog references (narratives, themes, color schemes, font schemes, chart types) and emits warnings for unknown IDs while maintaining the principle that unknown references never cause validation to fail.

Key Changes

Documentation

  • Added docs/how-opf-works.md: Comprehensive conceptual guide covering the document model, three content shapes (root payload, blocks, regions), layouts as hints, narrative beats, catalog resolution, and validation philosophy
  • Added docs/design-resolution.md: Explicit algorithm for design precedence across slide, deck, theme, and engine defaults with worked examples
  • Added spec/README.md: Guide to the spec directory structure and how to consume canonical schemas and catalogs
  • Added examples/technical/full-feature-tour.opf.json: Complete technical fixture exercising all major schema surfaces
  • Updated docs/content-payloads.md with detailed region key documentation and visual grid examples
  • Updated docs/examples.md and examples/technical/README.md to reference the new full-feature tour
  • Added llms.txt: Quick reference for LLM context

Validator Enhancements

  • Extended ValidationResult interface to include warnings array (separate from errors)
  • Implemented presentationReferenceWarnings() to check catalog references in presentations:
    • Validates narrative, theme, colorScheme, fontScheme references at deck and slide levels
    • Checks chart type references in all content payloads and regions
    • Respects inline catalog records and custom sources as legitimate id sources
  • Implemented catalogCrossLinkWarnings() to validate cross-references within catalog records (e.g., audience's recommendedNarratives field)
  • Added unknownIdWarning() helper that checks against bundled catalog IDs and respects inline/custom sources
  • Unknown catalog IDs now emit warnings instead of errors, maintaining the principle that references never invalidate documents

Code Generation

  • Added generateCatalogIds() function to generate lightweight id-only view of bundled catalogs for validator use
  • Updated mediaTypeForSpecFile() to handle .md files as text/markdown

Catalog Corrections

  • Fixed spec/catalogs/audiences/engineering-team.json: changed engineering-update to status-update in recommendedNarratives
  • Fixed spec/catalogs/tones/casual.json: changed all-hands to focus in recommendedNarratives
  • Fixed spec/catalogs/tones/conversational.json: changed all-hands to focus in recommendedNarratives
  • Fixed spec/catalogs/tones/technical.json: changed engineering-update to status-update in recommendedNarratives

Tests

  • Added comprehensive smoke tests validating:
    • Unknown catalog IDs produce warnings but don't fail validation
    • Inline catalog records and custom sources suppress warnings for their ids
    • Object-form narratives with unknown ids are treated as custom inline definitions
    • Design references at deck and slide levels are checked
    • Chart type references in regions are validated
    • Cross-links within bundled catalog records have no broken references
    • All examples validate with zero warnings

Notable Implementation Details

  • Warnings are completely separate from errors; valid is never affected by unknown catalog IDs
  • The validator respects the document's own catalogs.<kind>.records[] and catalogs.<kind>.source declarations, treating them as legitimate sources for ids
  • Object-form references with unknown ids (e.g., { "id": "my-custom-narrative", ... }) are treated as fully custom inline definitions, not broken references
  • Design resolution warnings check all three levels: deck design, slide design, and nested theme overrides
  • Catalog cross-link validation ensures bundled records don't reference unknown ids in their recommendation fields

https://claude.ai/code/session_01NBXPAPfAVXS9R83Nny7Qpg

claude added 4 commits June 9, 2026 21:02
- Add docs/how-opf-works.md, a conceptual introduction covering the
  document model, the three content shapes, layouts-as-hints, narrative
  beats, catalog resolution order, and the validation philosophy.
- Add docs/design-resolution.md, stating the design precedence chain
  (slide design -> deck design -> resolved theme -> engine defaults)
  as an explicit algorithm with worked examples.
- Add a warnings array to ValidationResult. The validator now warns,
  never errors, on unknown bare catalog ids (narrative, design.theme,
  design.colorScheme, design.fontScheme, chart type) and on broken
  recommendedNarratives/recommendedTones cross-links in audience,
  purpose, and tone records. Inline catalogs.<kind>.records and custom
  catalogs.<kind>.source exempt a document from these checks.
- Generate a lightweight src/generated/catalog-ids.ts so the validator
  checks ids without bundling full catalog records.
- Fix four broken catalog cross-links surfaced by the new check:
  engineering-update -> status-update, all-hands -> focus.
- Enforce zero warnings for bundled examples and catalog cross-links in
  the smoke test.
- Add spec/README.md orienting readers to the spec directory, including
  what the optional openapi.yaml reference contract is for.
- Serve .md spec files with a text/markdown media type.

https://claude.ai/code/session_01NBXPAPfAVXS9R83Nny7Qpg
- Expand docs/how-opf-works.md with a document-anatomy diagram, the 3x3
  region-grid diagram, a catalog-resolution flow diagram, runnable
  examples for every content shape, a narrative-beats example, an
  inline-catalog example, and a complete small QBR deck.
- Add precedence-stack and base-plus-overrides diagrams to
  docs/design-resolution.md, using the real cool-horizon slot values.
- Add the region-grid cheat sheet to docs/content-payloads.md.
- Add examples/technical/full-feature-tour.opf.json: one fixture
  exercising every major schema surface (intent metadata, organizations
  and speakers, narrative beat overrides, design with slide overrides,
  assets, inline catalog records, all ten content payload kinds, blocks,
  regions, hidden slides, extensions). Referenced from the examples
  guides.
- Expand spec/README.md with consumption snippets (package imports, raw
  file addressing, any-language validation) and a stability note.
- Document the validator warnings channel in both READMEs.
- Smoke test now validates every presentation-shaped JSON example
  embedded in the shipped docs, so doc examples cannot drift from the
  schema.

https://claude.ai/code/session_01NBXPAPfAVXS9R83Nny7Qpg
- Extrapolate the region grid into span-composition diagrams (sidebar +
  main, headline band + body, and their combination) in
  docs/how-opf-works.md and docs/content-payloads.md, each tied to the
  JSON that produces it.
- Add a 'Start in three steps' section to the README: install, author
  and validate a deck, build on the catalogs and roadmap.
- Frame the how-opf-works intro and closing around the author: you own
  the story, the format keeps it diffable; commit a deck and read the
  diff.
- Promote the misplaced 'Expected Usage' heading out of the Toolkit
  roadmap section to a top-level 'Usage' section.
- Add a root llms.txt index pointing agents at the docs, schemas,
  catalogs, and the full-feature example with a one-paragraph authoring
  rule of thumb.

https://claude.ai/code/session_01NBXPAPfAVXS9R83Nny7Qpg
@michaeljgrimm michaeljgrimm merged commit 601bfd1 into main Jun 9, 2026
2 checks passed
@michaeljgrimm michaeljgrimm deleted the claude/admiring-hopper-dqbapc branch June 9, 2026 22:14
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.

2 participants