Page 6 of 8~112 min topic

Structured output lab

Instrument the ticket triage schema gate

Page 6 adds signals that distinguish bad input from component failure in the ticket triage JSON endpoint.

~14 min this pageTesting and observability

1Learn the idea

Read

Emit stage signals

Instrument the ticket triage JSON endpoint so a run records enough structure to debug offline: counts, latency if relevant, pass/fail of schema pass rate, and a stable stage name. Redact secrets and raw credentials from every event.

Read

Emit and assert

const event={stage:'triage', schema_pass:true, repair_attempts:1, rejected:false};
console.log(JSON.stringify(event));

Expected evidence: triage telemetry. Prefer JSON or structured text you can grep in CI over prose logs for structured-output-lab.

Read

Lock signals with a regression test

Turn one historical failure—especially accepting extra fields that change routing—into a test that fails if the signal disappears for the ticket triage schema gate. Observability without a failing test is optional decoration; observability with a test is part of the structured-output-lab artifact.

Read

Lab notebook: signal schema

Draft a three-field event for the ticket triage schema gate: stage, ok, and one domain field derived from schema pass rate; repair attempts; final reject count. Add fixture_id or docs_version when content can change. Explicitly list fields that must never appear (tokens, passwords, raw prompts) because logging full ticket PII in triage debug dumps is in scope for this lab.

Wire one assertion that fails if the ticket triage schema gate event is missing after a run. Observability that cannot fail a test will not survive contact with a busy structured-output-lab repository.

Read

Worked judgment

Imagine a teammate opens only your event stream after a bad deploy. Could they tell whether sample ticket + triage schema was wrong, whether accepting extra fields that change routing, or string priority 'high' vs enum returned, or whether logging full ticket PII in triage debug dumps slipped through? If not, rename fields until those three stories are distinguishable.

Read

Why this stage matters for the ticket triage schema gate

At the testing and observability stage for structured-output-lab, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about sample ticket + triage schema that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: free-text model reply without schema validation.

For this page specifically, success looks like a structured event schema locked by a test while still centering the user decision to return validated category, priority, summary, and confidence for a support ticket. If you cannot point to a file, command, or assertion that proves that for the ticket triage schema gate, stay on this page instead of advancing.

Glossary: tool · Glossary: structured output · Cheatsheet: production ops signals

Previous · Next

Go deeper

Before you start

Why this matters

Write the single log line or metric event that would tell you whether a bad result came from input vs implementation for the ticket triage schema gate. If your line could not tell them apart, redesign it before coding.

In the wild

See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Can input faults be distinguished from component faults in the event?
2. Are secrets redacted from logs?
3. Is there a test that fails if the signal vanishes?
4. Does the event still reference the decision: return validated category, priority, summary, and confidence for a support ticket?

All responses are required.