Skip to content

Commit fa0fb58

Browse files
dmealingclaude
andcommitted
feat(render-conformance): expand corpus to 14 fixtures — Mustache divergent surfaces
Original 4 fixtures (csv-injection, email, prompt, spreadsheet) only exercised escaping + a tiny partial. Add 10 fixtures targeting known cross-implementation divergent surfaces of the 4 Mustache engines we use (mustache.js / Stubble / mustache.java / hand-rolled Python interpreter) — the gate that defends prompt-cache stability. New fixtures: - render-inverted-section ^x over empty array, empty string, false, null, missing - render-standalone-tag-stripping block tags (#,/,!,^,>) on their own line strip trailing newline - render-dotted-path-lookup {{user.profile.name}} walks nested objects - render-parent-context-fallthrough name resolves from enclosing context if not in inner section - render-raw-html-bypass {{{x}}} and {{&x}} bypass format escaper - render-nested-partials partial referencing partial 2 levels deep - render-unicode-multibyte emoji + CJK + combining marks preserved byte-for-byte - render-empty-array-falsiness empty array renders nothing; non-empty iterates - render-falsy-values false/null/empty-string/empty-array are falsy in sections - render-trailing-newline-preservation template w/o trailing newline → output w/o trailing newline Cross-port status (all 4 ports' render-conformance gates green at 14/14): - TS (mustache.js): all 10 new fixtures match expected.txt - C# (Stubble): all 10 new fixtures match expected.txt - Python (hand): all 10 new fixtures match expected.txt - Java (mustache.java): 9/10 match; 1 documented drift in KNOWN_DRIFT.md — render-standalone-tag-stripping: mustache.java does NOT apply the standalone-line strip rule to {{! comment }} tags (TS / C# / Python all do). One extra blank line after the comment block. Other standalone strips (section, partial) work. Within-Java snapshot gate stays green; cross-port report flags it; KNOWN_DRIFT.md updated. Verification: - TS `bun test packages/render/test/render-conformance.test.ts` 14/14 pass - C# `dotnet test ... --filter FullyQualifiedName~RenderConformance` 14/14 pass - Java `mvn -pl render test -Dtest=RenderSnapshotTest` 14/14 pass - Py `uv run pytest tests/render/test_render_conformance.py -q` 14/14 pass - No regressions in any port's broader render test suite (TS 103/103, C# 98/98, Java 99/99, Py 81/81). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 695d1f3 commit fa0fb58

54 files changed

Lines changed: 289 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: Ada
2+
email: ada@example.test
3+
role: admin
4+
missing-leaf: []
5+
missing-mid: []
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "format": "text", "note": "dotted-path interpolation {{user.profile.name}} walks nested objects" }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"user": {
3+
"profile": {
4+
"name": "Ada",
5+
"email": "ada@example.test"
6+
},
7+
"roles": {
8+
"primary": "admin"
9+
}
10+
},
11+
"missing": {}
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: {{user.profile.name}}
2+
email: {{user.profile.email}}
3+
role: {{user.roles.primary}}
4+
missing-leaf: [{{user.profile.missing}}]
5+
missing-mid: [{{user.unknown.name}}]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filled:
2+
- one
3+
- two
4+
empty:
5+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "format": "text", "note": "empty array section renders nothing; non-empty array renders body per item" }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"filled": ["one", "two"],
3+
"empty": []
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
filled:
2+
{{#filled}}
3+
- {{.}}
4+
{{/filled}}
5+
empty:
6+
{{#empty}}
7+
- {{.}}
8+
{{/empty}}
9+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
true-flag: [body]
2+
false-flag: []
3+
null-value: []
4+
empty-string: []
5+
non-empty-string: [body]
6+
empty-array: []
7+
non-empty-array: [1;2;]
8+
object-with-name: [Ada]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "format": "text", "note": "section truthiness — false, null, empty string, empty array are falsy; non-empty arrays iterate; non-empty objects render once" }

0 commit comments

Comments
 (0)