Back to blog

Data & architecture

When the Pipeline Is Green but the Data Is Wrong: Designing for Trust

Sohail Sharif · Lead Software EngineerPublished 8 min read
Original editorial illustration: When the Pipeline Is Green but the Data Is Wrong: Designing for Trust

A successful job can still publish an incomplete, duplicated, or misleading dataset. Reliable data systems need explicit meaning, temporal boundaries, reconciliation, and a safe way to correct the past.

A successful task is not a trustworthy dataset

A dashboard updates on time. Every scheduled task is green. The business then discovers that yesterday's revenue excludes a group of late-arriving orders. No process crashed, and no database became unavailable. The pipeline did exactly what its implementation instructed. It failed to represent the business meaning people assumed it carried. This fictional example is the starting point for a more useful definition of data reliability.

An orchestration system can tell a team that work ran. It cannot decide on its own whether the inputs were complete, whether a join duplicated records, or whether the published metric matches the finance team's definition. Those are contracts the team must design and check. Reliability therefore includes both execution behavior and the interpretation of the resulting data.

I would begin with the consumer rather than the scheduler. Who makes a decision from this dataset? How recent must it be? Which omissions would change that decision? When is a number provisional, and when is it considered settled? The answers shape the pipeline's partitions, quality checks, publication rules, and recovery process. They also help an engineer avoid spending weeks accelerating a transformation that produces the wrong result more efficiently.

Write down the grain and meaning of each record

Before choosing a processing engine, state what one row represents. Is it one order, one line item, one payment attempt, or one status change? Two tables may both contain an order identifier while having different grains. Joining them without accounting for that difference can multiply amounts. A schema with valid types and no nulls will not necessarily reveal the mistake.

For the revenue example, I would document the source event, stable business key, currency, relevant timestamps, cancellation behavior, and the distinction between an order and a settled payment. The contract should name which fields may change and whether a new event replaces or supplements an earlier one. Consumers need to know whether counting rows means counting entities, attempts, or observations.

Keep a few small counterexamples beside the contract. One order with two line items, a refunded payment, a repeated event, and a correction arriving the next day can reveal more than a large happy-path sample. Ask a business owner to confirm the expected output for those examples. That conversation makes ambiguity visible early and creates a durable test set for later transformation changes, regardless of whether the implementation uses SQL, Spark, or a simpler process.

Data publication path from source contract through validated staging and transformation to a consumer-facing dataset, with quarantine for invalid records
A trustworthy publication path makes meaning and quality visible. Quarantined records remain counted and owned instead of disappearing silently.

Treat time as part of the data contract

An event can have several valid times: when the business action occurred, when the source recorded it, when the platform received it, and when the warehouse processed it. Choosing one timestamp silently changes the meaning of daily totals. A customer action near midnight can belong to different dates depending on the business timezone and the timestamp used by the transformation.

I would give each timestamp a name and preserve the distinction through the pipeline. The revenue dataset might group by business event time while reporting a freshness cutoff based on received time. A published daily total could remain provisional until a stated late-arrival window closes. The window is a business agreement supported by observed source behavior, not a universal default copied from another project.

Corrections need an equally explicit rule. Does a late cancellation revise the original day, appear as an adjustment today, or produce both views for different consumers? None of those policies should emerge accidentally from a scheduler's execution date. Record the policy, test a boundary example, and expose the dataset version or as-of time so a reader can understand why a number differs from a report downloaded earlier.

Make a rerun repeat the intended work

A pipeline will be rerun. A worker can fail after writing some output, an operator can replay a partition, or a source correction can require rebuilding history. If the task always reads the latest input and blindly appends output, the rerun may combine different source states and produce duplicates. The same command can then mean something different each time it is executed.

Airflow's best-practice guidance recommends repeatable task outcomes and partition-specific input and output. The broader design question is how a task identifies its intended slice of work. For this exercise, I would record the input partition, transformation version, and output identity. A rerun should either replace that output atomically or merge it according to a documented business key and correction policy. The storage system's actual guarantees must support the chosen approach.

Do not publish a partly rebuilt dataset merely because several tasks completed. Write intermediate results separately, validate them, and change the consumer-visible reference only when the required checks pass. Preserve enough metadata to explain which inputs and code produced the published version. This creates a useful recovery boundary: a failed rebuild can remain inspectable without silently replacing the last dataset consumers were told to trust.

Sources: Apache Airflow: Best Practices, creating a task

Check business invariants as well as schemas

Schema checks catch important failures, but they are only one layer. A valid amount column can contain values in the wrong currency. A correctly typed customer identifier can refer to the wrong tenant. A complete partition can contain duplicated business events. Quality rules need to connect the structure of the data with the interpretation consumers rely on.

For the example dataset, I would check key uniqueness at the intended grain, required relationships, allowed status transitions, and reconciliation totals against a defined source snapshot. Volume and distribution checks can flag unusual changes, but they need context. A promotion can create a legitimate spike. An outage can create a genuine drop. An anomaly should trigger investigation or a publication policy, rather than being automatically rewritten into an expected value.

Quarantine is useful when invalid records must remain visible without contaminating accepted output. Count the quarantined records, preserve a safe reason code, assign an owner, and define how corrections return to the pipeline. Silently dropping bad rows can make the output look cleaner while making its completeness unknowable. A quality system should tell consumers what was excluded and whether the exclusion changes the decisions the dataset is intended to support.

Design historical repair as a controlled change

Backfilling a month of data can interfere with today's workload, consume unexpected resources, or overwrite a valid correction. I would treat a backfill as a release with an affected range, a transformation version, a concurrency limit, an expected result, and an approval boundary appropriate to the data. The operator should know what will change before starting the run.

