Skip to content

fix: render QA task as strict XML - #187

Open
randlee wants to merge 1 commit into
codex/report-json-escapingfrom
codex/qa-template-cdata
Open

randlee wants to merge 1 commit into
codex/report-json-escapingfrom
codex/qa-template-cdata

Conversation

@randlee

@randlee randlee commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • remove the blanket {% autoescape false %} workaround from qa-template.xml.j2
  • keep normal XML autoescaping for attributes
  • wrap readable prompt text in CDATA
  • use MiniJinja's explicit string | cdata_escape boundary
  • add strict-render, adversarial XML, typed-value, legacy-string, and no-sc-compose fallback coverage

Scope

This is a surgical structural migration. Frontmatter/schema/defaults are unchanged except version 1.1.0 → 1.2.0; prompt prose and conditionals are preserved. No repository-specific language was introduced or rewritten.

Other XML template families remain separate work and should be migrated in independent reviewable layers.

sc-compose / MiniJinja practice

The .xml.j2 template keeps filename-aware autoescaping enabled. Attributes use the normal XML formatter. CDATA text uses string | cdata_escape: string preserves existing strings without JSON quote wrapping and coerces structured/numeric values; cdata_escape safely splits ]]> and marks only that boundary safe. This avoids blanket autoescape disabling, handwritten entities, and macro-related strict-validation diagnostics.

Validation

  • final fresh Luna review: PASS with no findings
  • sc-compose render --strict --check-render --json: zero error diagnostics
  • realistic legacy strings remain verbatim
  • typed numeric/list/map fields round-trip
  • quotes, backslashes, newlines, < > &, Unicode, repeated ]]>
  • ElementTree and xmllint strict parsing
  • focused module: 16 tests / 23 subtests PASS with real sc-compose
  • same focused module PASS through the no-sc-compose Jinja fallback
  • just lint PASS
  • just test PASS
  • git diff --check

Stack

@randlee
randlee added this pull request to stack #186 September 20, 2026 22:41

This branch has not been deployed

No deployments
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