# Version 2 of the measurement, and two checks on it: declaration

Committed after the round 1 results were published to reviewers and before any code for version 2 is written or run.
Round 1's results (`results/summary.json`, measured by `tools/measure.py`) stay frozen and stay the page's headline.
Version 2 and the two checks are scored beside them, and the page says they were added after the results.

## Why

Two reviews found blind spots in the file reader that round 1 used, and asked how its counts compare with an
independent count and whether a detected pull-request workflow really runs on pull requests:

- a global flag that takes a spaced value (`dbt --profiles-dir . build`) is not matched;
- a command printed by `echo`, or run in a job limited to push events, is matched;
- versioned models (`orders_v2.sql` declared as `name: orders` with `versions:`) lose their tests;
- projects from before dbt 1.0 keep singular tests in `test/`, which round 1 did not read.

## Version 2 (tools/measure_v2.py)

Everything as in round 1, except:

1. Tests before merge: a GitHub Actions job counts when the workflow is triggered by pull_request,
   pull_request_target or merge_group; the job's `if:` (when present) does not limit it to push, schedule, release or
   manual events or to tags or one branch's pushes (an `if:` that mentions push, schedule, workflow_dispatch, release or
   refs/ without mentioning pull_request excludes the job); and one of its steps' `run:` text, outside lines that
   start with echo or printf, runs dbt test or dbt build, with any flags between dbt and the subcommand, a flag's value
   given after a space or an equals sign.
2. Singular tests are read from the test paths, and from `test/` too when the project sets no test-paths and has no
   `tests/` folder.
3. A properties entry with `versions:` attaches its model-level and column tests to every file named
   `<name>_v<version>`, and to `<name>`, that exists as a model.

## Check 1: dbt's own parser

On a random 40 of the 265 measured projects (`random.Random(20261112).sample` over the measured repository ids sorted
ascending), dbt-core's parser reads the project (dbt deps, then dbt parse, with a placeholder DuckDB profile and the
version check off). For each project it parses, the share of models with any test and with a key test is computed
from its manifest by the protocol's definitions (generic tests attached to the model, singular tests depending on
it, unit tests; unique and not_null on one column, or a compound-key or primary-key test) and compared with round 1's
and version 2's shares: the share of projects within 5 points, the median absolute difference, and the direction of
the differences. Projects the parser cannot read (old syntax, missing variables or packages) are counted and reported,
not replaced.

## Check 2: runs on record

For every project that round 1 or version 2 counts as running tests before merge, the GitHub Actions runs API is
asked whether the matching workflow has at least one run triggered by a pull request. The share with such a run is
reported.

## Reporting

Round 1's figures stay in the headline. Version 2's four measures, the parser agreement and the runs check are shown
next to them in the evidence and in the method, with this declaration linked. If version 2 moves a headline figure by
more than its interval's half-width, the first screen says so.
