ML data engineering
Source Discovery, Ownership, and Data Authority
Inventory source systems, ownership, authority, update behavior, and consumer dependencies before building pipelines.
By the end you can
- Inventory source systems with owners, clocks, correction behavior, and consumers
- Distinguish systems of record, capture, and analytical replication
- Identify undeclared consumers and hidden source dependencies
- Establish authority for current, historical, and corrected values
Example
Changes that compile but still break learning
None of these examples necessarily triggers a database type error.
- Unit change: a weight field remains floating-point but moves from kilograms to grams, shifting every numeric feature by 1,000. This is not a thought experiment. The Mars Climate Orbiter was destroyed on 23 September 1999 for that reason. The Mishap Investigation Board was blunt about why: “The MCO MIB has determined that the root cause for the loss of the MCO spacecraft was the failure to use metric units in the coding of a ground software file, “Small Forces,” used in trajectory models.” The specification had said which units to use. “The output from the SM_FORCES application code as required by a MSOP Project Software Interface Specification (SIS) was to be in metric units of Newton-seconds (N-s). Instead, the data was reported in English units of pound-seconds (lbf-s)”, so navigation “underestimated the effect on the spacecraft trajectory by a factor of 4.45”. The U.S. General Accounting Office recorded the same conclusion from outside NASA: “A NASA mishap investigation team determined that the loss was due to the mistaken use of English rather than metric units in the navigation software.” The file parsed. Every value was read as a number. The specification was violated only on units.
- Population change: a mobile event begins excluding users who declined a new permission, changing coverage and selection bias. Apple's App Tracking Transparency framework did this at platform scale, and two European competition regulators documented it. The Bundeskartellamt's preliminary assessment of 13 February 2025 states that “For third-party companies, the ATTF now also makes data access conditional on the users' consent to the use and combination of their data across companies”, while “the strict requirements under the ATTF only apply to third-party app providers, not to Apple itself”. The French Autorité de la concurrence went further. On 31 March 2025 it imposed a fine of “€150,000,000 on Apple for abusing its dominant position in the sector for the distribution of mobile applications on iOS”, for the implementation of ATT between 26 April 2021 and 25 July 2023. After a dated change of that kind the schema is identical, the field names are identical, and the stream covers only the users who consented.
- Identifier change: merged customer accounts receive new IDs, breaking historical joins and duplicate detection.
- State change: a fraud status now means “under review” rather than “confirmed,” corrupting the target definition.
- Timing change: a nightly extract moves from midnight UTC to midnight local time, changing which events enter each daily snapshot.
A source table is not a promise by itself
A column can keep the same name and type while its meaning changes. A status field may be redefined, a timestamp may switch time zones, an identifier may be recycled after account deletion.
The cost of one redefined flag is on the public record. On 1 August 2012 Knight Capital Americas lost over $460 million in 45 minutes. The wire format of the flag that did it never changed. The U.S. Securities and Exchange Commission's settled order found the mechanism: “The new RLP code also repurposed a flag that was formerly used to activate the Power Peg code.” Seven of eight servers carried the new Retail Liquidity Program code. On the last one, “orders sent with the repurposed flag to the eighth server triggered the defective Power Peg code still present on that server”. What followed was fast. “SMARS routed millions of orders into the market over a 45-minute period, and obtained over 4 million executions in 154 stocks for more than 397 million shares”, and “Knight lost over $460 million from these unwanted positions”. The Commission imposed “a civil money penalty in the amount of $12,000,000”. Carol Clark, writing for the Federal Reserve Bank of Chicago, described the same day from outside the firm, and with a different figure for the loss: “On Wednesday, August 1, 2012, a $440 million loss in 45 minutes brought market maker Knight Capital to the brink of bankruptcy.” One value; two meanings; two populations of machines.
ML pipelines are unusually sensitive to these semantic shifts, because historical patterns are compared across versions. A change that is acceptable for an application screen can invalidate a feature or a label.
A data contract makes the producer–consumer relationship explicit. It records the structure, meaning, allowed values, update behavior, ownership, privacy classification, and compatibility rules of a data product.
Contracts do not prevent every failure. They create a place where assumptions can be reviewed, tested, versioned, and negotiated before a silent change reaches training or serving.
There is a proposed shape for that record, and it borrows from electronics. Every component there, however simple, ships with its operating characteristics and recommended uses. Every dataset should arrive the same way, with a sheet documenting “its motivation, composition, collection process, recommended uses, and so on”. That is the argument Timnit Gebru and her co-authors made in Communications of the ACM in December 2021. Their opening complaint still holds: the community has “no standardized process for documenting datasets”.
Schema says what can be parsed; a contract says what downstream users are entitled to assume.
Visual
The source inventory has more than table names
An ML team needs operational and semantic metadata for every critical dependency: which system holds authority, what each field means, when a value is generated, corrected or backfilled, who owns the incident, and which consent, retention and residency obligations apply.
The clock belongs on that inventory. It has a producer, a schedule, and a release note six months ahead of the change. A positive leap second was inserted between 23:59:59 UTC on 31 December 2016 and 00:00:00 UTC on 1 January 2017, displayed as 23:59:60. Cloudflare's own postmortem opens on what that did inside its infrastructure: “At midnight UTC on New Year's Day, deep inside Cloudflare's custom RRDNS software, a number went negative when it should always have been, at worst, zero.” The negative duration reached a function that does not accept one — “rand.Int63n promptly panics if its argument is negative”. The blast radius is in the same post: “At peak approximately 0.2% of DNS queries to Cloudflare were affected and less than 1% of all HTTP requests to Cloudflare encountered an error”, and “The most affected machines were patched in 90 minutes and the fix was rolled out worldwide by 0645 UTC.” Thomas Claburn of The Register reported the incident independently, quoting Cloudflare's John Graham-Cumming — “We didn't plan in the code that the time difference would be negative” — and put the affected share at about 0.2 per cent of DNS queries across 102 data centres.
Nothing in that failure was a schema violation. The clock was a source dependency with a contract of its own, and the contract said that one minute of that year would contain sixty-one seconds.
Authority
Which system is the source of truth, and which copies are derived or eventually consistent?
Semantics
What does each field mean, including units, null meaning, valid states, and business rules?
Time behavior
When is the value generated, available, corrected, expired, or backfilled?
Operations
Who owns incidents, what freshness is expected, and how are breaking changes announced?
Governance
What consent, retention, access, residency, and deletion obligations apply?
A source is trustworthy only within documented semantic, temporal, operational, and governance boundaries.
Key idea
Do not mistake an inferred schema for intended truth
Tools can infer types, ranges, and common categories from observed data. That is useful for profiling. But the result describes the sample rather than the producer's promise.
A field with no nulls this week may still be nullable by design. A category absent from the sample may remain valid. An observed maximum may only record how trade happened to run that week.
Review inferred constraints with domain owners before enforcing them. Otherwise a validator can block legitimate data or, worse, approve a stable pattern that was already wrong.
Google's TFX data validation team designed around exactly this hazard, and published the design in 2019. The Data Validator “synthesizes a basic version of the schema” from the batches it has already seen. The pipeline owners then review that draft, edit it, and commit it to version control. Adrian Colyer, writing the paper up in the morning paper, describes the same sequence: “An initial version of the schema is synthesised automatically, after which it is version controlled and updated by the engineers.” The inferred version is a starting point for that review, never the promise itself. Scale is why the review is not optional. The system is “used by hundreds of product teams to continuously monitor and validate several petabytes of production data per day”, measured over a sample of “more than 700 ML pipelines”.
Observed regularity is evidence for a contract discussion, not a substitute for one.
Breaking changes need dual-running and evidence
A safe migration often publishes old and new versions together. Downstream teams can compare row counts, distributions, joins, features, and model outputs before switching. Backfills require special care, because new logic may reinterpret years of history. A model trained on rewritten past data can look stable offline while serving on records produced by the new live process. Record the effective date of the semantic change, and the transformation version used for backfilled rows. When old meaning cannot be reconstructed, document the discontinuity instead of hiding it.
The U.S. Bureau of Labor Statistics runs that rewrite on an announced schedule, and publishes its size. With the release of January 2026 data on 11 February 2026 it introduced the annual benchmark revision to the Current Employment Statistics survey of nonfarm establishments. The revision realigns that sample-based series to the administrative counts of the Quarterly Census of Employment and Wages. The discontinuity is stated by the producer itself: “Compared with the sample-based, seasonally adjusted published estimate for March 2025, total nonfarm employment had a revision of −898,000 or −0.6 percent.” The benchmarked March 2025 level is 158,377,000. Roberto B. Pinheiro and Rory G. Quinlan, writing for the Federal Reserve Bank of Cleveland, describe the mechanism as intended — “annual benchmarks are constructed to realign the sample-based employment estimates for March of each year with the universe employment counts for that month” — and give the span each revision touches: “Each benchmark revision affects 21 months of nonseasonally adjusted data.” A feature computed from employment levels on 10 February 2026, and the same feature computed on 12 February 2026, are drawing on different numbers for the same months. Same authoritative producer, no defect on either side.
Retire the previous version only after named consumers have migrated and rollback evidence exists. Compatibility is an operational process, not a boolean flag.
A breaking change is complete only when consumers have migrated and historical interpretation remains explicit.
Key takeaways
- A source table can remain syntactically stable while its meaning, units, coverage, identifiers, or timing change. Knight Capital's repurposed flag had the same wire format on all eight servers, and a different meaning on the eighth.
- A data contract combines structure, semantics, service expectations, ownership, governance, and compatibility rules. A Software Interface Specification that names newton-seconds is only a contract if the producer honours it.
- Schema validation, contracts, and business invariants catch different failure classes and should work together. A legally reassignable key such as a telephone number passes every type check while pointing at a different person.
- Inferred constraints describe observed samples; domain owners must decide which patterns are actual guarantees. That is why TFX synthesises a draft schema and then has engineers review, edit and version-control it.
- Breaking changes should be versioned, dual-run, compared, migrated, and retired through an explicit process. The register of consumers is what makes the migration list finite.
- Historical backfills must record semantic discontinuities and transformation versions rather than pretending the past was always produced by new logic. The Bureau of Labor Statistics publishes both the −898,000 March 2025 revision and the 21 months each benchmark rewrites.