Build the corrected output separately when possible and compare it with the published version. Explain differences by category rather than reporting only that row counts match. A total can remain identical while amounts move between customers or dates. Use representative records and aggregate checks together. The review should also consider downstream caches, extracts, dashboards, and machine-learning features that may already contain the older interpretation.

After publication, communicate the new version and the reason for correction to affected consumers. If a report is meant to be reproducible, retain the appropriate inputs and transformation metadata under the organization's retention policy. A corrected dataset should improve trust by making the change understandable. Quietly replacing history can leave two teams arguing over different numbers without realizing that both are reading outputs produced under different rules.

Controlled data repair workflow from bounded historical input through versioned rebuild, reconciliation, publication, and consumer notification
A backfill is a change to a published interpretation of history. Bound the work, compare versions, and tell consumers what changed.

Give consumers useful freshness and ownership signals

An internal scheduler timestamp is not necessarily a useful freshness indicator. A job may finish recently after processing an old input partition. I would expose the latest business event represented, the source cutoff, the publication time, and whether the dataset is provisional. A consumer can then decide whether the result is suitable for their particular decision.

Operational alerts should point toward an action. A late dataset needs a named owner and a known escalation path. A failed reconciliation needs enough context to identify the affected range and whether publication was blocked. A growing quarantine needs a decision about source repair or consumer impact. The alert should not require somebody to rediscover the entire lineage before understanding the problem.

Google's data-integrity chapter treats preventing, detecting, and recovering from data loss or corruption as substantive reliability work. I would apply that perspective by maintaining recovery evidence alongside ordinary pipeline metrics. Can the team locate a known-good version? Can it explain an unexpected change? Can another engineer run a bounded repair? Availability of the processing engine is useful, but these questions tell us whether the resulting information remains dependable.

Sources: Google SRE: Data Integrity, What You Read Is What You Wrote

Reconcile a correction from source to consumer

Build a small example with an order recorded on Monday, a payment recorded on Tuesday, and a cancellation received on Wednesday. Specify which date each report uses and whether the cancellation changes a previously published total. Then introduce a duplicate delivery of the payment event. The expected result should be stated before running the transformation, including the explanation a business reader will receive.

Execute the initial publication, replay the same input slice, and apply the late correction as separate checks. Compare entity counts, monetary totals by currency, and representative record histories. A matching grand total is insufficient if the correction has been assigned to the wrong customer or business day. Keep the rejected or ambiguous records visible so the example shows how an operator would investigate a discrepancy rather than silently editing the output.

The evidence should let another engineer reconstruct the result from versioned input and transformation rules. Include a short note explaining what changed between published versions and whether downstream consumers need to refresh an extract. This is a compact but meaningful demonstration of data engineering maturity: the project explains its interpretation of reality, checks it at several boundaries, and provides a controlled way to revise that interpretation when better information arrives.

Demonstrate trust with a small reproducible example

A strong portfolio project does not need an invented claim about billions of events. It can use a modest synthetic dataset that includes late events, duplicates, cancellations, and source corrections. Publish the contract, expected examples, quality checks, and a controlled backfill. Show the output before and after a correction and explain why the difference is legitimate. That gives a reviewer something meaningful to inspect.

Tool choices should follow the workload and learning objective. A relational transformation may be enough to demonstrate grain, reconciliation, and historical repair. A distributed engine can add a useful discussion of partitioning and execution when the exercise genuinely needs it. A warehouse or orchestration platform should have a clear role. Adding logos without explaining their responsibilities makes the system harder to understand without adding evidence of engineering depth.

The standard I would carry into production is simple to state and demanding to implement: consumers should know what a dataset means, how current it is, what was excluded, and how a correction will be handled. A green pipeline is one signal within that larger promise. Trust comes from connecting execution, meaning, evidence, and ownership so that the team can explain the data even when yesterday's assumptions turn out to be wrong.

Key takeaways

  • Define record grain, business meaning, and temporal boundaries before building transformations.
  • Make reruns and publication deterministic for the intended input slice.
  • Reconcile business invariants and keep rejected records counted and owned.
  • Treat backfills as controlled changes with version comparisons and consumer communication.

Further reading

Want to talk about this?

Send to: sohailsharif.official@gmail.com

Your email app opens with the recipient, subject, and message filled in. Review the draft and send it there.

More articles

System design · 9 min read

System Design Beyond the Diagram: Building for Failure, Scale, and Change

A good architecture explains what happens when a request is repeated, a dependency slows down, or the business changes its mind. Here is how to make those decisions visible before production makes them urgent.

0
AI & engineering · 9 min read

Will AI Take Our Jobs? What Still Makes a Software Engineer Valuable

AI is changing how software gets written. The harder questions concern responsibility, verification, and the value of an engineer when generating another implementation becomes cheap.

1
Engineering careers · 9 min read

The US Tech Job Market: How Senior Engineers Can Show Their Value

Job-market headlines are broad; hiring decisions are specific. A practical way to connect your experience with the problems a team needs someone to own, without inflating your resume or chasing every keyword.

2
Cloud & reliability · 9 min read

From Commit to Recovery: What Production-Ready Cloud Engineering Looks Like

A green pipeline proves that its checks passed. Production readiness also needs safe identity, compatible changes, meaningful health signals, and a recovery path another engineer can actually use.

3
Software engineering · 9 min read

Beyond the Language: Engineering Principles That Travel Across Every Stack

Java, C#, Python, Go, and TypeScript offer different tools. Reliable software still depends on clear contracts, correct state changes, useful tests, measured performance, and decisions another engineer can understand.

4