---
description: "Text artifacts can be tested by a three-layer pyramid—deterministic structural checks, semantic rubric reviews, and cross-document corpus checks—built from real failures rather than abstract taxonomies"
type: types/note.md
traits: []
tags: [document-system, evaluation, type-system]
---

# Automated tests for text

Text artifacts can be tested like software once contracts are declared per document type. Checks separate along two orthogonal dimensions—**method** (deterministic script vs. LLM semantic judgment) and **scope** (single document vs. cross-document corpus)—producing a practical testing pyramid:

- **Deterministic structural checks** (hard oracle, cheap and repeatable) — valid frontmatter schema, required fields and sections, enum values, link resolution, and citation bounds. These run in milliseconds as scripts across one note or an entire corpus.
- **Semantic rubric checks** (soft oracle, judgment-based) — clarity, single clear thesis, grounding alignment, internal consistency, and claim-scope boundaries. Even a single paragraph can require an LLM or human reviewer when the property cannot be checked mechanically.
- **Cross-document corpus checks** — contradiction detection against neighboring claims, terminology consistency, and duplicate detection. Scope alone does not fix cost: link resolution is corpus-wide yet deterministic, while contradiction detection requires semantic comparison.

Since [document types should be verifiable](./document-types-should-be-verifiable.md), each type and trait asserts a checkable property—and those properties are what testing contracts verify. The type system and the testing stack are two sides of the same coin: types define what to check, and validators and review gates do the checking.

Build contracts from observed failures rather than from an abstract taxonomy of possible checks: add a check when a recurring failure would have been caught by it, not before.

A knowledge base retains LLM-generated notes selected for reuse. [Selecting an LLM output fixes a result, not its interpretation](./selecting-an-llm-output-fixes-a-result-not-its-interpretation.md), making each accepted note a stable artifact-testing target even when its language remains open to interpretation. Artifact testing is distinct from generator testing: [generators and their artifacts are separate testing targets](./programming-practices-for-prompts-need-question-specific-evidence.md#generators-and-their-artifacts-are-separate-testing-targets), including when generation is deterministic. An acceptable note does not establish that its generator reliably produces acceptable notes, and confidence in a generator does not certify every output.

---

Relevant Notes:

- [Document types should be verifiable](./document-types-should-be-verifiable.md) — grounds: types and traits declare the checkable structural and semantic properties this pyramid enforces
- [Oracle strength spectrum](./oracle-strength-spectrum.md) — grounds: separates hard-oracle deterministic scripts from soft-oracle semantic reviewers
- [Semantic review catches content errors that structural validation cannot](./semantic-review-catches-content-errors-that-structural-validation.md) — extends: applies the semantic-rubric layer to structurally valid documents
- [The verifiability gradient](./verifiability-gradient.md) — extends: compares verification by requirement, reset condition, retry cost, and feedback strength
