Skip to content

feat(obs): the ambient context spine — job, run and stage spans (telemetry P8) - #416

Merged
athvin merged 2 commits into
mainfrom
bm/telemetry-p8-spine
Nov 3, 2026
Merged

athvin merged 2 commits into
mainfrom
bm/telemetry-p8-spine

Conversation

@athvin

@athvin athvin commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Rebased onto be98067d (P10), so the statement spans from #411 now nest inside the chain this PR establishes.

Verified against a real er run-all:

process (service.name=er-cli) → run (run_id, mode, model_version) → stage (ingest, 356ms, ok)

With #411 merged, a statement span sits one level deeper — so every SQL record carries its stage, its run and its service without any of them being passed as an argument. That is the point of ambient context: a generated query function three layers down is attributed to its tenant without taking one.

What I dropped from the plan, and why

The plan said to add org_id to PipelineInputs. That was wrong: 21 struct-literal construction sites edited to thread an identifier the dispatcher already has.

Instead dispatch_claimed — the single funnel every claimed job passes through — enters a job span with org, kind and attempt, and the run and stage spans are created inside it. Org is inherited, not threaded. The same reasoning is what kept the 245 generated query signatures untouched in #411.

The job span also records jobs.trace_context, which #384 started populating. Making it a true child of that remote context needs the OTel propagator and arrives with the exporter; recording it as a field joins the two halves meanwhile.

StageObserver finally carries timing

observed() now measures the stage's wall clock. The trait never has — despite duration_ms being one of the eleven promoted counters — so the ledger has been taking its timing from SQL now() at each boundary. Measuring it once means the span and the ledger agree rather than approximately agree.

The blocking-hop gate, and why it isn't a convention

tokio::task::spawn_blocking moves its closure to another thread, and tracing's current span is thread-local, so the bare form silently drops the ambient span. Because DuckDB is synchronous the entire pipeline runs inside those closures — one missed hop orphans every stage span and every statement span beneath it from the job that caused them.

Nothing catches it. No test fails, no type is wrong, every span is still produced — they're parentless. It doesn't read as a bug, it reads as tracing not working.

All 9 hops move to er_obs::spawn_blocking_in_span (same signature, same JoinHandle, same panic-as-JoinError contract), and er-schema/tests/span_boundaries.rs bans the bare form in the shape freeform_sql.rs established.

The gate was observed failing before being trusted — reintroducing one bare site named er-server/src/dispatcher.rs:583 exactly. It also asserts the wrapper is still used ≥9 times, because proving the bare form absent means nothing if the hops quietly disappeared.

with_span_list, turned on

Found while verifying, not while writing: with the span list off a record carried only its innermost span — so a statement-level event would have reported its stage and nothing about the run, job or tenant. That's the attribution this programme exists for.

It costs bytes, and the lever against that is the filter — a cheap line nobody can attribute is not actually cheap. One documented limitation: a span filtered out by target drops from the ancestry, so a narrow RUST_LOG=er_cli=info loses the process span's service identity.

Also

er-obs cannot override tokio's default-features on the MSRV. The cargo-deny job pins RUSTUP_TOOLCHAIN=1.85.0 deliberately, and on 1.85 an inherited workspace dependency may not override default-features — it fails to parse the manifest at all, which is why that job died in 21s without reaching a check. Newer local toolchains accept it silently. Fixed to tokio.workspace = true, the house pattern, re-verified green under that exact toolchain.

Note on the PR history

#408, #412 and #414 were closed without merging. GitHub returned an Internal Server Error on a push to bm/telemetry-p8-context-spine; the ref updated but no pull_request event was ever delivered again for it. Two further pushes, a close/reopen, a new PR from that ref and a push to an entirely fresh ref all produced zero workflow runs, while other branches ran normally throughout. This PR carries the same work rebased onto current main, with the empty retrigger commit dropped.

make check green at exit 0 on the rebased tree.

