Truthound · All articles · 22/24
Evidence-led Truthound Core guidance on data contracts, check inputs and operational limits.
480 articles
Pydantic bytes schemas: separating input decoding from output serialization
Separate input and output directions in the API documentation so client and server do not expect different byte representations.
Pydantic alias and extra collisions: deciding which validated value owns the output key
Allowing extra input should not silently transfer ownership of a validated field's output key. Define collision handling explicitly.
PapaParse workers in Vite production: validating the returned data envelope
Approve a new worker path with a small test of the production bundle's returned envelope, not only its development behavior.
PapaParse unparse: testing optional fields that first appear after the initial row
Design the CSV export test around the explicit field contract, not an assumption that the first object represents all rows.
pandas CSV numeric separators: preserving the meaning of Unicode locale settings
Internationalization settings affect interpretation, not just display. Preserve the raw token and the actual separator used to decode it.
SPSS to Parquet: preserving metadata instead of clearing attrs to make a write succeed
Deleting metadata to make a write succeed is different from completing a preservation task. Specify contracts for both values and descriptive metadata.
pandas parallel read_csv: checking whether lower missingness is a parsing change
Before comparing missingness trends across a processing-speed change, verify continuity of the missing-value decision for the same raw tokens.
pandas ODS import: distinguishing covered cells with values from empty merged placeholders
Separate visual cell coverage from value presence so that a calculation entered by the document author is not silently reclassified as missing.
pandas object uint64 export: preventing signed JSON identifiers from replacing originals
Identifier preservation requires comparison with the source sign and exact decimal representation, not just a range check.
pandas read_html: keeping nested-table headers out of observation rows
Record the boundary between DOM headers and body rows in the ingestion contract. Otherwise, a rising number of collected rows can be mistaken for an increase in observations.
pandas CSV and Excel MultiIndex headers: preserving the meaning of each level
Even when the value array matches, column-level names explain the axes to readers and require a separate agreement.
pandas Excel with mixed values: preserving attribute codes before choosing a dtype
Before calling a mixed-type column dirty, agree whether it holds quantities or a list of attribute values.
pandas read_json and large integers: choosing exact text without changing the field's purpose
Decide whether a large integer is an identifier, an exact count, or a timestamp before reducing its meaning merely to make parsing succeed.
pandas JSON normalization: preserving missing-record positions during migration
Before deleting an empty list entry to avoid a parser failure, decide whether it represents a missing observation or merely packaging.
pandas json_normalize: retaining original key identity when limiting depth
Standardizing an output column name must not overwrite the source key's type. Otherwise, an archive can lose a working reprocessing path.
pandas Excel usecols: tracing renamed headers back to the selected sheet columns
Provide a mapping that preserves the user's selected coordinates and business meaning, rather than simply stripping a suffix from the column name.
pandas Excel date indexes: checking calendar operations without asking users to re-enter valid dates
Distinguish date meaning from the operations offered by its container. A container mismatch should not automatically become a request for users to re-enter valid dates.
pandas CSV converters: separating thread affinity from reproducible mappings
Reproducing a conversion over time requires the lookup snapshot and execution conditions, not just the input file.
pandas categorical dates: verifying the epoch unit written to JSON
Compressing a date column into a categorical representation must not silently change its external unit. Validate the unit contract alongside the values.
pandas CSV headers: preserving column identity across UTF-8 BOM handling
Keep the original bytes alongside the normalized header. That makes a later reader's naming difference distinguishable from a real source-schema revision.
