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
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ jobs:
set -euo pipefail
python scripts/heavy_tier_needed.py \
--decision-in ci-path-decision.json \
--event "${{ github.event_name }}" \
--base-ref "${{ github.event.pull_request.base.sha }}" \
--github-output "$GITHUB_OUTPUT" \
--summary "$GITHUB_STEP_SUMMARY"
Expand Down
13 changes: 0 additions & 13 deletions quality/comment-policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -37908,19 +37908,6 @@
"owner": "comment-cleanup-unit-tests-cli-scripts-rest",
"removal": "Remove when the test's subprocess input becomes a static literal or the executable-payload adapter can reconstruct it."
},
{
"path": "tests/unit/test_standardized_test_commands.py",
"symbol": "TestMakefileCommands.test_pr_preflight_fast_tests_creates_classifier_artifacts_when_absent",
"text": "unresolved executable source: make",
"payload": "sha256:ec98147fe1cc42ba021f5d8b6dc1359df9c93cad0014e20a3a538e0368d2fa6a",
"finding_kind": "payload-error",
"kind": "fixture",
"consumer": "tests/unit/test_standardized_test_commands.py",
"necessity": "Pre-registered for the #2905 cleanup, which removes the obsolete merge_group routing doc test from this file and changes its AST digest. Same fixture as above: the test starts a subprocess whose program (make) is assembled at runtime.",
"alternative": "Rewrite the subprocess input as a static literal the checker can parse; that changes the test and was not taken in the cleanup.",
"owner": "comment-cleanup-unit-tests-cli-scripts-rest",
"removal": "Remove when the test's subprocess input becomes a static literal or the executable-payload adapter can reconstruct it."
},
{
"path": "tests/unit/test_standardized_test_commands.py",
"symbol": "TestMakefileCommands.test_skill_integrity_preflight_selected_lane_failure_propagates",
Expand Down
7 changes: 1 addition & 6 deletions scripts/heavy_tier_needed.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

PREDICATE_REPO_PATH = "_project/scripts/soundness_paths.py"
POLICY_PATHS = (PREDICATE_REPO_PATH, ".github/soundness-paths.txt")
MERGE_GROUP_EVENT = "merge_group"


class HeavyTierError(RuntimeError):
Expand Down Expand Up @@ -119,7 +118,6 @@ def soundness_touched(

def heavy_needed(
decision: dict[str, Any],
event: str,
base_ref: str,
repo_root: Path,
read_base: Callable[[str, Path], dict[str, str]] | None = None,
Expand All @@ -137,8 +135,6 @@ def heavy_needed(
needs_code_ci = decision["needs_code_ci"]
if not needs_code_ci:
return {"heavy_needed": False, "reason": "not a code-routed tree; the light lane already covers it"}
if event == MERGE_GROUP_EVENT:
return {"heavy_needed": True, "reason": "merge_group runs keep the full tier on every code-routed tree"}
if decision["packaging_needed"]:
return {"heavy_needed": True, "reason": "packaging paths touched (packaging carve-out)"}
touched, reason = soundness_touched(changed, base_ref, repo_root, read_base, read_pr)
Expand All @@ -157,7 +153,6 @@ def _write_github_output(path: Path, needed: bool) -> None:
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--decision-in", type=Path, default=None)
parser.add_argument("--event", default=os.environ.get("GITHUB_EVENT_NAME", ""))
parser.add_argument("--base-ref", default=os.environ.get("GITHUB_BASE_REF", "origin/develop"))
parser.add_argument("--repo-root", type=Path, default=Path.cwd())
parser.add_argument("--github-output", type=Path, default=None)
Expand All @@ -177,7 +172,7 @@ def main(argv: list[str] | None = None) -> int:
if not isinstance(decision, dict):
result = {"heavy_needed": True, "reason": "lookup failed closed: decision is not an object"}
else:
result = heavy_needed(decision, args.event, args.base_ref, args.repo_root)
result = heavy_needed(decision, args.base_ref, args.repo_root)

needed = bool(result["heavy_needed"])
reason = str(result["reason"])
Expand Down
4 changes: 2 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ The standard gates are intentionally split by the risk they are meant to catch:
blocking routine PRs.

The `medium-test` job in `.github/workflows/ci.yml` runs `make test-medium`,
but only when the heavy tier is needed: code-routed runs where the event is
`merge_group` or the change touches soundness paths or packaging
but only when the heavy tier is needed: code-routed pull requests that touch
soundness paths or packaging
(`scripts/heavy_tier_needed.py` reports `heavy-needed == 'true'`). Ordinary
code-change PRs skip it, so do not assume medium coverage ran on a routine PR.
Its marker selection excludes slow, stress, resource-heavy, and live
Expand Down
17 changes: 5 additions & 12 deletions tests/unit/scripts/test_heavy_tier_needed.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def _decision(paths: list[str]) -> dict:
def _classify(paths: list[str], base: dict[str, str], pr: dict[str, str]) -> dict:
return heavy.heavy_needed(
_decision(paths),
"pull_request",
"base",
REPO_ROOT,
read_base=lambda *_: base,
Expand All @@ -47,7 +46,7 @@ def test_real_base_policy_does_not_expand_an_ordinary_code_change(
) -> None:
repo, base_head, _pr_head = _snapshot_repo(tmp_path, policy_sources)
assert subprocess.check_output(["git", "-C", str(repo), "remote"], text=True) == ""
result = heavy.heavy_needed(_decision(["benchbox/core/platform_registry.py"]), "pull_request", base_head, repo)
result = heavy.heavy_needed(_decision(["benchbox/core/platform_registry.py"]), base_head, repo)
assert result["heavy_needed"] is False, result["reason"]


Expand Down Expand Up @@ -193,7 +192,7 @@ def test_invalid_policy_copies_fail_closed(policy_sources: dict[str, str], bad_c


def test_unreadable_base_ref_fails_closed() -> None:
result = heavy.heavy_needed(_decision(["ordinary.py"]), "pull_request", "refs/heads/not-present", REPO_ROOT)
result = heavy.heavy_needed(_decision(["ordinary.py"]), "refs/heads/not-present", REPO_ROOT)
assert result["heavy_needed"] is True
assert "failed closed" in result["reason"]

Expand Down Expand Up @@ -236,13 +235,7 @@ def test_invalid_cli_decisions_publish_the_safe_direction(tmp_path: Path, raw: s
assert output.read_text().strip() == "heavy-needed=true"


def test_event_and_packaging_carve_outs_preserve_the_full_tier() -> None:
assert heavy.heavy_needed(_decision([]), "merge_group", "absent", REPO_ROOT)["heavy_needed"] is True
def test_packaging_carve_out_and_non_code_routing_preserve_the_expected_tier() -> None:
decision = {**_decision([]), "packaging_needed": True}
assert heavy.heavy_needed(decision, "pull_request", "absent", REPO_ROOT)["heavy_needed"] is True
assert (
heavy.heavy_needed({**_decision([]), "needs_code_ci": False}, "pull_request", "absent", REPO_ROOT)[
"heavy_needed"
]
is False
)
assert heavy.heavy_needed(decision, "absent", REPO_ROOT)["heavy_needed"] is True
assert heavy.heavy_needed({**_decision([]), "needs_code_ci": False}, "absent", REPO_ROOT)["heavy_needed"] is False
Loading