Skip to content

Build1 publisher2 min readPublished

Answer lineage pins the certified metric version behind a disputed EUR 18.6M

A dev.to post argues that logging prompts, SQL and latency cannot show how an agent read the question, and proposes eight append-only events running from resolved intent to final answer. It works if your metrics are already governed.

The Engineer · Build desk

Illustration accompanying Answer lineage pins the certified metric version behind a disputed EUR 18.6M

What happened

  • Most text-to-SQL pipelines log prompts, generated SQL, latency, tokens and execution status, which a dev.to post on answer lineage argues cannot settle a business user's claim that a number is wrong.
  • The post lists four failures that happen before SQL generation: the wrong metric for "revenue", the wrong dimension for "Germany", the wrong relationship path through customer data, the wrong reading of "last quarter".
  • It proposes creating a lineage object when the request arrives, carrying an id, the question text, a created_at timestamp and status running, then enriching that object as each stage of the pipeline completes.
  • The worked example resolves "last quarter" to 2026-Q2, names the fields and the join path used, and ends with an answer of 18,600,000 EUR tied to query id q_91821.
  • Lineage is captured as an append-only stream of eight event types, running from question_received through relationship_path_selected and sql_generated to answer_generated.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint The scheme only pays off on top of a governed semantic layer: version v4, status certified and owner Finance have to exist somewhere before an agent can record which definition it used.
  • decision Anyone instrumenting this has to decide whether to pin the metric version at query time, because a replay against an unpinned definition answers with today's revenue rule.
  • cost Eight instrumentation points inside the agent, plus retention of plans, paths and ambiguity candidates, land on whoever runs the platform, not on the analyst who disputed the figure.
  • capability Storing the metric owner alongside the value sends a disputed figure to Finance for a definition ruling instead of to an engineer for a SQL review.

In the completed lineage object from the dev.to post "Building Answer Lineage for Enterprise Data Agents", semantic_resolution records the metric name Recognized Revenue, version v4 and owner Finance; the semantic evidence example adds the id metric.recognized_revenue and status certified [8]. Those fields come from a governed metric store. An agent that writes SQL straight from table DDL resolves "revenue" against a column name, and none of the five signals it already logs records that decision [24].

Version v4 is what makes an answer defensible six weeks later. The post lists version history among what an append-only stream gives you, along with auditability, ordering, replay and debugging [10]. A replay against an unpinned metric answers with the definition in force today, not the one that produced 18,600,000 EUR [7][22].

The path from question to answer has nine stages: Question, Resolved Intent, Semantic Objects, Selected Data, Relationship Path, Query Plan, SQL, Execution Result, Answer [5]. The event list has eight types [9]. Selected Data is the stage with no event of its own [20]. The fields it would carry, finance_revenue.recognized_amount and customer.country_code, show up in the aggregate object and in the semantic query plan, which also holds the SUM aggregation and the country_code = DE filter [11][18].

The relationship path is the piece I would instrument first. The example stores path_id rp_4821 over four nodes: customer, account, sales_order and finance_revenue. Each edge is tagged status trusted [13]. The object's path field writes the same walk as three hops [12][21]. The post gives the reason for keeping this out of the SQL: "Because the relationship decision is a reasoning artifact. SQL is only its execution representation." [14] It adds that when an answer is inflated by fanout, the path is often the first artifact to inspect [15].

Ambiguity gets stored instead of silently resolved: the metric arrives with status ambiguous and candidates recognized_revenue and invoice_amount [16]. The stated reason is blunt. "Otherwise engineers may blame SQL for what was actually an intent-resolution failure," the post says [17]. Anyone who has bisected a revenue discrepancy will recognise the pattern.

The post does not include measured failure rates [23]. Its argument is a single sentence: "The SQL can be valid while encoding the wrong business meaning." [3] So the case for eight events rests on which disputes you actually get. If yours are about what revenue means, the intent and semantic blocks are where the answer sits [2][4]. If they are timeouts and stale partitions, execution status already covers it [1].

What to watch

  • Whether anyone publishes measured error rates separating intent-resolution failures from SQL-generation failures on a real workload.
  • Whether semantic-layer or BI vendors emit these events natively; the post describes a design, not a shipped library.
  • Whether the event list grows a selected-data event so a replay from the stream alone reproduces the field list.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories