LAB / 010
TypeScript / Output boundary comparison
Which invalid inputs escape assertions and object validation?
EXPERIMENT RESULT
01 / QUESTION
Which invalid inputs escape assertions and object validation?
METHOD
32 synthetic inputs enter assertion, object, raw JSON and existing Java paths; one saved real response is replayed offline.
RESULT
Assertions falsely accept 22 invalid cases; object validation four; raw JSON and Java agree on 32/32.
OBSERVATIONS
JSON.parse loses duplicate keys; objects also lack raw length. The saved fenced response fails strict parsing and passes explicit adaptation.
CONCLUSION
Static types do not replace runtime contracts; structural validity does not establish semantic correctness.
LIMITATIONS
Deliberate cases, not a model error rate or proof of a general parser. A 2026-11-12 review found an invalid apostrophe escape outside the original 32 cases: old Java accepts it; TypeScript rejects it. The Java correction is local only; see the linked tutorial. No new API calls.
REPRODUCE
Typecheck, 37 tests and a 32-case differential audit pass; Node 26.8.2, TypeScript 7.0.2, Java 1.8.0_171.
Related content
- Engineering cases
Does TypeScript validate model output? A 32-case comparison with Java
Assertions, unknown and raw JSON: 22 false accepts, four object-validation blind spots and a bounded Java/TypeScript comparison.
- Tutorials
Java LLM Practice II: How to validate model JSON after HTTP 200
Check a field contract in Java 8 using a real fenced response and three timeouts, with bounded adaptation and a verified lexical gap in the original validator.
- PROJECT / 002
Java LLM Practice
Reproducible Java conversation, retry and persistence boundaries, alongside attention, cache-cost and quantization-error experiments.