🤖 Generated with Claude Code

bmoore813 and others added 2 commits November 2, 2026 15:39
…metry P8)

The piece everything else in the programme hangs off. Verified against a real
`er run-all`, the ancestry is now:

  process (service.name=er-cli) -> run (run_id, mode, model_version)
    -> stage (ingest, 356ms, ok)

A statement span nests one level deeper, so when the emitters land every SQL
record will carry its stage, its run and its service **without any of them
being passed as an argument**. That is the whole point: `tracing` context is
ambient, so a generated query function three layers down is attributed to its
tenant without taking one.

The plan said to add `org_id` to `PipelineInputs`. That was wrong, and doing it
would have defeated the design: 21 struct-literal construction sites edited to
thread an identifier the dispatcher already has. Instead `dispatch_claimed` —
the single funnel every claimed job passes through — enters a `job` span with
org, kind and attempt, and the run and stage spans are created inside it. Org
is inherited, not threaded. The same reasoning is what will keep the 218
generated query signatures untouched in the emitter change.

The `job` span also records `jobs.trace_context`, which P3 started populating.
Making this span a true CHILD of that remote context needs the OTel context
propagator and so arrives with the exporter; recording it as a field means a
log search joins the two halves in the meantime.

`observed()` now measures the stage's own wall clock. The trait never has —
despite `duration_ms` being one of the eleven promoted counters — so the ledger
has been taking its timing from SQL `now()` at each boundary. Measuring it in
one place means the span and the ledger agree rather than approximately agree.

`tokio::task::spawn_blocking` moves its closure to another thread, and
`tracing`'s current span is thread-local, so the bare form silently drops the
ambient span. Because DuckDB is synchronous the ENTIRE pipeline runs inside
those closures: one missed hop orphans every stage span and every statement
span beneath it from the job that caused them.

Nothing else catches it. No test fails, no type is wrong, every span is still
produced — they are parentless. It does not read as a bug, it reads as tracing
not working. So all 9 hops in er-server move to
`er_obs::spawn_blocking_in_span` (same signature, same JoinHandle, same
panic-as-JoinError contract) and `er-schema/tests/span_boundaries.rs` bans the
bare form, in the shape `freeform_sql.rs` established.

The gate was observed FAILING before being trusted: reintroducing one bare site
named `er-server/src/dispatcher.rs:583` exactly. It also asserts the wrapper is
still used at least 9 times, because proving the bare form absent means nothing
if the hops quietly disappeared.

Found while verifying: with the span list off, a record carried only its
innermost span — so a statement-level event would have said which STAGE it was
in and nothing about the run, job or tenant. That is the attribution the whole
exercise exists for. Every record is now self-describing. It costs bytes, and
the lever against that is the filter, because a cheap line nobody can attribute
is not actually cheap.

One honest limitation: a span filtered out by target drops from the ancestry
too, so a narrow `RUST_LOG=er_cli=info` loses the service identity the process
span carries. The default filter enables it, and Fluent Bit attaches pod
identity independently.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
cargo-deny failed on #408 while passing locally. The CI job pins
RUSTUP_TOOLCHAIN=1.85.0 deliberately — the workflow comment says it is there
"to keep the check evaluating the lockfile" — and on 1.85 an inherited
workspace dependency may not override default-features:

  error inheriting `tokio` from workspace root manifest's
  workspace.dependencies.tokio
  `default-features = false` cannot override workspace's `default-features`

A newer local toolchain accepts it, which is exactly the gap the pin exists to
close. Reproduced verbatim with RUSTUP_TOOLCHAIN=1.85.0 and now green under it:
advisories ok, bans ok, licenses ok, sources ok.

The override was unnecessary anyway. The workspace entry already carries
rt-multi-thread and macros, which is everything `spawn_blocking` and
`#[tokio::test]` need, so `tokio.workspace = true` is both correct and the
house pattern (er-k8s and er-server both inherit and add features, neither
overrides defaults). The dev-dependency went with it as redundant.

Zero lock change; er-obs's 12 tests still pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit a71f3ce into main Nov 3, 2026
34 checks passed
@athvin
athvin deleted the bm/telemetry-p8-spine branch November 3, 2026 00:33
athvin pushed a commit that referenced this pull request Nov 3, 2026
…ey (PR D)

Dataset profiling, fourth of six. The half aimed at the model rather than the
reader: `er profile --tier 2` measures what an equi-join on each plausible
column would cost, and says which one to block on.

This also gives PR A's `estimate_candidate_key`/`rank_candidate_keys` their
first product caller. They shipped with none, which this repo's own rule rejects
— a declared capability nothing honours is the shape the parity program already
found once.

**New entity `candidate_key`.** Per key: exact `expected_pairs` (the sum of
C(n, 2) over the value groups), the largest block, distinct values, entropy in
bits, and `pair_loss_from_nulls`. That last is the number people get wrong: a
key reaches only `fill^2` of the corpus's pairs, so a column 60% populated
reaches 36% — and the pairs it drops are reported nowhere else, which is why the
cost and the loss are stored side by side rather than one of them implied.
`key_columns` is chr(31)-joined because it is in the natural key and DuckLake
has no list equality to MERGE on.

**Candidates come from the tier-1 shape, not from a blind sweep.** A constant
column is the cartesian product and a mostly-empty one cannot reach its pairs;
both already have their own findings, so spending a GROUP BY to rediscover that
would make the deep tier slower for no new information. Capped at 25,
most-selective-first, and the cap is REPORTED — a truncated list that looks
complete is how someone ends up trusting a key nobody measured.

**A `CorpusRule` trait beside `ColumnRule`,** because the two new findings
cannot be answered one column at a time. Whether a corpus is blockable depends
on the BEST column, so a per-column rule would either say nothing or say the
same thing twelve times.

- **P009** — no single column blocks this corpus. Names the closest candidate
  and suggests a composite. Two bars, not one, because the failure modes are
  opposite: too few comparisons eliminated makes the run quadratic, and
  cheap-because-empty makes it miss most of its pairs.
- **P010** — the most selective USABLE key, named with its cost. `info` and
  deliberately positive: a panel that only ever reports problems is one people
  learn to skip, and this is the most actionable line in the profile.

**P010 names the cheapest VIABLE key, never the cheapest overall.** The cheapest
key on a real corpus is very often a column that is almost entirely empty, and
recommending it would recommend a key that cannot see the data. The test pins
it: a `fax` column covering 4% of rows at 500 pairs loses to `email` at
1,000,000.

**Both corpus rules stay silent in two cases, each for its own reason.** Below
~1000 rows the full cartesian product is cheap, so "no good key exists" is true
and useless — a warning on every small dataset teaches people to ignore the
panel. And an EMPTY candidate list means tier 2 did not run, not that nothing
qualified; that distinction is why `findings_with` takes an explicit slice
rather than an `Option`, so a tier-1 caller cannot pass nothing and have it read
as a verdict.

`candidate_keys` is created upfront with the other three profile relations
rather than lazily on first write, so a reader always finds an empty table
instead of a missing one — and it joins `cli_e2e`'s fileless list, because
`er run-all` resolves a corpus and does not describe one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

**Two gradings settled, and one constant replaced.**

The severity scale had three levels and used two: eight warnings, two infos, no
error at all — a declared level nothing honours, which is the shape this repo
rejects elsewhere. Rather than promote P009, which matches the `warning`
definition exactly (it costs recall or runtime; it does not corrupt), the two
rules that genuinely produce a WRONG RESULT are now errors. P004 because
`unknown` equals `unknown`, so records sharing nothing but their missing data
get merged, and an over-merge is the expensive mistake in entity resolution.
P008 because the outcome is not a slow run or a missed match but a row that is
gone, overwritten by whichever copy landed last. Both carry the reason in the
rule, and a test asserts the grading AND that all three levels are in use, so
the scale cannot go decorative again.

