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
30 changes: 28 additions & 2 deletions .github/scripts/test_run_checks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3

Check warning on line 1 in .github/scripts/test_run_checks.py

View workflow job for this annotation

GitHub Actions / Hygiene

Large changed file

.github/scripts/test_run_checks.py is 971 lines; consider splitting files over 800 lines.

Check warning on line 1 in .github/scripts/test_run_checks.py

View workflow job for this annotation

GitHub Actions / PR Metadata Preflight

Large changed file

.github/scripts/test_run_checks.py is 971 lines; consider splitting files over 800 lines.

Check warning on line 1 in .github/scripts/test_run_checks.py

View workflow job for this annotation

GitHub Actions / PR Metadata Preflight

Large changed file

.github/scripts/test_run_checks.py is 971 lines; consider splitting files over 800 lines.
"""Regression tests and drift guard for the deterministic check manifest."""

from __future__ import annotations
Expand Down Expand Up @@ -197,7 +197,13 @@
def test_ci_lane_is_reachable_from_repo_checks(self) -> None:
workflow = (WORKFLOWS_DIR / "repo-checks.yml").read_text(encoding="utf-8")
self.assertRegex(workflow, r"run_checks\.py\s+--lane\s+ci")
self.assertIn("--skip-pr-body-checks", workflow)
# #9744: main pushes must pass the merge-commit body through
# --pr-body-file (not --skip-pr-body-checks), so product-invariants can
# see the citations GitHub folds into the merge commit message. This
# assertion is the wiring regression guard for that path.
self.assertNotIn("--skip-pr-body-checks", workflow)
self.assertRegex(workflow, r"git log -1 --format=%B HEAD")
self.assertRegex(workflow, r"--pr-body-file")
manifest = load_manifest(MANIFEST_PATH)
self.assertTrue(any("ci" in check.lanes for check in manifest.checks))

Expand Down Expand Up @@ -561,7 +567,27 @@
selected = {check.id for check in resolve_checks(manifest, ["app/lib/example.dart"], lane)}
self.assertIn("failure-class-protocol", selected)

def test_main_push_excludes_only_pr_body_checks(self) -> None:
def test_main_push_includes_pr_body_checks_when_body_supplied(self) -> None:
"""#9744: main pushes now pass the merge-commit body through
--pr-body-file, so body-requiring checks (product-invariants,
failure-class-protocol) must run — not be silently skipped."""
manifest = load_manifest(MANIFEST_PATH)
selected = {
check.id
for check in resolve_checks(
manifest,
["app/lib/example.dart"],
"ci",
include_pr_body_checks=True,
)
}
self.assertIn("product-invariants", selected)
self.assertIn("failure-class-protocol", selected)
self.assertIn("diff-hygiene", selected)

def test_main_push_without_body_still_excludes_pr_body_checks(self) -> None:
"""Fail-closed: a main push with no body must NOT run body-requiring
checks (they would fail on empty text), preserving the old skip."""
manifest = load_manifest(MANIFEST_PATH)
selected = {
check.id
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/repo-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,20 @@ jobs:

- name: Run deterministic check manifest on main pushes
if: github.event_name != 'pull_request'
run: python3 .github/scripts/run_checks.py --lane ci --base "${{ needs.changes.outputs.diff_base }}" --skip-pr-body-checks
env:
PR_BODY_FILE: /tmp/main-push-commit-body.txt
run: |
# On main pushes there is no PR body. GitHub folds the PR description
# into the merge commit message (fetch-depth: 0 gives us the full
# commit), so pass that through --pr-body-file instead of skipping the
# body-requiring checks. Without this, product-invariants cannot see
# the citations the merge commit carries and every main-push Hygiene
# run reports them as missing (see #9744). Fail-closed is preserved:
# a direct push whose message omits required invariant IDs still fails.
git log -1 --format=%B HEAD > "$PR_BODY_FILE"
python3 .github/scripts/run_checks.py --lane ci \
--base "${{ needs.changes.outputs.diff_base }}" \
--pr-body-file "$PR_BODY_FILE"

- name: Check typed error flow-control ratchet
run: python3 .github/scripts/check_isinstance_return_ratchet.py
Expand Down
Loading