Skip to content

test(compiler): cover every discovery input in the compiler differential - #994

Merged
kvlonge merged 5 commits into
mainfrom
test/differential-discovery-coverage
Oct 7, 2026
Merged

kvlonge merged 5 commits into
mainfrom
test/differential-discovery-coverage

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Why

Native discovery (M2) will replace discover_project_inputs. First the compiler differential must exercise every input discovery reads and every discovery-time diagnostic, so native differences cannot hide.

Changes

  • Generator: stride-forced blocks so any four consecutive seeds cover incremental strategies, microbatch, snapshots, Python hooks, loaders, assets, checks, audit factories, providers, sinks, custom materializations, a project adapter, model schemas, list constants, cross-file macro imports, macro/udf/parameterized tests, generic audits, functions, local config, target overrides, CRLF, tabs, a YAML BOM and non-ASCII text. One seed in twelve uses a dbt ref with a synthetic manifest: compile fails with C214 by design, plan must pass.
  • Coverage: each seed's discovery capture is classified into kinds (encoded empty sets and mappings count as absent; CRLF only for files discovery read). --require-discovery-coverage, on in per-PR CI, fails and prints FAILED when a kind is missing. Adapter and dbt kinds are reported as config-only.
  • Failure corpus: 37 discovery cases reaching every DiscoveryError code. The gate now requires the expected code to be the first error; warnings are declared separately.
  • Tests: discovery captures are complete and canonical, a perturbed native discovery is reported at its capture, and the real corpus run emits every discovery code.
  • Helpers regrouped into buckets. No product code changes.

Verification

  • Per-PR corpus with captures: 106 projects identical, 66 of 66 kinds. Same machine: median wall 67.6 s to 87.8 s (+30%), CPU 191 s to 257 s (+35%).
  • Focused tests, ruff, ty, fensu check, make check-ci and the hygiene scan pass. make test passes.

Split the flat _helpers package into comparing, corpus and running buckets
so it can grow without exceeding the helpers container limit. Tests mirror
the new layout with local test-case types. No behaviour change.
Add stride-forced feature blocks to the seeded project generator so any four
consecutive seeds exercise incremental strategies, microbatch, snapshots,
Python hooks, loaders, assets, checks, audit factories, providers, sinks,
custom materializations, a project-local adapter, model schemas, list
constants, cross-file macro imports, macro/udf/parameterized tests, generic
audits, functions, local config, target overrides, CRLF/tab/BOM input and
non-ASCII comments and strings. Seed 1 of every twelve uses a dbt ref with a
synthetic manifest: compile fails with C214 by design and plan must succeed.

Classify each seed's DiscoveredProjectInputs stage capture into input kinds
and report coverage; --require-discovery-coverage fails the run when a kind
derived from the discovery dataclass or the detail list is missing.
Add minimal failing projects for every discovery error code (D001-D009,
D011-D016) across config, SQL, YAML, conflict and Python families, including
BOM-prefixed TOML and SQL.

Tighten the corpus gate: the expected code must be the first error the
engine reports, and a case that intends a warning declares it separately.
built-in-audit-shadow now expects S010 as the error and P003 as a warning.
Add a helper that runs the corpus and returns the codes each case emits.
Check that a project with every feature block yields a discovery capture
with every collection populated, no opaque or cyclic values and callables
replaced by qualified names, and that a perturbed native discovery result
is reported at the discovered_project_inputs capture.

Run the failure corpus for real and assert each case emits its declared
first error, walking every DiscoveryError subclass to require each code.
Prove a code reported only as a warning fails the gate and that missing
required coverage exits 1 without reporting success.
@kvlonge
kvlonge enabled auto-merge (squash) October 7, 2026 02:10
@kvlonge
kvlonge merged commit e89dafd into main Oct 7, 2026
34 checks passed
@kvlonge
kvlonge deleted the test/differential-discovery-coverage branch October 7, 2026 02:34
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.

1 participant