Skip to content

feat(templates): add per-template example inputs, render-all validation test, and template render -d #55

Closed

Description

@ghchinoy

Problem

  1. Only a small subset of shipped .json.tmpl policy templates in templates/ are rendered in unit tests (pkg/template/mm_render_test.go), and there is no sidecar set of canonical synthetic inputs (typical, edge, minimal) or schema-level contract check verifying every template against structured_server.py's parse_schema invariants (unique non-empty question IDs, non-empty instructions, valid question types, choice option count limits, and acyclic depends_on / ask_if dependencies).
  2. dgem template render declares -d / --data (cmd/template.go), but templateRenderCmd ignores renderDataFile.
  3. discoverTemplates in cmd/serve.go uses a naive regex that can misread .field substrings inside escaped string literals (for example in secops_iam_change_audit.json.tmpl), marks text-only multimodal/call_quality_audio.json.tmpl as image-multimodal, and leaves several template variables empty in defaultSampleVars.

Proposed Solution

  1. Add companion templates/**/<name>.examples.json files (typical, edge, minimal synthetic inputs + optional unambiguous expected_answers) for every shipped .json.tmpl policy, along with minimal fallback defaults on parameterized templates so {} renders cleanly.
  2. Add pkg/template.ValidateRenderedPayload and TestAllShippedTemplatesRenderAndValidate to render and validate all shipped templates across every example and sample_vars round-trip.
  3. Wire -d / --data in dgem template render, fix extractTemplateVars and defaultSampleVars in cmd/serve.go, and expose examples on GET /api/templates.

Activity

  1. added a commit that references this issue on Nov 9, 2026
    527e287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions