mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-05 02:24:12 +01:00
Merge pull request #685 from elder-plinius/fix/679-duration-budget-rebaseline
ci(policy): rebaseline release duration budgets, speed up slow tests, enforce per-test budgets on PRs
This commit is contained in:
11 files changed
+495
-91
No files matched your search
@@ -613,6 +613,31 @@ jobs:
|
||||
- name: Validate PR partition evidence
|
||||
run: '"$TEST_ENV/bin/python" scripts/check_pr_partitions.py'
|
||||
|
||||
- name: Enforce per-test duration budgets on PR partitions
|
||||
# PR shards run a subset (core + risk-map selection), so suite and marker
|
||||
# totals stay release-only; each testcase must meet its release budget.
|
||||
run: |
|
||||
mapfile -t coverage_files < test-results/accepted-coverage.txt
|
||||
test "${#coverage_files[@]}" -gt 0
|
||||
status=0
|
||||
for data in "${coverage_files[@]}"; do
|
||||
directory="$(dirname "$data")"
|
||||
partition="$(basename "$data" .data)"
|
||||
partition="${partition#coverage-}"
|
||||
trend="test-results/test-trend-pr-$partition.json"
|
||||
"$TEST_ENV/bin/python" scripts/write_test_evidence.py \
|
||||
--junit "$directory/junit-$partition.xml" \
|
||||
--head-sha "$CANDIDATE_SHA" \
|
||||
--base-sha "$COVERAGE_BASE" \
|
||||
--python-version 3.12 \
|
||||
--output "$trend" || status=1
|
||||
"$TEST_ENV/bin/python" scripts/check_quality_policy.py \
|
||||
--policy ci/test-quality-policy.json \
|
||||
--evidence "$trend" \
|
||||
--testcase-budgets-only || status=1
|
||||
done
|
||||
exit "$status"
|
||||
|
||||
- name: Combine accepted partition coverage
|
||||
run: |
|
||||
mapfile -t coverage_files < test-results/accepted-coverage.txt
|
||||
|
||||
+36
-23
@@ -103,7 +103,12 @@ PR core tests and Gloo tests share one selection, balanced using
|
||||
`ci/core-test-durations.json` and `ci/gloo-test-durations.json` respectively.
|
||||
`CORE_SHARD_COUNT` and `GLOO_SHARD_COUNT` in CI control the matrices. The required
|
||||
"Pull request core" gate validates every shard's candidate-bound evidence before
|
||||
combining coverage and enforcing the changed-line floor.
|
||||
combining coverage and enforcing the changed-line floor. It also enforces the
|
||||
release per-test duration budgets on each passing shard's JUnit: every testcase
|
||||
must stay within the 15 s default or its owned slow-test budget in
|
||||
[`ci/test-quality-policy.json`](ci/test-quality-policy.json). A pull request runs
|
||||
only the core suite plus its risk-map selection, so the suite and per-marker
|
||||
totals stay release-only and cannot fail a pull request.
|
||||
|
||||
These values are floors, not targets. A change should strengthen behavioral
|
||||
confidence rather than consume existing margin.
|
||||
@@ -128,9 +133,11 @@ Gloo test ran in a shard, then combines the shard coverage with its own before
|
||||
enforcing the floors. For the Python 3.12 touched-module comparison,
|
||||
`release-base-core` and matching base Gloo shards rerun the exact base suite in
|
||||
parallel, so the comparison stays like-for-like.
|
||||
Gloo testcases count toward the per-test and marker duration budgets. The suite
|
||||
budget measures the `Tests` job's own run; the parallel Gloo shards are bounded by
|
||||
their timeouts instead.
|
||||
Gloo testcases count toward the per-test, marker and suite duration budgets. Every
|
||||
duration budget reads the combined release JUnit of the core and Gloo shards, so the
|
||||
suite budget is a serial sum of testcase time, not wall-clock time; each shard's
|
||||
wall clock is bounded by its job timeout instead. Suite and marker limits are set
|
||||
per Python version at the slowest measured hosted release run plus 25%.
|
||||
|
||||
The complete lifecycle, acceptance states, immutable-tag rule, artifact reuse rule,
|
||||
and publication gates are documented in
|
||||
@@ -167,28 +174,34 @@ uv run --extra dev python scripts/check_conditional_policy.py
|
||||
|
||||
### Reviewing owned slow tests
|
||||
|
||||
Issue [#306](https://github.com/elder-plinius/OBLITERATUS/issues/306) tracks seven
|
||||
release-lane cases in `owned_slow_tests`. Their existing budgets expire on
|
||||
2027-01-12; source-level improvements do not justify renewing or removing them.
|
||||
Collect fresh GitHub-hosted Python 3.10–3.12 JUnit timings for the exact candidate,
|
||||
including fixture setup and teardown, before changing ownership or limits.
|
||||
Local timings are diagnostic evidence only.
|
||||
Issue [#679](https://github.com/elder-plinius/OBLITERATUS/issues/679) owns every
|
||||
release-lane case in `owned_slow_tests` (24 cases): each test whose slowest
|
||||
GitHub-hosted sample, across every available release run and its head and base
|
||||
lanes, plus 25% exceeds the 15 s default. A budget is that slowest sample plus 25%,
|
||||
rounded up to 5 s with a 20 s floor, and expires 90 days after it opens
|
||||
(2027-02-23 for the current set). Suite and marker limits use the same slowest
|
||||
sample plus 25%. Collect fresh hosted Python 3.11–3.12 JUnit timings for the exact
|
||||
candidate, including fixture setup and teardown, before changing ownership or
|
||||
limits; drop a budget only when its test measures comfortably below 12 s in every
|
||||
lane. Local timings are diagnostic evidence only.
|
||||
|
||||
| Case | Avoidable work and remaining boundary |
|
||||
| Cases | Remaining boundary |
|
||||
|---|---|
|
||||
| Offline checkpoint-to-report CLI | Combine environment/origin probes and avoid a duplicate model reload. Keep separate isolated `python -I -m obliteratus` mutation and study commands, offline homes, real checkpoint reload and report assertions. Interpreter/torch startup remains. |
|
||||
| Rank-local manifest determinism | Share the first successful group with the manifest tiling assertions. Still compare two independent spawned two-rank Gloo groups and rendezvous files. Running determinism alone still needs both groups. |
|
||||
| Bounded rank hang | Keep the intentional seven-second rank sleep, five-second process-group timeout, twelve-second operation bound and failure assertions. Cold start has its own twenty-second bound. |
|
||||
| Repository sentence scan | Incrementally hash overlapping prose windows. Keep the tracked-file inventory, all directory scopes, existing binary/size exclusions, structured parsers, sentence normalization and 32-line wrapping coverage. This guard does not replace supply-chain secret or vulnerability scans. |
|
||||
| Disk-offloaded export RSS | Already measures native then legacy in one fresh interpreter against one real offloaded model, resetting the high-water mark between modes. Keep the model size, allocation bounds and legacy negative control. Import, disk I/O and native allocation measurement remain. |
|
||||
| Installed-wheel model info CLI | Combine environment/origin probes. Keep the installed-artifact origin check and isolated offline CLI process outside the repository. Interpreter/torch startup remains. |
|
||||
| Missing-rank preflight | Keep the real five-second Gloo rendezvous timeout, quarantine, worker reaping and failure assertions. The launcher has a forty-second outer bound. |
|
||||
| Refusal-pack legacy extractor; v1/v2 recipe application | Full tiny-model pipelines whose per-batch `gc.collect()` scales with the session heap, so timings vary with partition contents. Tracked as a follow-up to #679; do not trim these budgets from a single sample. |
|
||||
| CPU rehearsal fresh reload (cpu, disk) | A supervisor plus four fresh prepare/reference/edit/reload interpreters per parameter. Interpreter, transformers and coverage startup remain. |
|
||||
| Offline checkpoint-to-report CLI | Separate isolated `python -I -m obliteratus` mutation and study commands, offline homes, real checkpoint reload and report assertions. Interpreter/torch startup remains. |
|
||||
| Smaller-change rank1, low variance, failing collateral | Each builds its geometry environment on first use from the lazy module fixture. Rank1 keeps its pre-speedup budget until a release run confirms the speedup. |
|
||||
| Transactional preconditions | The first test of the module carries its shared fixture: three eligible keys, five verified candidates and three interaction runs. |
|
||||
| Recipe-search evaluator stop error | Real step subprocesses, including the verify-edit CLI. Keeps its pre-speedup budget until a release run confirms the lighter edit-step helper. |
|
||||
| Bounded rank hang; missing-rank preflight | The intentional rank sleep, process-group timeout, operation bound, real Gloo rendezvous timeout, quarantine and worker reaping are the proof. |
|
||||
| Repository sentence scan | The tracked-file inventory, all directory scopes, structured parsers and sentence normalization. |
|
||||
| Disk-offloaded export RSS | Native then legacy export in one fresh interpreter on a real offloaded model. |
|
||||
| Other cases at 12–19 s (precision pilots, regression library, backend qualification, mutation search, acquisition ingest, release Gloo collection, rank-local reload guards, verification retry) | Owned because measured +25% exceeds 15 s; review each against fresh hosted timings. |
|
||||
|
||||
All seven still need fresh hosted timing. In particular, intentional hang and
|
||||
missing-rank failures spend real time proving their timeout contracts; shortening
|
||||
those waits or mocking Gloo changes the proof. RSS and installed-wheel cases
|
||||
also retain process isolation that an in-process shortcut would lose. The tiny
|
||||
model runtime fixture bounds threads and freezes pre-existing garbage in the
|
||||
Intentional hang and missing-rank failures spend real time proving their timeout
|
||||
contracts; shortening those waits or mocking Gloo changes the proof. RSS and CLI
|
||||
cases also retain process isolation that an in-process shortcut would lose. The
|
||||
tiny model runtime fixture bounds threads and freezes pre-existing garbage in the
|
||||
pytest process; that state does not carry into isolated CLI interpreters. Do not
|
||||
claim its savings for child processes or merge CLI commands just to amortize
|
||||
torch startup.
|
||||
|
||||
+196
-25
@@ -150,61 +150,232 @@
|
||||
"mandatory_cpu": {
|
||||
"owner": "@maintainers",
|
||||
"max_suite_seconds_by_python": {
|
||||
"3.11": 1050.0,
|
||||
"3.12": 1050.0
|
||||
"3.11": 3910.0,
|
||||
"3.12": 5340.0
|
||||
},
|
||||
"max_testcase_seconds": 15.0,
|
||||
"max_marker_seconds": {
|
||||
"cpu": 500.0,
|
||||
"integration": 440.0,
|
||||
"unmarked": 1100.0
|
||||
"cpu": 2010.0,
|
||||
"integration": 700.0,
|
||||
"unmarked": 2460.0
|
||||
},
|
||||
"maximum_owner_days": 90,
|
||||
"owned_slow_tests": [
|
||||
{
|
||||
"nodeid": "tests.test_gpu_qualification_runtime::test_cpu_rehearsal_completes_real_pipeline_and_fresh_reload[cpu]",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs the CPU qualification rehearsal: a supervisor plus four fresh prepare/reference/edit/reload worker processes.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 85.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_gpu_qualification_runtime::test_cpu_rehearsal_completes_real_pipeline_and_fresh_reload[disk]",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs the disk-offload qualification rehearsal: a supervisor plus four fresh prepare/reference/edit/reload worker processes.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 85.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_recipe_concept_pack::test_refusal_pack_projection_uses_the_legacy_paired_extractor",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Probes the full shipped refusal pack twice; its per-batch gc.collect() calls scale with the session heap.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 105.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_offline_integration::test_installed_package_cli_executes_offline_checkpoint_to_report_slice",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Exercises an installed distribution through the offline checkpoint-to-report CLI boundary in subprocesses.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/306",
|
||||
"max_seconds": 60.0,
|
||||
"opened": "2026-10-29",
|
||||
"expires": "2027-01-27"
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 45.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_distributed_model_gloo::test_rank_hang_is_bounded_and_never_becomes_success",
|
||||
"nodeid": "tests.test_transactional_sequences::test_preconditions_refuse_missing_or_mismatched_evidence_and_unverified_edits",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Waits out a bounded two-rank Gloo hang to prove it fails rather than succeeding.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/306",
|
||||
"reason": "First test of the module; carries the shared module fixture (three eligible keys, five verified candidates, three interaction runs).",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 30.0,
|
||||
"opened": "2026-10-29",
|
||||
"expires": "2027-01-27"
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_recipe_application::test_obliterate_v2_pipeline_writes_resolution",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs a full tiny-model v2 recipe pipeline whose per-batch gc.collect() calls scale with the session heap.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 35.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_recipe_application::test_obliterate_v1_recipe_keeps_tied_head_edit",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs a full tiny-model v1 recipe pipeline whose per-batch gc.collect() calls scale with the session heap.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 30.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_pain_pack::test_no_upstream_sentences_in_repository",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Scans the repository for upstream concept-pack sentences.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/306",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 25.0,
|
||||
"opened": "2026-10-29",
|
||||
"expires": "2027-01-27"
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_smaller_change::test_rank1_change_passes_with_smaller_artifact_and_states_unchanged_inference",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Builds the rank-1 geometry environment and runs a three-seed smaller-change study; budget kept at measured CI time +25% until release evidence confirms the #679 speedup.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 35.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_smaller_change::test_low_variance_signal_defeats_variance_only_selection",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Builds the tail geometry environment on first use (lazy module fixture) and runs its smaller-change study.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_smaller_change::test_smaller_change_failing_collateral_is_rejected",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Builds the mixed geometry environment on first use (lazy module fixture) and runs its smaller-change study.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_distributed_model_gloo::test_rank_hang_is_bounded_and_never_becomes_success",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Waits out a bounded two-rank Gloo hang to prove it fails rather than succeeding.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 25.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_precision_reasoning::test_pilot_pairs_noop_and_intervention_within_each_precision",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs no-op and intervention pilots within each precision.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_regression_library::test_cases_reference_historical_evidence_by_digest_with_reproduction_inputs",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Rebuilds historical regression evidence and reproduction inputs by digest.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_backend_qualification::test_cpu_reference_qualifies_against_itself_from_fresh_disk_loads",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Qualifies the CPU reference against itself from fresh disk loads.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_mutation_search_confirm::test_model_search_scores_qualified_points_on_development_rows",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Scores qualified mutation-search points on development rows.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_recipe_search::test_evaluator_normal_exit_stop_os_error_writes_the_marker_and_exits_four",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Runs recipe search with real step subprocesses, including the verify-edit CLI; budget kept at measured CI time +25% until release evidence confirms the #679 speedup.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 30.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_checkpoint_export::test_disk_offloaded_subprocess_rss_bound",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Measures native and legacy export RSS in a subprocess on a disk-offloaded model.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/306",
|
||||
"max_seconds": 25.0,
|
||||
"opened": "2026-10-29",
|
||||
"expires": "2027-01-27"
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_acquisition_ingest::test_dossier_confounds_counterexamples_and_map_failures_become_requests",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Ingests a dossier whose confounds, counterexamples and map failures become acquisition requests.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_distributed_gloo::test_execute_preflight_missing_or_exited_rank_quarantines_and_reaps[missing_rank-ranks0-exit_codes0]",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Waits for a missing Gloo rank to time out, then quarantines and reaps it.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/306",
|
||||
"max_seconds": 25.0,
|
||||
"opened": "2026-10-29",
|
||||
"expires": "2027-01-27"
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_release_ci_workflow::test_release_gloo_isolates_heavy_files_and_assigns_bulk_collection_once",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Collects the release Gloo partitions to check heavy-file isolation and single bulk assignment.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_distributed_rank_local_reload::test_streaming_guards_reject_under_optimized_python",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Starts optimized-Python subprocesses to prove the streaming guards refuse them.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_distributed_verification_gloo::test_retry_uses_a_new_process_group_run_identity_and_empty_journal_root",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Retries a two-rank Gloo verification with a new process group run identity.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
},
|
||||
{
|
||||
"nodeid": "tests.test_mutation_search::test_unqualified_operations_are_refused_at_space_construction",
|
||||
"owner": "@maintainers",
|
||||
"reason": "Constructs mutation-search spaces to prove unqualified operations are refused.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-11-25",
|
||||
"expires": "2027-02-23"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -315,9 +315,15 @@ def _duration_value(value: Any, label: str, failures: list[str]) -> float | None
|
||||
|
||||
|
||||
def validate_duration_evidence(
|
||||
trend: dict[str, Any], policy: dict[str, Any],
|
||||
trend: dict[str, Any], policy: dict[str, Any], *, testcase_only: bool = False,
|
||||
) -> list[str]:
|
||||
"""Enforce mandatory CPU and repeat budgets on normalized trend evidence."""
|
||||
"""Enforce mandatory CPU and repeat budgets on normalized trend evidence.
|
||||
|
||||
``testcase_only`` enforces only per-testcase budgets (the default testcase
|
||||
budget and owned slow-test budgets) for evidence from a test subset, such as
|
||||
one pull-request partition. Suite and marker totals are calibrated against
|
||||
the complete release suite, so a subset must not be held to them.
|
||||
"""
|
||||
failures: list[str] = []
|
||||
budgets = policy["test_evidence"]["duration_budgets"]
|
||||
tests = trend.get("tests")
|
||||
@@ -335,7 +341,11 @@ def validate_duration_evidence(
|
||||
"test trend suite_duration_seconds",
|
||||
failures,
|
||||
)
|
||||
if suite_duration is not None and python_version in suite_budgets:
|
||||
if (
|
||||
not testcase_only
|
||||
and suite_duration is not None
|
||||
and python_version in suite_budgets
|
||||
):
|
||||
maximum = float(suite_budgets[python_version])
|
||||
if suite_duration > maximum:
|
||||
failures.append(
|
||||
@@ -424,7 +434,11 @@ def validate_duration_evidence(
|
||||
f"test marker {marker} duration",
|
||||
failures,
|
||||
)
|
||||
if observed is not None and observed > float(marker_budgets[marker]):
|
||||
if (
|
||||
not testcase_only
|
||||
and observed is not None
|
||||
and observed > float(marker_budgets[marker])
|
||||
):
|
||||
failures.append(
|
||||
f"test marker {marker} duration {observed:.3f}s exceeds "
|
||||
f"{float(marker_budgets[marker]):.3f}s",
|
||||
@@ -603,11 +617,19 @@ def _parser() -> argparse.ArgumentParser:
|
||||
parser.add_argument("--policy", type=Path, required=True)
|
||||
parser.add_argument("--coverage", type=Path)
|
||||
parser.add_argument("--evidence", type=Path)
|
||||
parser.add_argument(
|
||||
"--testcase-budgets-only",
|
||||
action="store_true",
|
||||
help="enforce only per-testcase duration budgets on subset evidence (pull requests)",
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = _parser().parse_args()
|
||||
parser = _parser()
|
||||
args = parser.parse_args()
|
||||
if args.testcase_budgets_only and args.evidence is None:
|
||||
parser.error("--testcase-budgets-only requires --evidence")
|
||||
try:
|
||||
policy = json.loads(args.policy.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError) as exc:
|
||||
@@ -639,7 +661,9 @@ def main() -> int:
|
||||
if not isinstance(trend, dict):
|
||||
failures.append("test trend evidence root must be an object")
|
||||
else:
|
||||
failures.extend(validate_duration_evidence(trend, policy))
|
||||
failures.extend(validate_duration_evidence(
|
||||
trend, policy, testcase_only=args.testcase_budgets_only,
|
||||
))
|
||||
|
||||
if failures:
|
||||
for failure in failures:
|
||||
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
"""Fake ``recipe _edit`` resolution writer shared by recipe search/confirmation tests.
|
||||
|
||||
Kept free of pytest and heavy test-module imports so that fake step subprocesses
|
||||
(``python -c`` scripts launched by recipe search tests) import only the two
|
||||
resolution modules they need instead of a whole test module and its imports.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from hashlib import sha256
|
||||
from math import ceil, floor
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _read(path):
|
||||
return json.loads(path.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
def write_edit_resolution(request):
|
||||
from obliteratus.qualification import canonical_json
|
||||
from obliteratus.recipes.resolution_records import _begin_application, write_resolution
|
||||
|
||||
stock = Path(request["stock"])
|
||||
config = _read(stock / "config.json") if (stock / "config.json").is_file() else {}
|
||||
recipe = request["recipe"]
|
||||
record = _begin_application(
|
||||
recipe, {**request["target"], "structure": {"tie_word_embeddings": None}},
|
||||
input_sha256={name: pin["sha256"] for name, pin in recipe["inputs"].items() if "sha256" in pin},
|
||||
runtime_bindings=[],
|
||||
)
|
||||
for actual, step in zip(record["steps"], recipe["pipeline"]["steps"], strict=True):
|
||||
params = step["params"]
|
||||
assert actual["params_sha256"] == sha256(canonical_json(params)).hexdigest()
|
||||
if step["technique"] == "abliteration.projection":
|
||||
layers = step["placement"].get("layers", params["backend"]["layers"])
|
||||
if isinstance(layers, dict):
|
||||
depth = config["num_hidden_layers"]
|
||||
layers = list(range(floor(layers["start"] * depth), ceil(layers["end"] * depth)))
|
||||
actual["payload"]["resolved_layers"] = layers
|
||||
checkpoint = Path(request["checkpoint"])
|
||||
checkpoint.mkdir(exist_ok=True)
|
||||
write_resolution(checkpoint / "recipe-resolution.json", record)
|
||||
return record
|
||||
+66
-1
@@ -459,7 +459,8 @@ def test_ci_evidence_names_the_pull_request_head_not_the_synthetic_merge_commit(
|
||||
workflow = WORKFLOW.read_text(encoding="utf-8")
|
||||
|
||||
assert "CANDIDATE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}" in workflow
|
||||
assert workflow.count('--head-sha "$CANDIDATE_SHA"') == 2
|
||||
# Release trend evidence (head lane and quality depth) plus PR partition duration evidence.
|
||||
assert workflow.count('--head-sha "$CANDIDATE_SHA"') == 3
|
||||
assert '--head-sha "$GITHUB_SHA"' not in workflow
|
||||
|
||||
|
||||
@@ -644,6 +645,70 @@ def test_aggregate_bash_rejects_missing_passing_data_and_excludes_empty_data(tmp
|
||||
assert (artifacts / f"pr-tests-{empty}/coverage-{empty}.data").is_file()
|
||||
|
||||
|
||||
def _junit(path, cases):
|
||||
body = "".join(
|
||||
f'<testcase classname="{classname}" name="{name}" time="{seconds}">'
|
||||
f'<properties><property name="duration_markers" value="{markers}"/></properties>'
|
||||
"</testcase>"
|
||||
for classname, name, seconds, markers in cases
|
||||
)
|
||||
total = sum(case[2] for case in cases)
|
||||
path.write_text(
|
||||
f'<testsuites><testsuite name="pytest" time="{total}">{body}</testsuite></testsuites>',
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("slow", [None, "unowned", "owned"])
|
||||
def test_pr_duration_step_enforces_testcase_budgets_on_each_partition(tmp_path, slow):
|
||||
core = _jobs()["pr-core"]
|
||||
names = [step.get("name") for step in core["steps"]]
|
||||
step = "Enforce per-test duration budgets on PR partitions"
|
||||
assert names.index("Validate PR partition evidence") < names.index(step) < names.index(
|
||||
"Combine accepted partition coverage",
|
||||
)
|
||||
run = _step("pr-core", step)["run"]
|
||||
assert "--testcase-budgets-only" in run and "--python-version 3.12" in run
|
||||
|
||||
(tmp_path / "scripts").symlink_to(ROOT / "scripts")
|
||||
(tmp_path / "ci").symlink_to(ROOT / "ci")
|
||||
python = tmp_path / "venv/bin/python"
|
||||
python.parent.mkdir(parents=True)
|
||||
python.symlink_to(sys.executable)
|
||||
results = tmp_path / "test-results"
|
||||
accepted = []
|
||||
owned = json.loads((ROOT / "ci/test-quality-policy.json").read_text())[
|
||||
"test_evidence"]["duration_budgets"]["mandatory_cpu"]["owned_slow_tests"][0]
|
||||
owned_class, owned_name = owned["nodeid"].split("::")
|
||||
for partition in ("core-0", "gloo-1"):
|
||||
directory = results / f"partitions/pr-tests-{partition}"
|
||||
directory.mkdir(parents=True)
|
||||
(directory / f"coverage-{partition}.data").write_text("data")
|
||||
accepted.append(f"test-results/partitions/pr-tests-{partition}/coverage-{partition}.data")
|
||||
# Far above any release suite total: a PR subset is never held to it.
|
||||
cases = [("tests.test_example", f"test_{partition[:4]}_{index}", 14.0, "cpu")
|
||||
for index in range(400)]
|
||||
if partition == "gloo-1" and slow == "unowned":
|
||||
cases.append(("tests.test_example", "test_slow", 16.0, "unmarked"))
|
||||
if partition == "core-0" and slow == "owned":
|
||||
cases.append((owned_class, owned_name, owned["max_seconds"] - 1, "cpu"))
|
||||
_junit(directory / f"junit-{partition}.xml", cases)
|
||||
(results / "accepted-coverage.txt").write_text("".join(f"{path}\n" for path in accepted))
|
||||
env = {**os.environ, "TEST_ENV": str(python.parents[1]), "CANDIDATE_SHA": "a" * 40,
|
||||
"COVERAGE_BASE": "b" * 40}
|
||||
|
||||
process = _bash(tmp_path, run, env)
|
||||
assert process.returncode == (1 if slow == "unowned" else 0), process.stdout + process.stderr
|
||||
assert sorted(path.name for path in results.glob("test-trend-pr-*.json")) == [
|
||||
"test-trend-pr-core-0.json", "test-trend-pr-gloo-1.json",
|
||||
]
|
||||
if slow == "unowned":
|
||||
assert (
|
||||
"test tests.test_example::test_slow took 16.000s above the 15.000s default "
|
||||
"and has no owned slow-test budget"
|
||||
) in process.stdout
|
||||
assert "suite duration" not in process.stdout and "test marker" not in process.stdout
|
||||
|
||||
|
||||
def test_hosted_all_extras_syncs_build_qwen_hybrid_without_cuda():
|
||||
# causal-conv1d (qwen-hybrid) compiles CUDA kernels by default and hosted
|
||||
# runners have no toolkit. Excluding the extra instead would silently drop
|
||||
|
||||
@@ -869,6 +869,74 @@ def test_duration_evidence_enforces_suite_marker_and_unowned_test_budgets():
|
||||
assert "test marker cpu duration 16.000s exceeds 15.000s" in failures
|
||||
|
||||
|
||||
def test_testcase_only_duration_evidence_skips_totals_but_keeps_testcase_budgets():
|
||||
policy = _policy()
|
||||
mandatory = policy["test_evidence"]["duration_budgets"]["mandatory_cpu"]
|
||||
mandatory["max_marker_seconds"]["cpu"] = 1.5
|
||||
mandatory["owned_slow_tests"] = [{
|
||||
"nodeid": "tests.test_example::test_plain",
|
||||
"owner": "@runtime-maintainers",
|
||||
"reason": "Owned subset test.",
|
||||
"issue": "https://github.com/elder-plinius/OBLITERATUS/issues/679",
|
||||
"max_seconds": 20.0,
|
||||
"opened": "2026-08-15",
|
||||
"expires": "2026-09-15",
|
||||
}]
|
||||
trend = _test_trend()
|
||||
trend["tests"]["suite_duration_seconds"] = 241.0
|
||||
# Subset evidence (a PR partition) cannot meet or fail release-suite totals.
|
||||
assert quality.validate_duration_evidence(trend, policy, testcase_only=True) == []
|
||||
assert quality.validate_duration_evidence(trend, policy) == [
|
||||
"test trend Python 3.12 suite duration 241.000s exceeds 240.000s",
|
||||
"test marker cpu duration 2.000s exceeds 1.500s",
|
||||
]
|
||||
|
||||
unowned = _test_trend(seconds=16.0)
|
||||
assert quality.validate_duration_evidence(unowned, policy, testcase_only=True) == [
|
||||
"test tests.test_example::test_cpu took 16.000s above the 15.000s default "
|
||||
"and has no owned slow-test budget",
|
||||
]
|
||||
owned = _test_trend()
|
||||
owned["tests"]["durations"][1]["seconds"] = 21.0
|
||||
owned["tests"]["marker_durations"]["unmarked"]["duration_seconds"] = 21.0
|
||||
assert quality.validate_duration_evidence(owned, policy, testcase_only=True) == [
|
||||
"owned slow test tests.test_example::test_plain took 21.000s above its 20.000s budget",
|
||||
]
|
||||
malformed = _test_trend()
|
||||
malformed["tests"]["marker_metadata_complete"] = False
|
||||
assert quality.validate_duration_evidence(malformed, policy, testcase_only=True) == [
|
||||
"test trend duration marker metadata is incomplete",
|
||||
]
|
||||
|
||||
|
||||
def test_cli_testcase_budgets_only_requires_evidence_and_skips_suite_total(
|
||||
tmp_path, monkeypatch, capsys,
|
||||
):
|
||||
policy_path = tmp_path / "policy.json"
|
||||
evidence_path = tmp_path / "trend.json"
|
||||
policy_path.write_text(json.dumps(_policy()))
|
||||
trend = _test_trend()
|
||||
trend["tests"]["suite_duration_seconds"] = 241.0
|
||||
evidence_path.write_text(json.dumps(trend))
|
||||
base = ["check_quality_policy.py", "--policy", str(policy_path)]
|
||||
|
||||
monkeypatch.setattr(sys, "argv", [*base, "--testcase-budgets-only"])
|
||||
with pytest.raises(SystemExit) as caught:
|
||||
quality.main()
|
||||
assert caught.value.code == 2
|
||||
assert "--testcase-budgets-only requires --evidence" in capsys.readouterr().err
|
||||
|
||||
monkeypatch.setattr(sys, "argv", [*base, "--evidence", str(evidence_path)])
|
||||
assert quality.main() == 1
|
||||
assert "suite duration 241.000s exceeds 240.000s" in capsys.readouterr().out
|
||||
|
||||
monkeypatch.setattr(
|
||||
sys, "argv", [*base, "--evidence", str(evidence_path), "--testcase-budgets-only"],
|
||||
)
|
||||
assert quality.main() == 0
|
||||
assert capsys.readouterr().out == "quality policy passed\n"
|
||||
|
||||
|
||||
def test_duration_evidence_fails_closed_without_junit_marker_metadata():
|
||||
trend = _test_trend()
|
||||
trend["tests"]["marker_metadata_complete"] = False
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from contextlib import nullcontext
|
||||
from hashlib import sha256
|
||||
from math import ceil, floor
|
||||
from importlib.resources import files
|
||||
import errno
|
||||
import json
|
||||
@@ -19,6 +18,7 @@ from obliteratus.verify_edit.heldout import load_heldout, write_extraction_pairs
|
||||
from obliteratus.verify_edit.runner import REPORT_SCHEMA
|
||||
from obliteratus.verify_edit.spec import BUILTIN_HELDOUT, load_spec
|
||||
from obliteratus.verify_edit.verdicts import overall
|
||||
from tests.fixtures.edit_resolution import write_edit_resolution as write_edit_resolution
|
||||
from tests.test_recipe_search import _interrupt_worker
|
||||
from tests.test_recipe_search import process_tree as process_tree
|
||||
|
||||
@@ -41,33 +41,6 @@ def digest(path):
|
||||
return sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def write_edit_resolution(request):
|
||||
from obliteratus.qualification import canonical_json
|
||||
from obliteratus.recipes.resolution_records import _begin_application, write_resolution
|
||||
|
||||
stock = Path(request["stock"])
|
||||
config = read(stock / "config.json") if (stock / "config.json").is_file() else {}
|
||||
recipe = request["recipe"]
|
||||
record = _begin_application(
|
||||
recipe, {**request["target"], "structure": {"tie_word_embeddings": None}},
|
||||
input_sha256={name: pin["sha256"] for name, pin in recipe["inputs"].items() if "sha256" in pin},
|
||||
runtime_bindings=[],
|
||||
)
|
||||
for actual, step in zip(record["steps"], recipe["pipeline"]["steps"], strict=True):
|
||||
params = step["params"]
|
||||
assert actual["params_sha256"] == sha256(canonical_json(params)).hexdigest()
|
||||
if step["technique"] == "abliteration.projection":
|
||||
layers = step["placement"].get("layers", params["backend"]["layers"])
|
||||
if isinstance(layers, dict):
|
||||
depth = config["num_hidden_layers"]
|
||||
layers = list(range(floor(layers["start"] * depth), ceil(layers["end"] * depth)))
|
||||
actual["payload"]["resolved_layers"] = layers
|
||||
checkpoint = Path(request["checkpoint"])
|
||||
checkpoint.mkdir(exist_ok=True)
|
||||
write_resolution(checkpoint / "recipe-resolution.json", record)
|
||||
return record
|
||||
|
||||
|
||||
class Runner:
|
||||
"""Exercise the subprocess interface without model weights."""
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ def test_search_records_cleanup_failure_reported_while_it_stops_verify_edit(setu
|
||||
ready = out.parent / "verify-edit.ready"
|
||||
monkeypatch.setenv("PYTHONPATH", str(Path(__file__).resolve().parents[1]), prepend=os.pathsep)
|
||||
monkeypatch.setenv("OBLITERATUS_PROCESS_GRACE_SECONDS", "5")
|
||||
edit = ("import json, sys\nfrom tests.test_recipe_confirmation import write_edit_resolution\n"
|
||||
edit = ("import json, sys\nfrom tests.fixtures.edit_resolution import write_edit_resolution\n"
|
||||
"write_edit_resolution(json.load(open(sys.argv[1])))\n")
|
||||
# verify-edit fails to stop its own groups while search stops it, and exits 4.
|
||||
verify = ("import os, pathlib, signal, time\n"
|
||||
@@ -291,7 +291,7 @@ def test_cleanup_marker_is_synced_and_a_failed_sync_fails_closed(tmp_path, monke
|
||||
def fake_step_popen(monkeypatch, verify_code):
|
||||
"""Swap each obliteratus step for a small script; record launches that saw a marker."""
|
||||
monkeypatch.setenv("PYTHONPATH", str(Path(__file__).resolve().parents[1]), prepend=os.pathsep)
|
||||
edit = ("import json, sys\nfrom tests.test_recipe_confirmation import write_edit_resolution\n"
|
||||
edit = ("import json, sys\nfrom tests.fixtures.edit_resolution import write_edit_resolution\n"
|
||||
"write_edit_resolution(json.load(open(sys.argv[1])))\n")
|
||||
checkpoint = ("import json, sys\nargs = sys.argv[1:]\nif '--report' in args:\n"
|
||||
" open(args[args.index('--report') + 1], 'w').write(json.dumps({'verdict': 'pass'}))\n")
|
||||
|
||||
@@ -10,9 +10,14 @@ from scripts.check_quality_policy import validate_duration_evidence
|
||||
from scripts.write_test_evidence import junit_snapshot
|
||||
|
||||
|
||||
@pytest.mark.parametrize("times", [(1, 1200), (1200, 1)])
|
||||
SUITE_BUDGETS = {"3.11": 3910.0, "3.12": 5340.0} # #679 rebaseline: measured + 25%
|
||||
|
||||
|
||||
@pytest.mark.parametrize("slow_first", [False, True])
|
||||
@pytest.mark.parametrize("version", ["3.11", "3.12"])
|
||||
def test_later_or_earlier_slow_shard_exceeds_existing_suite_budget(tmp_path, times, version):
|
||||
def test_later_or_earlier_slow_shard_exceeds_existing_suite_budget(tmp_path, slow_first, version):
|
||||
budget = SUITE_BUDGETS[version]
|
||||
times = (budget, 1) if slow_first else (1, budget)
|
||||
root = ET.Element("testsuites")
|
||||
for index, seconds in enumerate(times):
|
||||
suite = ET.SubElement(root, "testsuite", {"time": str(seconds)})
|
||||
@@ -22,12 +27,12 @@ def test_later_or_earlier_slow_shard_exceeds_existing_suite_budget(tmp_path, tim
|
||||
path = tmp_path / "junit.xml"
|
||||
ET.ElementTree(root).write(path)
|
||||
snapshot = junit_snapshot(path)
|
||||
assert snapshot["suite_duration_seconds"] == 1201.0
|
||||
assert snapshot["suite_duration_seconds"] == budget + 1
|
||||
assert snapshot["duration_seconds"] == 0.02 # Case budgets remain a separate measure.
|
||||
policy = json.loads((Path(__file__).parents[1] / "ci/test-quality-policy.json").read_text())
|
||||
assert policy["test_evidence"]["duration_budgets"]["mandatory_cpu"]["max_suite_seconds_by_python"][version] == 1050.0
|
||||
assert policy["test_evidence"]["duration_budgets"]["mandatory_cpu"]["max_suite_seconds_by_python"][version] == budget
|
||||
failures = validate_duration_evidence({"python": version, "tests": snapshot}, policy)
|
||||
assert f"test trend Python {version} suite duration 1201.000s exceeds 1050.000s" in failures
|
||||
assert f"test trend Python {version} suite duration {budget + 1:.3f}s exceeds {budget:.3f}s" in failures
|
||||
|
||||
|
||||
@pytest.mark.parametrize("bad", ["nan", "inf", "-1", "invalid"])
|
||||
|
||||
@@ -95,9 +95,25 @@ def build_env(root, geometry, replicate=True):
|
||||
return env
|
||||
|
||||
|
||||
class _ModuleEnvs(dict):
|
||||
"""Build each geometry once per module, on first use by a test that needs it."""
|
||||
|
||||
def __init__(self, tmp_path_factory):
|
||||
super().__init__()
|
||||
self._tmp_path_factory = tmp_path_factory
|
||||
|
||||
def __missing__(self, name):
|
||||
if name not in GEOMETRIES:
|
||||
raise KeyError(name)
|
||||
env = self[name] = build_env(self._tmp_path_factory.mktemp(name), name)
|
||||
return env
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def envs(tmp_path_factory):
|
||||
return {name: build_env(tmp_path_factory.mktemp(name), name) for name in GEOMETRIES}
|
||||
# Same per-geometry environments and module sharing as an eager dict, but the
|
||||
# first test no longer pays for geometries only later tests use.
|
||||
return _ModuleEnvs(tmp_path_factory)
|
||||
|
||||
|
||||
def config(env, **changes):
|
||||
|
||||
Reference in new issue
Block a user