The 1000-row floor is removed rather than defended: it had the wrong UNIT.
Blocking defuses a quadratic, so "does this corpus need blocking?" is a question
about pairs, answerable with the same C(n, 2) arithmetic the module already
uses. It is now a 5,000,000-pair budget, anchored to a measurement rather than
picked — `fake_1000` is 1000 rows, so 499,500 unblocked pairs, and it resolves
end to end in well under a second, which makes half a million pairs
demonstrably free; one order of magnitude up is where the cost is worth a
sentence. The test pins it in pairs (3000 rows silent at 4.5M, 4000 rows speaks
at 8M), which a row floor could not express.

Rebased onto main and regenerated: telemetry P8 (#416) wrapped every generated
statement function in an `er_span::sql_span`, and this entity was generated
before that landed, so its upsert lacked one. CI caught it as a stale generated
file — correctly, because it verifies against the merge with current main while
the tree was authored two merges earlier. The new statement now emits a span
like every other one without a line of instrumentation written by hand, which
is what having one generator authority is for.
athvin pushed a commit that referenced this pull request Nov 3, 2026
…ey (PR D)

Dataset profiling, fourth of six. The half aimed at the model rather than the
reader: `er profile --tier 2` measures what an equi-join on each plausible
column would cost, and says which one to block on.

This also gives PR A's `estimate_candidate_key`/`rank_candidate_keys` their
first product caller. They shipped with none, which this repo's own rule rejects
— a declared capability nothing honours is the shape the parity program already
found once.

**New entity `candidate_key`.** Per key: exact `expected_pairs` (the sum of
C(n, 2) over the value groups), the largest block, distinct values, entropy in
bits, and `pair_loss_from_nulls`. That last is the number people get wrong: a
key reaches only `fill^2` of the corpus's pairs, so a column 60% populated
reaches 36% — and the pairs it drops are reported nowhere else, which is why the
cost and the loss are stored side by side rather than one of them implied.
`key_columns` is chr(31)-joined because it is in the natural key and DuckLake
has no list equality to MERGE on.

**Candidates come from the tier-1 shape, not from a blind sweep.** A constant
column is the cartesian product and a mostly-empty one cannot reach its pairs;
both already have their own findings, so spending a GROUP BY to rediscover that
would make the deep tier slower for no new information. Capped at 25,
most-selective-first, and the cap is REPORTED — a truncated list that looks
complete is how someone ends up trusting a key nobody measured.

**A `CorpusRule` trait beside `ColumnRule`,** because the two new findings
cannot be answered one column at a time. Whether a corpus is blockable depends
on the BEST column, so a per-column rule would either say nothing or say the
same thing twelve times.

- **P009** — no single column blocks this corpus. Names the closest candidate
  and suggests a composite. Two bars, not one, because the failure modes are
  opposite: too few comparisons eliminated makes the run quadratic, and
  cheap-because-empty makes it miss most of its pairs.
- **P010** — the most selective USABLE key, named with its cost. `info` and
  deliberately positive: a panel that only ever reports problems is one people
  learn to skip, and this is the most actionable line in the profile.

**P010 names the cheapest VIABLE key, never the cheapest overall.** The cheapest
key on a real corpus is very often a column that is almost entirely empty, and
recommending it would recommend a key that cannot see the data. The test pins
it: a `fax` column covering 4% of rows at 500 pairs loses to `email` at
1,000,000.

**Both corpus rules stay silent in two cases, each for its own reason.** Below
~1000 rows the full cartesian product is cheap, so "no good key exists" is true
and useless — a warning on every small dataset teaches people to ignore the
panel. And an EMPTY candidate list means tier 2 did not run, not that nothing
qualified; that distinction is why `findings_with` takes an explicit slice
rather than an `Option`, so a tier-1 caller cannot pass nothing and have it read
as a verdict.

`candidate_keys` is created upfront with the other three profile relations
rather than lazily on first write, so a reader always finds an empty table
instead of a missing one — and it joins `cli_e2e`'s fileless list, because
`er run-all` resolves a corpus and does not describe one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

**Two gradings settled, and one constant replaced.**

The severity scale had three levels and used two: eight warnings, two infos, no
error at all — a declared level nothing honours, which is the shape this repo
rejects elsewhere. Rather than promote P009, which matches the `warning`
definition exactly (it costs recall or runtime; it does not corrupt), the two
rules that genuinely produce a WRONG RESULT are now errors. P004 because
`unknown` equals `unknown`, so records sharing nothing but their missing data
get merged, and an over-merge is the expensive mistake in entity resolution.
P008 because the outcome is not a slow run or a missed match but a row that is
gone, overwritten by whichever copy landed last. Both carry the reason in the
rule, and a test asserts the grading AND that all three levels are in use, so
the scale cannot go decorative again.

The 1000-row floor is removed rather than defended: it had the wrong UNIT.
Blocking defuses a quadratic, so "does this corpus need blocking?" is a question
about pairs, answerable with the same C(n, 2) arithmetic the module already
uses. It is now a 5,000,000-pair budget, anchored to a measurement rather than
picked — `fake_1000` is 1000 rows, so 499,500 unblocked pairs, and it resolves
end to end in well under a second, which makes half a million pairs
demonstrably free; one order of magnitude up is where the cost is worth a
sentence. The test pins it in pairs (3000 rows silent at 4.5M, 4000 rows speaks
at 8M), which a row floor could not express.

Rebased onto main and regenerated: telemetry P8 (#416) wrapped every generated
statement function in an `er_span::sql_span`, and this entity was generated
before that landed, so its upsert lacked one. CI caught it as a stale generated
file — correctly, because it verifies against the merge with current main while
the tree was authored two merges earlier. The new statement now emits a span
like every other one without a line of instrumentation written by hand, which
is what having one generator authority is for.
athvin pushed a commit that referenced this pull request Nov 3, 2026
…ey (PR D)

Dataset profiling, fourth of six. The half aimed at the model rather than the
reader: `er profile --tier 2` measures what an equi-join on each plausible
column would cost, and says which one to block on.

This also gives PR A's `estimate_candidate_key`/`rank_candidate_keys` their
first product caller. They shipped with none, which this repo's own rule rejects
— a declared capability nothing honours is the shape the parity program already
found once.

**New entity `candidate_key`.** Per key: exact `expected_pairs` (the sum of
C(n, 2) over the value groups), the largest block, distinct values, entropy in
bits, and `pair_loss_from_nulls`. That last is the number people get wrong: a
key reaches only `fill^2` of the corpus's pairs, so a column 60% populated
reaches 36% — and the pairs it drops are reported nowhere else, which is why the
cost and the loss are stored side by side rather than one of them implied.
`key_columns` is chr(31)-joined because it is in the natural key and DuckLake
has no list equality to MERGE on.

**Candidates come from the tier-1 shape, not from a blind sweep.** A constant
column is the cartesian product and a mostly-empty one cannot reach its pairs;
both already have their own findings, so spending a GROUP BY to rediscover that
would make the deep tier slower for no new information. Capped at 25,
most-selective-first, and the cap is REPORTED — a truncated list that looks
complete is how someone ends up trusting a key nobody measured.

**A `CorpusRule` trait beside `ColumnRule`,** because the two new findings
cannot be answered one column at a time. Whether a corpus is blockable depends
on the BEST column, so a per-column rule would either say nothing or say the
same thing twelve times.

- **P009** — no single column blocks this corpus. Names the closest candidate
  and suggests a composite. Two bars, not one, because the failure modes are
  opposite: too few comparisons eliminated makes the run quadratic, and
  cheap-because-empty makes it miss most of its pairs.
- **P010** — the most selective USABLE key, named with its cost. `info` and
  deliberately positive: a panel that only ever reports problems is one people
  learn to skip, and this is the most actionable line in the profile.

**P010 names the cheapest VIABLE key, never the cheapest overall.** The cheapest
key on a real corpus is very often a column that is almost entirely empty, and
recommending it would recommend a key that cannot see the data. The test pins
it: a `fax` column covering 4% of rows at 500 pairs loses to `email` at
1,000,000.

**Both corpus rules stay silent in two cases, each for its own reason.** Below
~1000 rows the full cartesian product is cheap, so "no good key exists" is true
and useless — a warning on every small dataset teaches people to ignore the
panel. And an EMPTY candidate list means tier 2 did not run, not that nothing
qualified; that distinction is why `findings_with` takes an explicit slice
rather than an `Option`, so a tier-1 caller cannot pass nothing and have it read
as a verdict.

`candidate_keys` is created upfront with the other three profile relations
rather than lazily on first write, so a reader always finds an empty table
instead of a missing one — and it joins `cli_e2e`'s fileless list, because
`er run-all` resolves a corpus and does not describe one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

**Two gradings settled, and one constant replaced.**

The severity scale had three levels and used two: eight warnings, two infos, no
error at all — a declared level nothing honours, which is the shape this repo
rejects elsewhere. Rather than promote P009, which matches the `warning`
definition exactly (it costs recall or runtime; it does not corrupt), the two
rules that genuinely produce a WRONG RESULT are now errors. P004 because
`unknown` equals `unknown`, so records sharing nothing but their missing data
get merged, and an over-merge is the expensive mistake in entity resolution.
P008 because the outcome is not a slow run or a missed match but a row that is
gone, overwritten by whichever copy landed last. Both carry the reason in the
rule, and a test asserts the grading AND that all three levels are in use, so
the scale cannot go decorative again.

The 1000-row floor is removed rather than defended: it had the wrong UNIT.
Blocking defuses a quadratic, so "does this corpus need blocking?" is a question
about pairs, answerable with the same C(n, 2) arithmetic the module already
uses. It is now a 5,000,000-pair budget, anchored to a measurement rather than
picked — `fake_1000` is 1000 rows, so 499,500 unblocked pairs, and it resolves
end to end in well under a second, which makes half a million pairs
demonstrably free; one order of magnitude up is where the cost is worth a
sentence. The test pins it in pairs (3000 rows silent at 4.5M, 4000 rows speaks
at 8M), which a row floor could not express.

Rebased onto main and regenerated: telemetry P8 (#416) wrapped every generated
statement function in an `er_span::sql_span`, and this entity was generated
before that landed, so its upsert lacked one. CI caught it as a stale generated
file — correctly, because it verifies against the merge with current main while
the tree was authored two merges earlier. The new statement now emits a span
like every other one without a line of instrumentation written by hand, which
is what having one generator authority is for.
athvin added a commit that referenced this pull request Nov 3, 2026
…ey (PR D) (#410)

Dataset profiling, fourth of six. The half aimed at the model rather than the
reader: `er profile --tier 2` measures what an equi-join on each plausible
column would cost, and says which one to block on.

This also gives PR A's `estimate_candidate_key`/`rank_candidate_keys` their
first product caller. They shipped with none, which this repo's own rule rejects
— a declared capability nothing honours is the shape the parity program already
found once.

**New entity `candidate_key`.** Per key: exact `expected_pairs` (the sum of
C(n, 2) over the value groups), the largest block, distinct values, entropy in
bits, and `pair_loss_from_nulls`. That last is the number people get wrong: a
key reaches only `fill^2` of the corpus's pairs, so a column 60% populated
reaches 36% — and the pairs it drops are reported nowhere else, which is why the
cost and the loss are stored side by side rather than one of them implied.
`key_columns` is chr(31)-joined because it is in the natural key and DuckLake
has no list equality to MERGE on.

**Candidates come from the tier-1 shape, not from a blind sweep.** A constant
column is the cartesian product and a mostly-empty one cannot reach its pairs;
both already have their own findings, so spending a GROUP BY to rediscover that
would make the deep tier slower for no new information. Capped at 25,
most-selective-first, and the cap is REPORTED — a truncated list that looks
complete is how someone ends up trusting a key nobody measured.

**A `CorpusRule` trait beside `ColumnRule`,** because the two new findings
cannot be answered one column at a time. Whether a corpus is blockable depends
on the BEST column, so a per-column rule would either say nothing or say the
same thing twelve times.

- **P009** — no single column blocks this corpus. Names the closest candidate
  and suggests a composite. Two bars, not one, because the failure modes are
  opposite: too few comparisons eliminated makes the run quadratic, and
  cheap-because-empty makes it miss most of its pairs.
- **P010** — the most selective USABLE key, named with its cost. `info` and
  deliberately positive: a panel that only ever reports problems is one people
  learn to skip, and this is the most actionable line in the profile.

**P010 names the cheapest VIABLE key, never the cheapest overall.** The cheapest
key on a real corpus is very often a column that is almost entirely empty, and
recommending it would recommend a key that cannot see the data. The test pins
it: a `fax` column covering 4% of rows at 500 pairs loses to `email` at
1,000,000.

**Both corpus rules stay silent in two cases, each for its own reason.** Below
~1000 rows the full cartesian product is cheap, so "no good key exists" is true
and useless — a warning on every small dataset teaches people to ignore the
panel. And an EMPTY candidate list means tier 2 did not run, not that nothing
qualified; that distinction is why `findings_with` takes an explicit slice
rather than an `Option`, so a tier-1 caller cannot pass nothing and have it read
as a verdict.

`candidate_keys` is created upfront with the other three profile relations
rather than lazily on first write, so a reader always finds an empty table
instead of a missing one — and it joins `cli_e2e`'s fileless list, because
`er run-all` resolves a corpus and does not describe one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

**Two gradings settled, and one constant replaced.**

The severity scale had three levels and used two: eight warnings, two infos, no
error at all — a declared level nothing honours, which is the shape this repo
rejects elsewhere. Rather than promote P009, which matches the `warning`
definition exactly (it costs recall or runtime; it does not corrupt), the two
rules that genuinely produce a WRONG RESULT are now errors. P004 because
`unknown` equals `unknown`, so records sharing nothing but their missing data
get merged, and an over-merge is the expensive mistake in entity resolution.
P008 because the outcome is not a slow run or a missed match but a row that is
gone, overwritten by whichever copy landed last. Both carry the reason in the
rule, and a test asserts the grading AND that all three levels are in use, so
the scale cannot go decorative again.

The 1000-row floor is removed rather than defended: it had the wrong UNIT.
Blocking defuses a quadratic, so "does this corpus need blocking?" is a question
about pairs, answerable with the same C(n, 2) arithmetic the module already
uses. It is now a 5,000,000-pair budget, anchored to a measurement rather than
picked — `fake_1000` is 1000 rows, so 499,500 unblocked pairs, and it resolves
end to end in well under a second, which makes half a million pairs
demonstrably free; one order of magnitude up is where the cost is worth a
sentence. The test pins it in pairs (3000 rows silent at 4.5M, 4000 rows speaks
at 8M), which a row floor could not express.

Rebased onto main and regenerated: telemetry P8 (#416) wrapped every generated
statement function in an `er_span::sql_span`, and this entity was generated
before that landed, so its upsert lacked one. CI caught it as a stale generated
file — correctly, because it verifies against the merge with current main while
the tree was authored two merges earlier. The new statement now emits a span
like every other one without a line of instrumentation written by hand, which
is what having one generator authority is for.

Co-authored-by: bmoore813 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants