{
  "version": "r1",
  "status": "frozen before any sampled repository is cloned or measured",
  "question": "In public data transformation projects built with dbt, how many models have any test, how many check their keys, how many projects declare source freshness, and how many run tests before a change merges?",
  "qualifying_rule": "qualify-r1.json (committed earlier, before any repository was listed)",
  "sample": {
    "size": 300,
    "draw": "random.Random(20261110).sample over the qualifying repositories sorted by repository id, when more than 300 qualify; all of them otherwise",
    "stop_if_fewer_than": 200,
    "lost_after_draw": "a sampled repository that cannot be cloned is recorded as lost and not replaced"
  },
  "clone": {
    "how": "git clone --depth 1 --filter=blob:none --sparse, then sparse-checkout (no-cone) of *.yml, *.yaml, *.sql, *.py and CI files; the clone is deleted as soon as its measures are written",
    "kept": "one JSON row of counts per repository, in private scratch; public files hold aggregates only"
  },
  "definitions": {
    "project": "the dbt_project.yml chosen by the qualifying rule; its model folders are model-paths (default models/), its test folders test-paths (default tests/)",
    "model": "a .sql or .py file under the project's model folders; its name is the file name without extension",
    "test_attached_to_model": [
      "a generic data test listed under tests: or data_tests: on a model entry, or on any of its columns, in a properties file (.yml or .yaml anywhere in the project) under a top-level models: key, matched to a model by name",
      "a singular test: a .sql file under the project's test folders, not defining a generic test ({% test ...%}), that calls ref() on the model",
      "a unit test: an entry under a top-level unit_tests: key whose model: names the model"
    ],
    "key_test": "a model has a key test when one of its columns has both a unique test and a not_null test (any namespace), or the model has a unique_combination_of_columns test (any namespace), or a column or the model has a primary_key test (any namespace)",
    "source_freshness": "the project declares freshness: with a value other than null on at least one source or source table in a sources: block of a properties file, or under sources: in dbt_project.yml",
    "tests_in_ci_before_merge": "the repository has a GitHub Actions workflow (.github/workflows/*.yml or *.yaml) whose triggers include pull_request, pull_request_target or merge_group, and whose text runs a dbt command that runs tests: dbt test or dbt build, optionally with flags between dbt and the subcommand",
    "examples": {
      "counts_as_any_test": "columns: [{name: id, tests: [unique]}] on model orders; or tests/assert_orders_positive.sql containing ref('orders')",
      "counts_as_key_test": "column id with tests [unique, not_null]; or model-level dbt_utils.unique_combination_of_columns",
      "not_a_key_test": "column id with unique only; column id with not_null and a different column with unique",
      "counts_as_ci": "on: pull_request, step run: dbt build --select state:modified+",
      "not_ci": "on: push to main only with dbt build (runs after merge); on: pull_request with sqlfluff lint only; a hosted scheduler's CI job configured outside the repository"
    }
  },
  "measures": {
    "M1_tested_share": "per project, models with at least one attached test divided by models",
    "M2_key_share": "per project, models with a key test divided by models",
    "M3_freshness": "per project, yes or no",
    "M4_ci_before_merge": "per project, yes or no"
  },
  "secondary_descriptives": [
    "M1 and M2 pooled over all models of all projects (models weighted equally), shown beside the per-project medians",
    "share of projects with any test at all, with any key test at all",
    "CI that runs tests on push only; any GitHub Actions workflow that runs dbt at all; another CI system's file at the repository root (Jenkinsfile, .circleci/, azure-pipelines*.yml, bitbucket-pipelines.yml, .drone.yml, .buildkite/, a root dotfile named *-ci.yml) whose text runs dbt test or build",
    "unit tests: share of projects with any"
  ],
  "intervals": {
    "method": "percentile bootstrap, 4000 resamples, seed 7",
    "unit_of_resampling": "owner (the account that owns the repository), since one owner can hold several sampled projects; the plain interval resampling projects is computed too, and the wider of the two is published",
    "covers": "the qualifying public repositories in the frame; nothing outside it"
  },
  "lookup": "a reader enters models, models with any test, models with a key test, freshness yes or no and CI yes or no; the page shows the share of the sampled projects below, equal to and above their two shares, and the share of projects with freshness and with CI",
  "fixed_in_advance": {
    "headline_shape": "the median project's M1, then the share of projects meeting M3 and M4, with M2's median beside them",
    "takeaway_figure": "four horizontal bars, one per measure, each the share of projects that meet it: M1 at half or more of models tested, M2 at half or more of models key-tested, M3, M4",
    "nothing_named": "no repository, owner or project appears in any public file"
  },
  "limits_declared_before_results": [
    "public repositories are not company projects: many companies keep theirs private, and the public ones over-represent open-source data teams, consultancies and side projects",
    "CI run by a hosted scheduler outside the repository, or through a script or Makefile, is not seen, so M4 is a floor",
    "tests defined only in a package's macros applied without YAML, and tests kept outside the repository, are not seen",
    "code search indexes default branches only, and its ranges above 1,000 files are cut at the cap"
  ]
}
