Repository navigation
fix(render): a variable not on the payload raises at render time in every generated helper - #520
Merged
Merged
Conversation
…very generated helper
A prompt or output helper rendered `Hi {{nmae}}` as `Hi ` when the payload declares
`name`. The build-time gate already caught it; the gap was text served after codegen.
- TypeScript promptRender() handle and its reference copy pass the payload field tree.
- Python helper passes verify on Mustache bodies too (it was Jinja only).
- Java Renderer now reads RenderRequest.verify, which it accepted and ignored, so the
Java and Kotlin helpers raise.
- C# and the TypeScript render-helper already raised; pinned by the new corpus case.
- Shared corpus fixtures/template-output-render-conformance/runtime-drift/ and a
regression test per port; stale comments, docs and CHANGELOG updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
verifyon every call. This covers the TypeScriptpromptRender()handle andrender-helper, the Python helper on Mustache and Jinja bodies, and the Java and Kotlin helpers. A template naming a variable absent from the payload ({{nmae}}forname) raisesERR_VAR_NOT_ON_PAYLOADinstead of rendering empty. Rawrender()calls with no declared payload keep the engine default.RendererrunsVerify.checkon the resolved body whenverifyis set, ignoring the warning-level required-slot-unused code, and throwsRenderException. The C#Rendererheader comment now states the guard is wired.fixtures/template-output-render-conformance/runtime-drift/fixture and per-port tests that pin the behavior in TypeScript, Python, Java, Kotlin and C#. UpdatesCHANGELOG.mdanddocs/features/templates-and-payloads.mdto document the behavior change. Regeneratedexamples/showcaseandtemplate-prompt-simpleoutputs pick up the newverifyargument.Validation
Risk Assessment
✅ Low: Change closes the silent-render gap in TS, Python and Java/Kotlin with tests that execute real helpers against a shared drift corpus. The showcase regen hash matches, and I found no remaining silent path.
Testing
The drift tests pass in all five ports. For TS I also drove the committed showcase helper live: a clean template renders "Hi Ada (active)" and a template using
{{nmae}}raisesrender verify failed: ERR_VAR_NOT_ON_PAYLOAD (nmae). The showcase regen--checkreports the committed output fresh. The fullscripts/ci-local.shrun finished with exit 1 because one test in the gates lane timed out at 5 s under parallel load; every other lane passed, and that test passes when run alone. I treat it as a load-induced flake, not a regression, but the full suite did not finish green. Rawrender()with no declared payload still renders silently; it has no payload field tree to verify against, so I treated it as out of scope. Temporary files are removed and the worktree is clean.promptRender()helper raises on a variable not on the payload and renders a clean template (real showcase output, run under bun)verify:in the helper andruntime-drift.test.tsshows the helper raising on a drifted templatebun test test/runtime-drift.test.ts test/fr004-verify-demo.test.tsin codegen-ts: 4 passERR_VAR_NOT_ON_PAYLOAD (nmae)for the template.output and template.prompt helperstest_render_helper_runtime_drift.pyand the render-helper generator and conformance tests: 33 passRendererraise on drift for the output and prompt helpersGeneratedRenderHelperConformanceTest7 pass;rendermodule Renderer tests 50 passKotlinRenderHelperConformanceTest7 passdotnet test --filter RenderHelperConformanceTests: 8 passbun scripts/regen-showcase.ts --check: 'showcase output is fresh'scripts/ci-local.sh, full parity)scripts/site/reference.test.tsin the gates lane, which passes (20 pass, 0 fail) when run aloneEvidence: TS showcase helper live run (clean renders, drifted raises)
clean : "Hi Ada (active)" drifted RAISED: render verify failed: ERR_VAR_NOT_ON_PAYLOAD (nmae)Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/typescript/packages/codegen-ts/src/generators/prompt-render-file.ts:51- The change addsverify:to the TSpromptRender()handle (prompt-render-file.ts:51 and the reference copy). It updates only thefixtures/conformance/template-prompt-simpleexpected output. The committed showcase outputexamples/showcase/generated/ts/prompts.tsstill hasrender({ ref: "subscriber/blurb", payload, format: "text", provider })with noverify.scripts/regen-showcase.ts --checkregenerates pristine and byte-compares, andgate_showcase_all_portsinscripts/ci-local.sh(also the release preflight) runs it. That gate will fail on this branch. The public site presents that file as realmeta genoutput. Fix: runbun run --filter '*' build, thenbun scripts/regen-showcase.ts, and commit the regeneratedprompts.ts. Check whether.hashes.jsonandexamples/showcase/site-payload.jsonchange with it. No other committed generated outputs I found are affected: the Python, Java, Kotlin and C# showcase trees contain no render helpers, andexamples/advanced-modelingalready used the render-helper path.server/typescript/packages/codegen-ts/test/runtime-drift.test.ts:6- Fixed a stale test comment: it said the driftedtemplates/was the parent corpus's directory. It now says the drifted text is in the runtime-drift corpus's owntemplates/and the clean text is in the parent corpus'stemplates/. Comment only, no behavior change.🔧 Fix applied.
1 info still open:
server/typescript/packages/codegen-ts/test/runtime-drift.test.ts:6- Fixed a stale test comment: it said the driftedtemplates/was the parent corpus's directory. It now says the drifted text is in the runtime-drift corpus's owntemplates/and the clean text is in the parent corpus'stemplates/. Comment only, no behavior change.scripts/site/reference.test.ts- Test 'build-site-reference --check > it names the command that fixes it' timed out at its 5000 ms limit during the full parallelscripts/ci-local.shrun, which failed the 'site payload is true' gate and made the run exit 1. Run alone, the file passes (20 pass, 0 fail, 14 s). This looks like a load-induced flake unrelated to the change, but the 5 s limit is tight under parallel load.promptRender()helper raises on a variable not on the payload and renders a clean template (real showcase output, run under bun)verify:in the helper andruntime-drift.test.tsshows the helper raising on a drifted templatebun test test/runtime-drift.test.ts test/fr004-verify-demo.test.tsin codegen-ts: 4 passERR_VAR_NOT_ON_PAYLOAD (nmae)for the template.output and template.prompt helperstest_render_helper_runtime_drift.pyand the render-helper generator and conformance tests: 33 passRendererraise on drift for the output and prompt helpersGeneratedRenderHelperConformanceTest7 pass;rendermodule Renderer tests 50 passKotlinRenderHelperConformanceTest7 passdotnet test --filter RenderHelperConformanceTests: 8 passbun scripts/regen-showcase.ts --check: 'showcase output is fresh'scripts/ci-local.sh, full parity)scripts/site/reference.test.tsin the gates lane, which passes (20 pass, 0 fail) when run alonescripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun test test/runtime-drift.test.ts test/fr004-verify-demo.test.tsin codegen-ts: 4 pass.venv/bin/python -m pytest tests/codegen/test_render_helper_runtime_drift.py test_render_helper_generator.py test_render_helper_conformance.py: 33 passmvn -o -pl render,codegen-spring,codegen-kotlin testwith the Renderer,GeneratedRenderHelperConformanceTestandKotlinRenderHelperConformanceTestselectors: 50, 7 and 7 passdotnet test MetaObjects.Codegen.Tests --filter FullyQualifiedName~RenderHelperConformanceTests: 8 passLive run of the committed showcaseprompts.tshelper (realmeta genoutput) under bun: clean template renders, a{{nmae}}template raisesbun scripts/regen-showcase.ts --check: showcase output fresh in ts, python, csharp, sql and jvmscripts/ci-local.sh(full parity): cube, python, java, ts-integ, java-integ, ts, csharp, showcase, kotlin-integ and mutation lanes pass; the gates lane has one failure, a 5 s timeout inscripts/site/reference.test.ts; exit 1bun test scripts/site/reference.test.tsrun alone: 20 pass, 0 failBaselinescripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainshad already passed✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Gate runs: 1 (one review fix round for the committed showcase output).