diff --git a/.crumb b/.crumb index 8456dd0..38c685a 100644 --- a/.crumb +++ b/.crumb @@ -15,27 +15,27 @@ "purpose": "interim Python kit: ./run drives bench.py, ck.py calls libcuda through ctypes" }, { - "digest": "5d11a4c875499cea80c741613f900aea20063786ee895bc518f4e53972bf50e9", + "digest": "2645b7c453bec965fe5b4ebd4a76cc3b885b24458eb9fe3b9cbc0e1a744adc34", "last_commit": "1168ea7", "name": "tests", "purpose": "no-GPU tests: fake libcuda fixture, tamper negative controls, committed tampered example" }, { - "digest": "6a9a5d8e920a6818b001decd24f1d435c5b0b897fbf0c64c82dcb044ef87c63b", + "digest": "df6e2ef83ee864ae89e95b604f848c33be21e93bc42de0b1de487bc34cf5afe4", "last_commit": "400ded3", "name": "tools", "purpose": "receipt schema, validator, PR gate, board builder, one-off CloudKernels import" } ], - "children_root": "sha256:6ba18f8a47e4d64e75045b67c35802f05563d657171bea0a9e6483d3190d4a2c", - "compiled_at": "2026-10-27T00:26:13Z", + "children_root": "sha256:de86f276e9cbfe1fc34df8351437f590914b697a942862da00f92de6b166f792", + "compiled_at": "2026-10-27T00:34:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:7a5bb3bf304e9b27c65a94fe06445b3d33b55164816f465b857005d7eaf85e40", + "digest": "sha256:2e7036766cc5627233325fbee020abd23f942b57af5e6dcea93d3c14a01dbe97", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 33, - "generated_at_commit": "1168ea7a6b2949208414fb8128676024b347409c", - "source_tree": "sha256:914c4fcf155e6df6495f73cec264a008c8fd846c635aec8ef70ac6f618052adf" + "generated_at_commit": "6cff107d5033bdac5591928ccd50c9d3276708a3", + "source_tree": "sha256:db6dd1a19f0092362a76eadc1504d6836e061d9cfe7d433905e30d64b94e9062" } }, "name": "omega-gpu-bench", diff --git a/.github/workflows/receipts.yml b/.github/workflows/receipts.yml index f5be4af..2f329b6 100644 --- a/.github/workflows/receipts.yml +++ b/.github/workflows/receipts.yml @@ -25,8 +25,8 @@ jobs: env: BASE: ${{ github.event.pull_request.base.sha }} HEAD: ${{ github.event.pull_request.head.sha }} - ASSOC: ${{ github.event.pull_request.author_association }} + SAME: ${{ github.event.pull_request.head.repo.full_name == github.repository && 'yes' || 'no' }} REPO: ${{ github.repository }} run: | git -C pr fetch --quiet "https://github.com/$REPO" "$BASE" - python3 base/tools/pr_gate.py --pr pr --base "$BASE" --head "$HEAD" --assoc "$ASSOC" + python3 base/tools/pr_gate.py --pr pr --base "$BASE" --head "$HEAD" --same-repo "$SAME" diff --git a/tests/.crumb b/tests/.crumb index e728def..367f2d1 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-27T00:26:13Z", + "compiled_at": "2026-10-27T00:34:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:5d11a4c875499cea80c741613f900aea20063786ee895bc518f4e53972bf50e9", + "digest": "sha256:2645b7c453bec965fe5b4ebd4a76cc3b885b24458eb9fe3b9cbc0e1a744adc34", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 4, - "generated_at_commit": "1168ea7a6b2949208414fb8128676024b347409c", - "source_tree": "sha256:d7c6b76a016c2cff0092ad51a1a6446cecacf03cdafe0ef6ec6088c31e6195ff" + "generated_at_commit": "6cff107d5033bdac5591928ccd50c9d3276708a3", + "source_tree": "sha256:561c6923a9848ab3a2488ae3862cab62a5e5aaf7988c2eca7be68ce5f471d498" } }, "name": "tests", diff --git a/tests/run.sh b/tests/run.sh index d0bcb75..b8b9025 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -78,7 +78,7 @@ OGB_FAKE_DRIVER=$FAKE "$T/clone/run" --sign-off "$SIGN" --out "$T/flip" > "$T/fl expect "byte-flipped cubin refused" 3 $? # 9. tampered receipts: every one must be rejected for the stated reason -I=$(ls receipts/*.json 2>/dev/null | head -n 1) +I=$(grep -l '"origin": "cloudkernels-import"' receipts/*.json 2>/dev/null | head -n 1) if [ -n "$K" ]; then python3 tests/tamper.py "$K" "${I:--}" "$T/tampered" > "$T/cases.tsv" while IFS="$(printf '\t')" read -r case reason; do diff --git a/tools/.crumb b/tools/.crumb index 0e58c07..8338341 100644 --- a/tools/.crumb +++ b/tools/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-27T00:24:36Z", + "compiled_at": "2026-10-27T00:34:29Z", "compiler": "crumb-compile/1", - "digest": "sha256:6a9a5d8e920a6818b001decd24f1d435c5b0b897fbf0c64c82dcb044ef87c63b", + "digest": "sha256:df6e2ef83ee864ae89e95b604f848c33be21e93bc42de0b1de487bc34cf5afe4", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 5, - "generated_at_commit": "400ded3e143a26fd8e495ff3f7c5214f9153a08f", - "source_tree": "sha256:207e1995db69783339b4be03cc3087a407386e95490e1fddb0d8ddfb6c73d7f6" + "generated_at_commit": "6cff107d5033bdac5591928ccd50c9d3276708a3", + "source_tree": "sha256:feb18196529857ab2e6bbde69eac2b8758b5b46909752ffe1b35a2c0ffa9b85a" } }, "name": "tools", diff --git a/tools/pr_gate.py b/tools/pr_gate.py index beb5071..6b9c59f 100755 --- a/tools/pr_gate.py +++ b/tools/pr_gate.py @@ -3,12 +3,13 @@ # base branch (workflow receipts.yml, pull_request_target) and treats the pull request as data only: # nothing from the pull request is executed. # -# pr_gate.py --pr PR_CHECKOUT --base BASE_SHA --head HEAD_SHA --assoc AUTHOR_ASSOCIATION +# pr_gate.py --pr PR_CHECKOUT --base BASE_SHA --head HEAD_SHA --same-repo yes|no # # Rules: # * receipts are append-only: a pull request may add receipts/*.json, never change or delete one; -# * a contributor's pull request may change nothing but added receipts (maintainers, i.e. OWNER, -# MEMBER or COLLABORATOR, may also change the kit, imports.sha256 and evidence/); +# * a pull request from a fork may change nothing but added receipts; one from a branch of this +# repository (only people with write access can push those) may also change the kit, +# imports.sha256 and evidence/; # * every added receipt passes tools/validate.py, using the base branch's validator, the base branch's # kernels/SHA256SUMS, and the base branch's import allowlist (a maintainer's own list for theirs); # * the commit that adds a kit-run receipt carries "Signed-off-by: ". @@ -19,7 +20,6 @@ HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) import validate as V # noqa: E402 -MAINTAINER = {"OWNER", "MEMBER", "COLLABORATOR"} RECEIPT = re.compile(r"receipts/[^/]+\.json") @@ -32,10 +32,10 @@ def main(): ap.add_argument("--pr", required=True) ap.add_argument("--base", required=True) ap.add_argument("--head", required=True) - ap.add_argument("--assoc", required=True) + ap.add_argument("--same-repo", required=True, choices=("yes", "no")) o = ap.parse_args() trusted = os.path.dirname(HERE) - maint = o.assoc in MAINTAINER + maint = o.same_repo == "yes" errs = [] added = [] diff = git(o.pr, "diff", "--name-status", "--no-renames", "%s...%s" % (o.base, o.head)) @@ -69,7 +69,7 @@ def main(): ["git", "-C", o.pr, "merge-base", "--is-ancestor", commit, o.base], capture_output=True).returncode != 0: errs.append("%s: kit.commit %s is not on the base branch" % (path, commit)) - print("pull request adds %d receipt(s); author association %s" % (len(added), o.assoc)) + print("pull request adds %d receipt(s); from %s" % (len(added), "a branch of this repository" if maint else "a fork")) for e in errs: print("REJECT " + e) if not added and not maint: