Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions fixtures/output-prompt-conformance/json-deep-mixed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# json-deep-mixed

A large, realistic **request VO** four levels deep that mixes every nesting shape
in one spec — the cross-port gate for deep prompt-payload rendering:

- **singular nested objects** 4 levels deep: `payload.author.contact.{email,verified}`
- an **array of objects**: `payload.sections[]` with `heading` + `priority`
- a nested **enum** (`priority`: `LOW | HIGH`) and a **boolean** (`verified`)
- an **optional** field carrying an example (`payload.summary`) so the whole thing
still round-trips.

Exercises: guide dotted-path recursion at depth (`payload.author.contact.email`,
`payload.sections[].priority`), indentation at four levels, unquoted boolean
example (`true`), enum `one of …` (guide) / `LOW | HIGH` (inline), and JSON
array-of-objects rendered as `[ one element ]`. `roundTrip: true` — every field
carries a real example, so `extract(exampleOnly)` reads the whole graph back with
no MALFORMED / LOST_* states.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"requestId": "req-42",
"payload": {
"title": "Spring Sale",
"author": {
"name": "Ada",
"contact": {
"email": "ada@example.com",
"verified": true
}
},
"sections": [
{
"heading": "Intro",
"priority": "LOW"
}
],
"summary": "All good"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Fill in each field as described below:
- requestId (required): client request id
e.g. req-42
- payload (required)
- payload.title (required): document title
e.g. Spring Sale
- payload.author (required)
- payload.author.name (required): author name
e.g. Ada
- payload.author.contact (required)
- payload.author.contact.email (required): reply address
e.g. ada@example.com
- payload.author.contact.verified (required): is the address verified
e.g. true
- payload.sections (required)
- payload.sections[].heading (required): section heading
e.g. Intro
- payload.sections[].priority (required): render priority
one of LOW, HIGH
e.g. LOW
- payload.summary (optional): optional one-line summary
e.g. All good

Respond exactly like this:
{
"requestId": "req-42",
"payload": {
"title": "Spring Sale",
"author": {
"name": "Ada",
"contact": {
"email": "ada@example.com",
"verified": true
}
},
"sections": [
{
"heading": "Intro",
"priority": "LOW"
}
],
"summary": "All good"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"requestId": "{client request id}",
"payload": {
"title": "{document title}",
"author": {
"name": "{author name}",
"contact": {
"email": "{reply address}",
"verified": "true | false"
}
},
"sections": [
{
"heading": "{section heading}",
"priority": "LOW | HIGH"
}
],
"summary": "{optional one-line summary}"
}
}
27 changes: 27 additions & 0 deletions fixtures/output-prompt-conformance/json-deep-mixed/spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"format": "json", "rootName": "Request", "roundTrip": true,
"fields": [
{ "name": "requestId", "kind": "STRING", "required": true, "example": "req-42", "instruction": "client request id" },
{ "name": "payload", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "Payload",
"fields": [
{ "name": "title", "kind": "STRING", "required": true, "example": "Spring Sale", "instruction": "document title" },
{ "name": "author", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "Author",
"fields": [
{ "name": "name", "kind": "STRING", "required": true, "example": "Ada", "instruction": "author name" },
{ "name": "contact", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "Contact",
"fields": [
{ "name": "email", "kind": "STRING", "required": true, "example": "ada@example.com", "instruction": "reply address" },
{ "name": "verified", "kind": "BOOLEAN", "required": true, "example": "true", "instruction": "is the address verified" }
] } } ] } },
{ "name": "sections", "kind": "OBJECT", "required": true, "array": true, "nested": {
"format": "json", "rootName": "Section",
"fields": [
{ "name": "heading", "kind": "STRING", "required": true, "example": "Intro", "instruction": "section heading" },
{ "name": "priority", "kind": "ENUM", "required": true, "enumValues": ["LOW", "HIGH"], "example": "LOW", "instruction": "render priority" }
] } },
{ "name": "summary", "kind": "STRING", "required": false, "example": "All good", "instruction": "optional one-line summary" }
] } } ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# json-depth-guard-fallback

A nine-level singular object chain (`n1 → n2 → … → n9 → leaf`) that drives the
renderer **past `MAX_NEST_DEPTH` (8)**. At depth 8 the depth guard stops recursing
and emits the flat `{n9}` placeholder instead of expanding `n9`'s `leaf` child —
proving the renderer never recurses unboundedly on a deeply (or cyclically) nested
payload.

`roundTrip: false`: the fallback `{n9}` is a placeholder, not a real value, so the
exampleOnly fragment is intentionally not extract-clean. The point is the byte-exact
fallback shape, identical across every port (all share `MAX_NEST_DEPTH = 8`).
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"n1": {
"n2": {
"n3": {
"n4": {
"n5": {
"n6": {
"n7": {
"n8": {
"n9": "{n9}"
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Fill in each field as described below:
- n1 (required)
- n1.n2 (required)
- n1.n2.n3 (required)
- n1.n2.n3.n4 (required)
- n1.n2.n3.n4.n5 (required)
- n1.n2.n3.n4.n5.n6 (required)
- n1.n2.n3.n4.n5.n6.n7 (required)
- n1.n2.n3.n4.n5.n6.n7.n8 (required)
- n1.n2.n3.n4.n5.n6.n7.n8.n9 (required)

Respond exactly like this:
{
"n1": {
"n2": {
"n3": {
"n4": {
"n5": {
"n6": {
"n7": {
"n8": {
"n9": "{n9}"
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"n1": {
"n2": {
"n3": {
"n4": {
"n5": {
"n6": {
"n7": {
"n8": {
"n9": "{n9}"
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"format": "json", "rootName": "Root", "roundTrip": false,
"fields": [
{ "name": "n1", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N1", "fields": [
{ "name": "n2", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N2", "fields": [
{ "name": "n3", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N3", "fields": [
{ "name": "n4", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N4", "fields": [
{ "name": "n5", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N5", "fields": [
{ "name": "n6", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N6", "fields": [
{ "name": "n7", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N7", "fields": [
{ "name": "n8", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N8", "fields": [
{ "name": "n9", "kind": "OBJECT", "required": true, "nested": {
"format": "json", "rootName": "N9", "fields": [
{ "name": "leaf", "kind": "STRING", "required": true, "example": "x", "instruction": "the deepest leaf" }
] } }
] } }
] } }
] } }
] } }
] } }
] } }
] } }
] } } ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Discovers_all_output_prompt_conformance_cases()
{
// Count guard: a port silently skipping cases must fail CI rather than reduce coverage.
// Mirrors the TS / Java / Python count guards.
Assert.Equal(12, Cases().Count());
Assert.Equal(14, Cases().Count());
}

private static readonly (string Key, PromptStyle Style)[] Styles =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OutputPromptConformanceTest {
private val json = ObjectMapper()

/** Count guard: a port silently skipping cases must fail. Bump when adding cases. */
private val expectedCaseCount = 12
private val expectedCaseCount = 14

private data class StyleSpec(val key: String, val style: PromptStyle)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class OutputPromptConformanceTest {
private static final ObjectMapper JSON = new ObjectMapper();

/** Count guard: a port silently skipping cases must fail. Bump when adding cases. */
private static final int EXPECTED_CASE_COUNT = 12;
private static final int EXPECTED_CASE_COUNT = 14;

private static final Path CORPUS;
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _find_corpus() -> Path:
_CORPUS = _find_corpus()

# Count guard: a port silently skipping cases must fail. Bump when adding cases.
EXPECTED_CASE_COUNT = 12
EXPECTED_CASE_COUNT = 14

_FORMATS = {"json": Format.JSON, "xml": Format.XML}
_KINDS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("output-prompt-conformance corpus", () => {
.sort()
: [];
// Count guard: a port silently skipping cases must fail. Bump when adding cases.
const EXPECTED_CASE_COUNT = 12;
const EXPECTED_CASE_COUNT = 14;
expect(names.length).toBe(EXPECTED_CASE_COUNT);

for (const name of names) {
Expand Down
Loading