One regenerated file dropped from 51.8K to 14.9K, and that shrink was the only thing that kept a refactored extractor from shipping. We had dropped every tool-output record from the file. The markdown still rendered cleanly enough to fool us.
What the extractor does
It transforms conversation-like records into two versioned artifacts: a structured form for downstream processing and a human-readable view for review.
The original code built those artifacts along separate paths, which made divergence more likely. The refactor moved both renderers onto a shared intermediate representation. That cut duplication, but it did not guarantee correctness. A shared representation can still omit, transform, or leak data, so it needs an explicit output contract and independent checks.
One helper, two jobs
The extractor had a classification helper with a legitimate job. It separated records that should count toward a content-quality threshold from records that were protocol or tool plumbing. That classification also informed a human-readable label.
Those are scoped questions: what counts for selection, and which content informs a label. Neither is a question about whether a record should exist in the retained source or a published artifact.
So the triviality check is correct for what it’s for. The mistake was reaching for it during the refactor to gate something else entirely.
During the refactor, we reused that helper to gate row construction. It answered a nearby but different question, and a whole class of records disappeared from both generated artifacts.
Nothing broke. The output stayed well-formed, which was the trap, because a render that succeeds says nothing about whether it is complete. A downstream process would have received a materially incomplete record set unless the regression checks made the omission visible.
The tell was a size delta
The first signal was a large divergence between a regenerated artifact and its approved fixture. A big size change in an output that should stay comparable does not prove a defect, but it is a high-priority review signal.
The versioned fixture made the behavior change visible before we understood its cause. Diffs, checksums, and size thresholds work as tripwires once their limits are explicit. They need deterministic or normalized inputs, and they have to be paired with semantic expectations and human review of intentional changes.
Splitting the gate
The fix was to restore separate contracts. Selection logic answers whether a record counts toward a quality threshold. Row construction answers whether the approved output contract requires that record. Tests now cover both decisions independently.
The regenerated fixtures then matched the approved baseline after normalizing any intended non-determinism. That gave us a stable starting point for future intentional changes. It does not replace tests for record completeness, schema validity, or downstream behavior.
The comparison also prompted a broader privacy review. Metadata and frontmatter were generated on a different path from the main body, so they needed the same privacy and validation controls. Every emitted surface (metadata, manifests, sidecars, logs, exports, and error reports) needs an explicit classification and appropriate handling.
What to keep
A file that renders cleanly can still be missing a whole class of records, so pair the fixture comparison with checks for record completeness and schema validity.