Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 80 additions & 18 deletions docs/design/track_b_holdout_registry_mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"schema_version": 1,
"verification_class": "accounting conformance",
"admitted_scope": "The held-out data registry's rules on invented registries, temporary git repositories and the committed registry; no population, behavioral or forecast claim.",
"mutation_method": "One deliberate production-line change per check; both registry test modules run in full and are expected to fail; original bytes restored before the next check. No mutated implementation is committed.",
"mutation_method": "One deliberate production-line change per check; both registry test modules run in full and are expected to fail; original bytes restored before the next check. Failed test ids are pytest's own report node ids, written by a reporting plugin, not parsed from summary lines. No mutated implementation is committed.",
"restored_source_sha256": {
"src/populace_dynamics/track_b/holdout_registry.py": "a1fd1d999f59abecb6a8ca08801a7b2bbf7c4960cf3581f8c77e6cf2972ee354"
"src/populace_dynamics/track_b/holdout_registry.py": "9ca7fc52839d637f29596f369578ff255a528114fe8956c767e4fb3d84ddac5d"
},
"checks": [
{
Expand Down Expand Up @@ -42,7 +42,8 @@
"tests/test_track_b_holdout_registry.py::test_keys_overlap_on_source_and_intersecting_years",
"tests/test_track_b_holdout_registry.py::test_settled_registries_are_valid",
"tests/test_track_b_holdout_registry.py::test_shared_units_match_the_independent_rule",
"tests/test_track_b_holdout_registry_committed.py::test_the_committed_registry_keeps_its_rules"
"tests/test_track_b_holdout_registry_committed.py::test_the_committed_registry_keeps_its_rules",
"tests/test_track_b_holdout_registry_committed.py::test_the_committed_registry_only_appends_to_its_base"
]
},
{
Expand Down Expand Up @@ -302,8 +303,8 @@
},
{
"mutation": "entries without ids reach diagnostics",
"old": "isinstance(entry, Mapping) and isinstance(entry.get(\"id\"), str)",
"new": "isinstance(entry, Mapping)",
"old": "isinstance(entry, Mapping) and isinstance(entry.get(\"id\"), str)\n for entry in entries\n",
"new": "isinstance(entry, Mapping)\n for entry in entries\n",
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
Expand Down Expand Up @@ -575,6 +576,10 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_repeated_id_or_rule_is_reported[rule]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_in_the_pull_requests_own_order_waits_for_the_end[rules]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_keeps_each_copy_of_a_repeated_rule[drops_a_copy-inner]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_keeps_each_copy_of_a_repeated_rule[drops_a_copy-trailing]",
"tests/test_track_b_holdout_registry.py::test_sources_rules_and_completeness_only_move_forward"
]
},
Expand Down Expand Up @@ -605,10 +610,20 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_landed_branch_is_merged_in_the_landed_order[branch]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_failing_own_commit_unions_the_last_valid[drop]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_cannot_drop_the_pull_requests_own_entry",
"tests/test_track_b_holdout_registry.py::test_a_merge_of_contained_history_keeps_its_own_predecessor",
"tests/test_track_b_holdout_registry.py::test_a_push_compares_with_its_before_commit",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[False-append_then_remove]",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[True-append_then_remove]",
"tests/test_track_b_holdout_registry.py::test_a_stale_landed_branch_cannot_drop_what_the_pull_request_holds",
"tests/test_track_b_holdout_registry.py::test_an_entry_a_landed_merge_adds_is_held_from_then_on",
"tests/test_track_b_holdout_registry.py::test_an_octopus_of_a_landed_and_a_contained_parent_is_one_line",
"tests/test_track_b_holdout_registry.py::test_any_json_in_any_field_is_reported_not_raised",
"tests/test_track_b_holdout_registry.py::test_only_commits_that_remove_or_rewrite_entries_are_reported",
"tests/test_track_b_holdout_registry.py::test_own_commits_after_a_master_merge_are_checked[drop_landed]",
"tests/test_track_b_holdout_registry.py::test_own_commits_after_a_master_merge_are_checked[merge_drops_landed]",
"tests/test_track_b_holdout_registry.py::test_removing_or_reordering_entries_is_refused",
"tests/test_track_b_holdout_registry.py::test_the_base_branch_compares_with_its_parent"
]
Expand All @@ -620,11 +635,18 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_first_commit_that_merges_unlanded_history_starts_at_the_fork[rewrite]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_failing_own_commit_unions_the_last_valid[rewrite]",
"tests/test_track_b_holdout_registry.py::test_a_pull_request_cannot_hide_a_change_it_undoes[False]",
"tests/test_track_b_holdout_registry.py::test_a_pull_request_cannot_hide_a_change_it_undoes[True]",
"tests/test_track_b_holdout_registry.py::test_a_push_is_compared_from_its_before_commit[rewrite]",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[False-edit_then_restore]",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[True-edit_then_restore]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[24]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[35]",
"tests/test_track_b_holdout_registry.py::test_changing_an_earlier_entry_is_refused",
"tests/test_track_b_holdout_registry.py::test_only_commits_that_remove_or_rewrite_entries_are_reported",
"tests/test_track_b_holdout_registry.py::test_own_commits_after_a_master_merge_are_checked[rewrite]",
"tests/test_track_b_holdout_registry.py::test_sha256_object_ids_bound_histories"
]
},
Expand All @@ -635,6 +657,7 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_keeps_the_pull_requests_own_extensions[drops]",
"tests/test_track_b_holdout_registry.py::test_extending_lists_never_shrink"
]
},
Expand Down Expand Up @@ -667,7 +690,7 @@
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_push_compares_with_its_before_commit",
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}]",
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"created\": true}]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[24]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[35]",
"tests/test_track_b_holdout_registry.py::test_sha256_object_ids_bound_histories"
Expand All @@ -693,8 +716,11 @@
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_clean_history_has_no_problems",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_an_own_registry_with_malformed_sources",
"tests/test_track_b_holdout_registry.py::test_a_pull_request_compares_with_its_merge_base",
"tests/test_track_b_holdout_registry_committed.py::test_the_committed_registry_only_appends_to_its_base"
"tests/test_track_b_holdout_registry.py::test_a_pull_request_from_before_the_registry_passes[False]",
"tests/test_track_b_holdout_registry.py::test_a_pull_request_from_before_the_registry_passes[True]",
"tests/test_track_b_holdout_registry.py::test_only_commits_that_remove_or_rewrite_entries_are_reported"
]
},
{
Expand Down Expand Up @@ -783,14 +809,29 @@
},
{
"mutation": "history checks only the endpoint",
"old": "previous_commit, previous = commit, current",
"new": "previous_commit = commit",
"old": "previous_label, previous = label, current",
"new": "previous_label = label",
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_clean_history_has_no_problems",
"tests/test_track_b_holdout_registry.py::test_a_conflicting_landed_merge_leaves_the_union_as_predecessor",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_failing_own_commit_unions_the_last_valid[drop]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_repeated_id_or_rule_is_reported[id]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_a_repeated_id_or_rule_is_reported[rule]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_after_an_own_registry_with_malformed_sources",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_cannot_drop_the_pull_requests_own_entry",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_cannot_reorder_the_pull_requests_own_entries",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_in_the_pull_requests_own_order_waits_for_the_end[entries]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_in_the_pull_requests_own_order_waits_for_the_end[rules]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_keeps_the_pull_requests_own_extensions[diverges]",
"tests/test_track_b_holdout_registry.py::test_a_landed_merge_keeps_the_pull_requests_own_extensions[drops]",
"tests/test_track_b_holdout_registry.py::test_a_merge_of_unlanded_history_extends_its_own_predecessor[False]",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[False-append_then_remove]",
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[True-append_then_remove]"
"tests/test_track_b_holdout_registry.py::test_a_run_of_commits_cannot_hide_a_change_it_undoes[True-append_then_remove]",
"tests/test_track_b_holdout_registry.py::test_a_stacked_pull_request_stays_valid_once_its_base_lands[landed]",
"tests/test_track_b_holdout_registry.py::test_a_stacked_pull_request_stays_valid_once_its_base_lands[own]",
"tests/test_track_b_holdout_registry.py::test_an_entry_a_landed_merge_adds_is_held_from_then_on"
]
},
{
Expand All @@ -800,9 +841,7 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"}]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[24]",
"tests/test_track_b_holdout_registry.py::test_a_transient_failure_at_the_push_boundary_raises[35]"
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\", \"created\": true}]"
]
},
{
Expand All @@ -812,9 +851,8 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"HEAD\"}]",
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": null}]",
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{}]"
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": \"HEAD\", \"created\": true}]",
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[{\"before\": null, \"created\": true}]"
]
},
{
Expand All @@ -824,8 +862,8 @@
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[[]",
"tests/test_track_b_holdout_registry.py::test_an_unreadable_pull_request_event_raises[[]"
"tests/test_track_b_holdout_registry.py::test_a_push_without_a_resolvable_before_raises[[]]",
"tests/test_track_b_holdout_registry.py::test_an_unreadable_pull_request_event_raises[[]]"
]
},
{
Expand All @@ -852,6 +890,30 @@
"tests/test_track_b_holdout_registry.py::test_a_failed_object_hash_fails_closed[failure1]",
"tests/test_track_b_holdout_registry.py::test_a_failed_object_hash_fails_closed[failure2]"
]
},
{
"mutation": "an unset event path leaks TypeError",
"old": " except (TypeError, ValueError, OSError) as error:\n raise LookupError(f\"cannot read the GitHub event: {error}\") from None",
"new": " except (ValueError, OSError) as error:\n raise LookupError(f\"cannot read the GitHub event: {error}\") from None",
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_an_unset_event_path_raises[pull_request]",
"tests/test_track_b_holdout_registry.py::test_an_unset_event_path_raises[push]"
]
},
{
"mutation": "a zero push boundary falls back without created",
"old": " if event.get(\"created\") is not True:\n raise LookupError(\n \"an all-zero before commit needs a push that creates its \"\n \"branch\"\n )\n",
"new": "",
"command": "PYTHONPATH=$PWD/src OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 OMP_WAIT_POLICY=PASSIVE python -m pytest -q -p no:cacheprovider -rf tests/test_track_b_holdout_registry.py tests/test_track_b_holdout_registry_committed.py",
"exit_code": 1,
"failed_tests": [
"tests/test_track_b_holdout_registry.py::test_a_zero_push_boundary_needs_a_created_branch[1]",
"tests/test_track_b_holdout_registry.py::test_a_zero_push_boundary_needs_a_created_branch[False]",
"tests/test_track_b_holdout_registry.py::test_a_zero_push_boundary_needs_a_created_branch[None]",
"tests/test_track_b_holdout_registry.py::test_a_zero_push_boundary_needs_a_created_branch[true]"
]
}
]
}
19 changes: 14 additions & 5 deletions src/populace_dynamics/track_b/holdout_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,22 +1378,26 @@ def base_commit(repository: Path) -> str:

- On a push (``GITHUB_EVENT_NAME=push``), the event's ``before``
commit, which was the branch tip before the push. An all-zero
``before`` (a branch's first push) falls through to the merge base.
``before`` falls through to the merge base only when the event
says the push created the branch (``created`` is true), as on a
branch's first push.
- Otherwise, the merge base of ``HEAD`` and the base branch
(``GITHUB_BASE_REF`` on a pull request, otherwise ``master``),
preferring its ``origin/`` ref.
- When that merge base is ``HEAD`` itself, as on the base branch, its
first parent.

Raises ``LookupError`` when none of these resolves, and on a push
whose event cannot be read or whose ``before`` commit does not
resolve: a push is compared with its own boundary, never with a
nearer commit that would check less history."""
whose event cannot be read, whose ``before`` commit does not
resolve, or whose all-zero ``before`` comes without ``created``: a
push is compared with its own boundary, never with a nearer commit
that would check less history."""
head = _commit(repository, "HEAD")
if head is None:
raise LookupError(f"no HEAD in {repository}")
if os.environ.get("GITHUB_EVENT_NAME") == "push":
before = _event().get("before")
event = _event()
before = event.get("before")
if not isinstance(before, str) or SHA_RX.fullmatch(before) is None:
raise LookupError("the push event names no before commit")
if set(before) != {"0"}:
Expand All @@ -1402,6 +1406,11 @@ def base_commit(repository: Path) -> str:
f"the push's before commit {before} does not resolve"
)
return before
if event.get("created") is not True:
raise LookupError(
"an all-zero before commit needs a push that creates its "
"branch"
)
branch = os.environ.get("GITHUB_BASE_REF") or "master"
for ref in (f"origin/{branch}", branch):
found = _git(repository, "merge-base", "HEAD", ref)
Expand Down
4 changes: 2 additions & 2 deletions tests/README-tiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pytest --collect-only -q -m oracle_policyengine | tail -1

| Tier | Tests at HEAD |
|---|---:|
| `unit` | 18,780 |
| `unit` | 18,789 |
| `artifact` | 4,271 |
| `integration_psid` | 1,471 |
| `reproduction_legacy` | 520 |
| `oracle_policyengine` | 308 |
| **Total** | **25,350** |
| **Total** | **25,359** |
Loading
Loading