Kevin Y

Episode 1,

Revenue dropped 63% overnight. Every test passed.

Monday morning at Larkspur: revenue is down 63%, the dashboard is green, and the AI has a theory.

In this episode

Data Team takes place at Larkspur, a fictional online home-goods retailer. The people are made up; the data problems are real.

  • Kevin, Head of Data

    Kevin

    Head of Data

    The calm one, talking to camera. Played by me; off screen I am a Data Solutions Architect.

  • Marisol, CFO

    Marisol

    CFO

    Wants one number, by Thursday. Never wrong about the business.

  • Greg, VP Sales

    Greg

    VP Sales

    Chases the deck and the shiny tool. Loves anything labelled AI.

  • Theo, Junior analytics engineer

    Theo

    Junior analytics engineer

    Eager, fast, breaks things on Fridays. Learns something every episode.

  • Ana, Data engineer

    Ana

    Data engineer

    Quiet, sees everything, gets one line per episode. It lands.

  • Pip, The AI assistant

    Pip

    The AI assistant

    Confident, fluent, sometimes wrong. Not the chat in the corner: that one only knows my CV.

  • Dedup, The bouncer

    Dedup

    The bouncer

    Keeps one row per order. Never asks who is missing.

Dedup, the bouncer from the show

What really happened

Friday's cleanup added a dedup to the orders fact table: keep the latest row per key. The key was order_id. It should have been order_line_id.

Every order with more than one line collapsed to a single line. About 63% of the revenue vanished, and no test failed, because the uniqueness test on order_id was now perfectly true.

Uniqueness tests catch duplicates. They can't see rows that are gone. Only counting against the source can.

The lesson: Count against the source.

Run the one-word bug

A fact table at order-line grain ends with a dedup. Pick the key it partitions by, then run it. The query runs in your browser on DuckDB with 5,391 synthetic order lines.

qualify row_number() over (
    partition by l.
    order by o.updated_at desc
) = 1

Source, tests and the agent skill: github.com/Kevin-yyuan/dbt-reconcile

Go deeper

More about Kevin Y