From f71db3ac50a525c98b0d051783d2a3fbc3a24845 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:44:15 -0500 Subject: [PATCH 01/13] test(main-is-released): run the assertion script against temp repos --- .../tests/main_is_released_contract_test.py | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/.github/tests/main_is_released_contract_test.py b/.github/tests/main_is_released_contract_test.py index ff1a826..e127452 100644 --- a/.github/tests/main_is_released_contract_test.py +++ b/.github/tests/main_is_released_contract_test.py @@ -1,5 +1,9 @@ from pathlib import Path +import os import re +import stat +import subprocess +import tempfile import unittest @@ -7,6 +11,31 @@ WORKFLOW = ROOT / ".github/workflows/main-is-released.yml" +def extract_script(): + """Return the `run: |` body of the assertion step, de-indented.""" + lines = WORKFLOW.read_text().splitlines() + start = next( + i for i, line in enumerate(lines) + if "- name: Assert main points at a release tag" in line + ) + run = next( + i for i in range(start, len(lines)) if lines[i].strip() == "run: |" + ) + body = [] + indent = None + for line in lines[run + 1:]: + if line.strip(): + width = len(line) - len(line.lstrip()) + if indent is None: + indent = width + elif width < indent: + break + body.append(line[indent:]) + else: + body.append("") + return "\n".join(body).rstrip() + "\n" + + class MainIsReleasedContractTest(unittest.TestCase): def test_reusable_workflow_shape_and_read_only_permissions(self): workflow = self.read_workflow() @@ -116,6 +145,85 @@ def test_workflow_pins_actions_and_is_run_by_standards_validation(self): validation = (ROOT / ".github/workflows/standards-validation.yml").read_text() self.assertIn("main_is_released_contract_test.py", validation) + def test_main_is_released_script_behavior(self): + """Run the extracted bash against throwaway repos so the pass/fail + decision is exercised, not just grepped for.""" + script_text = extract_script() + self.assertTrue(script_text.strip()) + self.assertIn("set -euo pipefail", script_text) + + def git(repo, *args): + subprocess.run( + ["git", *args], cwd=repo, check=True, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + ) + + def commit(repo, name): + (Path(repo) / name).write_text(name) + git(repo, "add", name) + git(repo, "commit", "-q", "-m", name) + + def no_tags(repo): + pass + + def untagged_head(repo): + git(repo, "tag", "v1.0.0") + commit(repo, "second") + + def tag_head(name): + def setup(repo): + git(repo, "tag", name) + return setup + + def tag_old(repo): + git(repo, "tag", "v1.2.3") + commit(repo, "second") + + cases = ( + ("no tags", no_tags, "true", False, "stderr", "no tags"), + ("untagged head", untagged_head, "true", False, "stderr", "not a tagged release"), + ("moving tag", tag_head("snapshot"), "true", False, "stderr", "not a release version tag"), + ("release tag", tag_head("v1.2.3"), "true", True, "stdout", "released at v1.2.3"), + ("prerelease denied", tag_head("v1.2.3-rc.1"), "false", False, None, None), + ("prerelease allowed", tag_head("v1.2.3-rc.1"), "true", True, None, None), + ("tag on older commit", tag_old, "true", False, None, None), + ) + + with tempfile.TemporaryDirectory() as tmp: + bin_dir = Path(tmp) / "bin" + bin_dir.mkdir() + sleep = bin_dir / "sleep" + sleep.write_text("#!/bin/sh\nexit 0\n") + sleep.chmod(sleep.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) + script = Path(tmp) / "assert.sh" + script.write_text(script_text) + env = { + **os.environ, + "PATH": f"{bin_dir}{os.pathsep}{os.environ['PATH']}", + } + + for label, setup, allow, ok, stream, needle in cases: + with self.subTest(label): + repo = Path(tmp) / label.replace(" ", "-") + repo.mkdir() + git(repo, "init", "-q") + git(repo, "config", "user.name", "test") + git(repo, "config", "user.email", "test@example.com") + git(repo, "config", "commit.gpgsign", "false") + git(repo, "config", "tag.gpgsign", "false") + commit(repo, "first") + setup(repo) + result = subprocess.run( + ["bash", str(script)], cwd=repo, env={**env, "ALLOW_PRERELEASE": allow}, + capture_output=True, text=True, + ) + if ok: + self.assertEqual(result.returncode, 0, result.stderr) + else: + self.assertNotEqual(result.returncode, 0, result.stdout) + if needle: + self.assertIn(needle, getattr(result, stream)) + def read_workflow(self): self.assertTrue(WORKFLOW.is_file(), f"missing workflow: {WORKFLOW}") return WORKFLOW.read_text() From 3b5cce6ac9d8ab3f9fb90ac4e0a24c92ac736122 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:54:51 -0500 Subject: [PATCH 02/13] fix(main-is-released): accept any release tag among several on HEAD --- .../tests/main_is_released_contract_test.py | 83 +++++++++++++++++-- .github/workflows/main-is-released.yml | 54 +++++++----- 2 files changed, 110 insertions(+), 27 deletions(-) diff --git a/.github/tests/main_is_released_contract_test.py b/.github/tests/main_is_released_contract_test.py index e127452..897aedd 100644 --- a/.github/tests/main_is_released_contract_test.py +++ b/.github/tests/main_is_released_contract_test.py @@ -4,6 +4,7 @@ import stat import subprocess import tempfile +import textwrap import unittest @@ -59,15 +60,24 @@ def test_reusable_workflow_shape_and_read_only_permissions(self): def test_the_invariant_is_an_exact_tag_match(self): workflow = self.read_workflow() - self.assertIn("git describe --exact-match --tags HEAD", workflow) + self.assertIn("git tag --points-at HEAD", workflow) + self.assertNotIn("--exact-match", workflow) # --abbrev=0 alone answers "what tag is nearest", which is true of a # drifted main too. It may only be used to report inside the failure # branch, never in the condition that decides pass or fail — so the - # decisive slice is the condition line, not the whole if-block. - decisive = workflow.split('if tag="$(', 1)[1].split("\n", 1)[0] - self.assertIn("--exact-match", decisive) + # decisive slice is the line reading the tags, not the whole block. + decisive = workflow.split('tags="$(', 2)[1].split("\n", 1)[0] + self.assertIn("--points-at HEAD", decisive) self.assertNotIn("--abbrev=0", decisive) + def test_every_tag_on_head_is_considered(self): + """Several tags can point at main. Judging only one (as describe does) + fails a correctly released main when a non-release tag wins.""" + workflow = self.read_workflow() + + self.assertIn('done <<< "$tags"', workflow) + self.assertIn("while IFS= read -r t", workflow) + def test_no_tags_is_reported_as_unevaluable_not_as_drift(self): """A repo with zero tags produces the same 'not tagged' as one that drifted. Those need different answers, so the measurement proves it @@ -77,7 +87,7 @@ def test_no_tags_is_reported_as_unevaluable_not_as_drift(self): self.assertIn('if [ -z "$(git tag)" ]; then', workflow) self.assertLess( workflow.index('if [ -z "$(git tag)" ]'), - workflow.index("git describe --exact-match"), + workflow.index("git tag --points-at HEAD"), ) def test_shallow_checkout_would_break_the_measurement(self): @@ -94,12 +104,13 @@ def test_an_exact_match_alone_is_not_the_invariant(self): workflow = self.read_workflow() self.assertIn("[0-9]+\\.[0-9]+\\.[0-9]+", workflow) - self.assertIn("not a release version tag", workflow) + self.assertIn("none of which is a release version tag", workflow) # Prerelease detection keys on the hyphen AFTER the version, not any # hyphen anywhere — the old `case $tag in *-*)` called `my-tag` a # prerelease and would have accepted it under allow-prerelease. self.assertNotIn('case "$tag" in', workflow) + self.assertIn("pre_re=", workflow) self.assertIn("^v?[0-9]+\\.[0-9]+\\.[0-9]+-", workflow) def test_the_merge_to_tag_window_is_retried_not_reported_as_drift(self): @@ -124,7 +135,7 @@ def test_a_prerelease_on_main_fails_by_default(self): workflow = self.read_workflow() self.assertIn(" default: false\n", workflow) - self.assertIn('if [ "$ALLOW_PRERELEASE" != "true" ]', workflow) + self.assertIn('[ "$ALLOW_PRERELEASE" != "true" ]', workflow) self.assertIn("ALLOW_PRERELEASE: ${{ inputs.allow-prerelease }}", workflow) def test_failures_say_what_to_do_next(self): @@ -182,7 +193,7 @@ def tag_old(repo): cases = ( ("no tags", no_tags, "true", False, "stderr", "no tags"), ("untagged head", untagged_head, "true", False, "stderr", "not a tagged release"), - ("moving tag", tag_head("snapshot"), "true", False, "stderr", "not a release version tag"), + ("moving tag", tag_head("snapshot"), "true", False, "stderr", "none of which is a release version tag"), ("release tag", tag_head("v1.2.3"), "true", True, "stdout", "released at v1.2.3"), ("prerelease denied", tag_head("v1.2.3-rc.1"), "false", False, None, None), ("prerelease allowed", tag_head("v1.2.3-rc.1"), "true", True, None, None), @@ -224,6 +235,62 @@ def tag_old(repo): if needle: self.assertIn(needle, getattr(result, stream)) + def run_check(self, setup, allow_prerelease="false"): + """Run the real step script against a throwaway repo.""" + workflow = self.read_workflow() + step = workflow.split("- name: Assert main points at a release tag", 1)[1] + body = step.split(" run: |\n", 1)[1] + script = textwrap.dedent(body) + with tempfile.TemporaryDirectory() as tmp: + env = { + **os.environ, + "ALLOW_PRERELEASE": allow_prerelease, + "GIT_CONFIG_GLOBAL": os.devnull, + "GIT_CONFIG_SYSTEM": os.devnull, + } + + def git(*args): + subprocess.run( + ["git", "-c", "user.name=t", "-c", "user.email=t@t", "-c", "commit.gpgsign=false", "-c", "tag.gpgsign=false", *args], + cwd=tmp, env=env, check=True, capture_output=True, + ) + + git("init", "-q") + git("commit", "-q", "--allow-empty", "-m", "release") + setup(git) + return subprocess.run( + ["bash", "-c", script], cwd=tmp, env=env, capture_output=True, text=True + ) + + def test_behavior_release_tag_among_non_release_tags_passes(self): + def setup(git): + git("tag", "v1.2.3") + git("tag", "-a", "v1", "-m", "moving") + git("tag", "-a", "latest", "-m", "moving") + + result = self.run_check(setup) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn("main is released at v1.2.3", result.stdout) + + def test_behavior_final_release_beats_prerelease_when_prereleases_disallowed(self): + def setup(git): + git("tag", "-a", "v1.0.0-rc.1", "-m", "rc") + git("tag", "v1.0.0") + + result = self.run_check(setup) + self.assertEqual(result.returncode, 0, result.stderr) + self.assertIn("main is released at v1.0.0", result.stdout) + + def test_behavior_only_prerelease_fails_by_default(self): + result = self.run_check(lambda git: git("tag", "v1.0.0-rc.1")) + self.assertNotEqual(result.returncode, 0) + self.assertIn("prerelease v1.0.0-rc.1", result.stderr) + + def test_behavior_only_non_release_tag_fails(self): + result = self.run_check(lambda git: git("tag", "latest")) + self.assertNotEqual(result.returncode, 0) + self.assertIn("none of which is a release version tag", result.stderr) + def read_workflow(self): self.assertTrue(WORKFLOW.is_file(), f"missing workflow: {WORKFLOW}") return WORKFLOW.read_text() diff --git a/.github/workflows/main-is-released.yml b/.github/workflows/main-is-released.yml index 9cfa0fe..0556590 100644 --- a/.github/workflows/main-is-released.yml +++ b/.github/workflows/main-is-released.yml @@ -80,12 +80,12 @@ jobs: # itself seconds later. Refetch and retry before believing it. This # cannot mask real drift: a genuinely untagged main is still # untagged on the last attempt. - tag="" + tags="" for attempt in 1 2 3; do - if tag="$(git describe --exact-match --tags HEAD 2>/dev/null)"; then + tags="$(git tag --points-at HEAD)" + if [ -n "$tags" ]; then break fi - tag="" [ "$attempt" -eq 3 ] && break echo "main is untagged on attempt ${attempt}; refetching tags in case a promotion is mid-cut" sleep 20 @@ -95,30 +95,46 @@ jobs: || echo "::warning::could not refetch tags on attempt ${attempt}; the verdict below uses the refs currently available on the runner" done - if [ -z "$tag" ]; then + if [ -z "$tags" ]; then latest="$(git describe --tags --abbrev=0 HEAD 2>/dev/null || echo '')" ahead="$(git rev-list --count "${latest}..HEAD" 2>/dev/null || echo '?')" echo "::error::main is not a tagged release. Newest reachable tag is ${latest}, and main is ${ahead} commit(s) past it. Either cut a release or move the unshipped work to a dev branch." >&2 exit 1 fi - # An exact match alone is not the invariant. Any tag satisfies it, - # including one literally named "snapshot" or "latest" parked on a - # drifted main — which reads as a pass and is the failure this - # workflow exists to catch. Require a release-shaped tag. - if ! printf '%s' "$tag" | grep -Eq '^v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'; then - echo "::error::main points at ${tag}, which is not a release version tag (expected vMAJOR.MINOR.PATCH). A moving or descriptive tag satisfies an exact-match check while main carries unshipped work." >&2 - exit 1 - fi - + # Any tag at HEAD satisfies "is tagged", including one literally + # named "snapshot" or "latest" parked on a drifted main, which reads + # as a pass and is the failure this workflow exists to catch. Several + # tags can point at one commit, so look at all of them and require + # at least one release-shaped tag. + release_re='^v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$' # Prerelease is the part AFTER the version, so match on that rather # than on any hyphen anywhere in the tag. - if printf '%s' "$tag" | grep -Eq '^v?[0-9]+\.[0-9]+\.[0-9]+-'; then - if [ "$ALLOW_PRERELEASE" != "true" ]; then - echo "::error::main points at prerelease ${tag}. Prereleases belong on the dev branch; main carries what users actually run." >&2 - exit 1 + pre_re='^v?[0-9]+\.[0-9]+\.[0-9]+-' + ok="" + pre="" + while IFS= read -r t; do + [ -n "$t" ] || continue + printf '%s' "$t" | grep -Eq "$release_re" || continue + if printf '%s' "$t" | grep -Eq "$pre_re" && [ "$ALLOW_PRERELEASE" != "true" ]; then + pre="${pre:+${pre} }${t}" + continue + fi + ok="$t" + break + done <<< "$tags" + + if [ -z "$ok" ]; then + if [ -n "$pre" ]; then + echo "::error::main points at prerelease ${pre}. Prereleases belong on the dev branch; main carries what users actually run." >&2 + else + echo "::error::main points at ${tags//$'\n'/ }, none of which is a release version tag (expected vMAJOR.MINOR.PATCH). A moving or descriptive tag marks main as tagged while it carries unshipped work." >&2 fi - echo "::warning::main points at prerelease ${tag}, accepted because allow-prerelease is set" + exit 1 + fi + + if printf '%s' "$ok" | grep -Eq "$pre_re"; then + echo "::warning::main points at prerelease ${ok}, accepted because allow-prerelease is set" fi - echo "main is released at ${tag}" + echo "main is released at ${ok}" From b30f5536d1b216888a84b774ed1dee247d795a1b Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:44:22 -0500 Subject: [PATCH 03/13] test(greptile-summon): execute github-script logic under node --- .../tests/greptile_summon_contract_test.py | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/.github/tests/greptile_summon_contract_test.py b/.github/tests/greptile_summon_contract_test.py index 0cc964d..1fa7222 100644 --- a/.github/tests/greptile_summon_contract_test.py +++ b/.github/tests/greptile_summon_contract_test.py @@ -1,5 +1,11 @@ from pathlib import Path +import json +import os import re +import shutil +import subprocess +import tempfile +import textwrap import unittest @@ -83,6 +89,97 @@ def test_workflow_pins_actions_and_is_run_by_standards_validation(self): ).read_text() self.assertIn("greptile_summon_contract_test.py", validation) + def test_summon_script_behavior(self): + node = shutil.which("node") + if node is None: + self.skipTest("node is not available") + + sha = "a" * 40 + other = "b" * 40 + marker = f"" + + def pull(head, state="open"): + return {"data": {"state": state, "head": {"sha": head}}} + + bot_comment = {"user": {"login": "github-actions[bot]"}, "body": marker} + cases = ( + ("abc", [], [], 1, 0, 0), + ("1x", [], [], 1, 0, 0), + ("7", [pull(sha, "closed")], [], 1, 0, 0), + ("7", [pull(other)], [], 1, 0, 0), + ("7", [pull(sha)], [bot_comment], 0, 0, 1), + ("7", [pull(sha), pull(other)], [], 1, 0, 0), + ("7", [pull(sha), pull(sha)], [], 0, 1, 0), + ) + + body = self.script_body(self.read_workflow()) + harness = textwrap.dedent( + """\ + const body = %s; + const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor; + const run = new AsyncFunction("github", "core", "context", "process", body); + const scenario = JSON.parse(process.argv[2]); + const calls = { setFailed: [], notice: [], createComment: [] }; + const queue = [...scenario.pulls]; + const listComments = () => {}; + const github = { + rest: { + pulls: { get: async () => queue.shift() }, + issues: { + listComments, + createComment: async (args) => { calls.createComment.push(args); }, + }, + }, + paginate: async () => scenario.comments, + }; + const core = { + setFailed: (m) => calls.setFailed.push(m), + notice: (m) => calls.notice.push(m), + }; + const context = { repo: { owner: "o", repo: "r" } }; + run(github, core, context, process).then( + () => console.log(JSON.stringify(calls)), + (e) => { console.error(e); process.exit(1); }, + ); + """ + ) % json.dumps(body) + + with tempfile.TemporaryDirectory() as tmp: + harness_path = Path(tmp) / "harness.js" + harness_path.write_text(harness) + for pr_number, pulls, comments, failed, created, notices in cases: + with self.subTest(pr_number=pr_number, pulls=pulls): + env = { + **os.environ, + "PR_NUMBER": pr_number, + "HEAD_SHA": sha, + "REVIEW_FOCUS": "check the diff", + } + result = subprocess.run( + [node, str(harness_path), json.dumps({"pulls": pulls, "comments": comments})], + check=True, + capture_output=True, + text=True, + env=env, + ) + calls = json.loads(result.stdout) + self.assertEqual(len(calls["setFailed"]), failed, calls) + self.assertEqual(len(calls["createComment"]), created, calls) + self.assertEqual(len(calls["notice"]), notices, calls) + if created: + comment_body = calls["createComment"][0]["body"] + self.assertIn("@greptileai", comment_body) + self.assertIn(marker, comment_body) + + def script_body(self, workflow): + lines = workflow.split(" script: |\n", 1)[1].splitlines() + body = [] + for line in lines: + if line.strip() and not line.startswith(" " * 12): + break + body.append(line[12:]) + return "\n".join(body) + def read_workflow(self): self.assertTrue(WORKFLOW.is_file(), f"missing workflow: {WORKFLOW}") return WORKFLOW.read_text() From c0854c16bc19103681dd342f6f83925b192b2a83 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:54:54 -0500 Subject: [PATCH 04/13] test(hooks): cover the commit-msg hook accept and reject sets --- .../tests/commit_msg_hook_contract_test.py | 63 +++++++++++++++++++ .github/workflows/standards-validation.yml | 1 + scripts/validate.sh | 1 + 3 files changed, 65 insertions(+) create mode 100644 .github/tests/commit_msg_hook_contract_test.py diff --git a/.github/tests/commit_msg_hook_contract_test.py b/.github/tests/commit_msg_hook_contract_test.py new file mode 100644 index 0000000..bdee3b2 --- /dev/null +++ b/.github/tests/commit_msg_hook_contract_test.py @@ -0,0 +1,63 @@ +from pathlib import Path +import subprocess +import tempfile +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +HOOK = ROOT / "scripts" / "check-commit-msg.sh" + +ACCEPTED = [ + "feat(scope): x", + "fix!: x", + "revert: x", + "chore(deps/a.b-c): x", + "Merge branch 'x'", + "Merge pull request #1 from a/b", + "Merge remote-tracking branch 'o/x'", + "fixup! feat: x", + "squash! feat: x", + 'Revert "feat: x"', +] + +REJECTED = [ + "feat: ", + "Feat: x", + "wip: x", + "feat(Bad Scope): x", + "feat x", + "feat:x", +] + + +def run_hook(message): + with tempfile.TemporaryDirectory() as directory: + path = Path(directory) / "COMMIT_EDITMSG" + path.write_text(message, encoding="utf-8") + return subprocess.run( + ["bash", str(HOOK), str(path)], capture_output=True, text=True + ) + + +class CommitMsgHookContractTest(unittest.TestCase): + def test_accepts_valid_subjects(self): + for subject in ACCEPTED: + with self.subTest(subject=subject): + result = run_hook(subject + "\n") + self.assertEqual(0, result.returncode, result.stderr) + + def test_rejects_invalid_subjects(self): + for subject in REJECTED: + with self.subTest(subject=subject): + result = run_hook(subject + "\n") + self.assertEqual(1, result.returncode) + self.assertIn(subject, result.stderr) + self.assertIn("plain Conventional Commits", result.stderr) + + def test_only_first_line_is_checked(self): + result = run_hook("feat: x\n\nthis body is not a conventional subject\nwip: junk\n") + self.assertEqual(0, result.returncode, result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/.github/workflows/standards-validation.yml b/.github/workflows/standards-validation.yml index 349f846..29e86ec 100644 --- a/.github/workflows/standards-validation.yml +++ b/.github/workflows/standards-validation.yml @@ -44,6 +44,7 @@ jobs: python3 .github/tests/tracked_validation_test.py python3 .github/tests/changes_gate_contract_test.py python3 .github/tests/tree_receipt_contract_test.py + python3 .github/tests/commit_msg_hook_contract_test.py python3 .github/tests/test_wiring_contract_test.py - name: Compile Python diff --git a/scripts/validate.sh b/scripts/validate.sh index bef5609..ed99360 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -22,6 +22,7 @@ python3 .github/tests/main_is_released_contract_test.py python3 .github/tests/tracked_validation_test.py python3 .github/tests/changes_gate_contract_test.py python3 .github/tests/tree_receipt_contract_test.py +python3 .github/tests/commit_msg_hook_contract_test.py python3 .github/tests/test_wiring_contract_test.py echo "==> compile python" From bad85d638a34ba7c0d58f04f29997392de639f84 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:54:56 -0500 Subject: [PATCH 05/13] test(quality-report): cover the fail_on_incomplete=false rejection --- .github/tests/quality_report_contract_test.py | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/tests/quality_report_contract_test.py b/.github/tests/quality_report_contract_test.py index a423769..4daad90 100644 --- a/.github/tests/quality_report_contract_test.py +++ b/.github/tests/quality_report_contract_test.py @@ -62,6 +62,25 @@ def test_complete_fuzz_fixture_emits_a_valid_report_and_summary(self): self.assertIn("complete 2/2", summary) self.assertEqual(0, self.validate_report(report).returncode) + def test_aggregate_rejects_fail_on_incomplete_false(self): + result, report, _summary = self.aggregate( + "complete", + track="fuzz", + tool="go-fuzz", + expected=[ + "internal/auth/FuzzVerifyRequest", + "internal/docker/FuzzDecodeStats", + ], + fail_on_incomplete="false", + ) + + self.assertEqual(1, result.returncode, result.stderr) + self.assertIn( + "fail_on_incomplete must be true for CodesWhat telemetry", + report["errors"], + ) + self.assertNotEqual("passed", report["outcome"]) + def test_incomplete_fixture_fails_closed_without_a_subset_score(self): result, report, summary = self.aggregate( "incomplete", @@ -718,7 +737,15 @@ def test_standards_validation_runs_this_contract(self): ) def aggregate( - self, fixture, *, track, tool, expected, input_mutator=None, env=None + self, + fixture, + *, + track, + tool, + expected, + input_mutator=None, + env=None, + fail_on_incomplete="true", ): self.assertTrue(SCRIPT.is_file(), f"missing aggregator: {SCRIPT}") with tempfile.TemporaryDirectory() as temp_dir: @@ -766,7 +793,7 @@ def aggregate( "--report-name", "Fixture quality report", "--fail-on-incomplete", - "true", + fail_on_incomplete, "--github-output", str(github_output), "--github-step-summary", From 31b8582d3f2e481ab33d98cbd24f83bb8883e93e Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:54:58 -0500 Subject: [PATCH 06/13] fix(quality-report): aggregate only results from the current attempt --- .github/tests/quality_report_contract_test.py | 113 ++++++++++++++++++ .../workflows/quality-report-aggregate.yml | 20 +++- decisions/quality-reporting.md | 7 ++ quality-report/v1/select_artifacts.py | 112 +++++++++++++++++ 4 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 quality-report/v1/select_artifacts.py diff --git a/.github/tests/quality_report_contract_test.py b/.github/tests/quality_report_contract_test.py index 4daad90..7bf79ad 100644 --- a/.github/tests/quality_report_contract_test.py +++ b/.github/tests/quality_report_contract_test.py @@ -18,7 +18,9 @@ WORKFLOW = ROOT / ".github" / "workflows" / "quality-report-aggregate.yml" DECISION = ROOT / "decisions" / "quality-reporting.md" SHA = "0123456789abcdef0123456789abcdef01234567" +SELECTOR = CONTRACT_ROOT / "select_artifacts.py" QUALITY_REPORT = runpy.run_path(str(SCRIPT)) +SELECTOR_MODULE = runpy.run_path(str(SELECTOR)) class QualityReportContractTest(unittest.TestCase): @@ -101,6 +103,117 @@ def test_incomplete_fixture_fails_closed_without_a_subset_score(self): self.assertNotIn("Canonical score", summary) self.assertEqual(0, self.validate_report(report).returncode) + def test_partial_rerun_without_a_replacement_fails_closed(self): + def drop_stale_target(input_dir): + shutil.rmtree(input_dir / "quality-result-stats") + + result, report, summary = self.aggregate( + "complete", + track="fuzz", + tool="go-fuzz", + expected=[ + "internal/auth/FuzzVerifyRequest", + "internal/docker/FuzzDecodeStats", + ], + input_mutator=drop_stale_target, + ) + + self.assertNotEqual(0, result.returncode) + self.assertFalse(report["completeness"]["complete"]) + self.assertEqual("error", report["outcome"]) + self.assertIsNone(report["metrics"]) + self.assertNotIn("Canonical score", summary) + + def selector_fetch(self, artifacts, started_at="2026-08-13T12:00:00Z"): + calls = [] + + def fetch(path): + calls.append(path) + if "/attempts/" in path: + return {"run_started_at": started_at} + page = int(path.rsplit("page=", 1)[1]) + size = SELECTOR_MODULE["PAGE_SIZE"] + return { + "total_count": len(artifacts), + "artifacts": artifacts[(page - 1) * size : page * size], + } + + return fetch, calls + + def artifact(self, artifact_id, created_at, name="quality-result-a"): + return {"id": artifact_id, "name": name, "created_at": created_at} + + def select(self, artifacts, pattern="quality-result-*", **kwargs): + fetch, calls = self.selector_fetch(artifacts, **kwargs) + ids = SELECTOR_MODULE["select_artifacts"]( + "CodesWhat/example", "1", "2", pattern, fetch + ) + return ids, calls + + def test_selector_keeps_only_fresh_artifacts_matching_the_pattern(self): + ids, calls = self.select( + [ + self.artifact(1, "2026-08-13T11:59:59Z"), + self.artifact(2, "2026-08-13T12:00:01Z"), + self.artifact(3, "2026-08-13T12:05:00Z", name="other-result"), + self.artifact(4, "2026-08-13T12:10:00Z", name="quality-result-b"), + ] + ) + + self.assertEqual([2, 4], ids) + self.assertIn("/repos/CodesWhat/example/actions/runs/1/attempts/2", calls[0]) + + def test_selector_rejects_an_artifact_created_at_the_attempt_start(self): + ids, _ = self.select([self.artifact(1, "2026-08-13T12:00:00Z")]) + + self.assertEqual([], ids) + + def test_selector_reads_every_artifact_page(self): + artifacts = [ + self.artifact(i, "2026-08-13T13:00:00Z", name="quality-result-{0}".format(i)) + for i in range(1, 251) + ] + ids, calls = self.select(artifacts) + + self.assertEqual(list(range(1, 251)), ids) + self.assertEqual(3, len([c for c in calls if "/artifacts?" in c])) + + def test_selector_rejects_missing_or_ambiguous_timestamps(self): + error = SELECTOR_MODULE["SelectionError"] + with self.assertRaises(error): + self.select([{"id": 1, "name": "quality-result-a"}]) + with self.assertRaises(error): + self.select([self.artifact(1, "2026-08-13T12:30:00")]) + with self.assertRaises(error): + self.select([self.artifact(1, "2026-08-13T12:30:00Z")], started_at=None) + + def test_empty_selection_exits_zero_and_never_downloads_everything(self): + fetch, _ = self.selector_fetch([self.artifact(1, "2026-08-13T11:00:00Z")]) + with tempfile.TemporaryDirectory() as temp_dir: + output = Path(temp_dir) / "github-output" + code = SELECTOR_MODULE["main"]( + [ + "--repository", + "CodesWhat/example", + "--run-id", + "1", + "--run-attempt", + "2", + "--pattern", + "quality-result-*", + "--github-output", + str(output), + ], + fetch, + ) + self.assertEqual(0, code) + self.assertEqual("artifact_ids=\n", output.read_text()) + + workflow = WORKFLOW.read_text() + self.assertIn("artifact-ids: ${{ steps.select.outputs.artifact_ids }}", workflow) + self.assertIn("steps.select.outputs.artifact_ids != ''", workflow) + self.assertNotIn("pattern: ${{ inputs.result_artifact_pattern }}", workflow) + def test_crash_fixture_fails_even_when_every_target_reports(self): result, report, summary = self.aggregate( "crash", diff --git a/.github/workflows/quality-report-aggregate.yml b/.github/workflows/quality-report-aggregate.yml index 6196156..dd6c8e0 100644 --- a/.github/workflows/quality-report-aggregate.yml +++ b/.github/workflows/quality-report-aggregate.yml @@ -104,12 +104,28 @@ jobs: test -n "$started_at" echo "started_at=${started_at}" >> "$GITHUB_OUTPUT" + - name: Select target results from this attempt + id: select + if: always() + continue-on-error: true + env: + GH_TOKEN: ${{ github.token }} + PATTERN: ${{ inputs.result_artifact_pattern }} + run: | + set -euo pipefail + python3 quality-report-contract/quality-report/v1/select_artifacts.py \ + --repository "$GITHUB_REPOSITORY" \ + --run-id "$GITHUB_RUN_ID" \ + --run-attempt "$GITHUB_RUN_ATTEMPT" \ + --pattern "$PATTERN" \ + --github-output "$GITHUB_OUTPUT" + - name: Download normalized target results id: download - if: always() + if: always() && steps.select.outputs.artifact_ids != '' uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: - pattern: ${{ inputs.result_artifact_pattern }} + artifact-ids: ${{ steps.select.outputs.artifact_ids }} path: quality-result-artifacts - name: Validate and aggregate target results diff --git a/decisions/quality-reporting.md b/decisions/quality-reporting.md index b826c22..9aed1d1 100644 --- a/decisions/quality-reporting.md +++ b/decisions/quality-reporting.md @@ -114,6 +114,13 @@ The aggregate artifact is named `quality-report---` and contains `report.json` plus `summary.md`. Native reports and crash corpora remain separate artifacts. Target result JSON is always uploaded; crash forensics remain failure-only. +Completeness requires fresh results for every expected target. The aggregate +job downloads only artifacts matching `result_artifact_pattern` that were +created strictly after the current attempt started, selected by explicit +artifact ID. Results retained from an earlier attempt never count, and a +partial rerun that lacks replacements fails closed: `complete=false`, +`outcome=error`, no aggregate score, and a nonzero exit. An empty selection +downloads nothing instead of falling back to every artifact. Normalized aggregate artifacts use at least 90 days of retention. The reusable workflow checks out its own contract at the exact called-workflow diff --git a/quality-report/v1/select_artifacts.py b/quality-report/v1/select_artifacts.py new file mode 100644 index 0000000..4a13a25 --- /dev/null +++ b/quality-report/v1/select_artifacts.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +"""Select the target-result artifacts produced by the current workflow attempt.""" + +import argparse +from datetime import datetime, timezone +import fnmatch +import json +import re +import subprocess +import sys + +PAGE_SIZE = 100 +TIMESTAMP = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$") + + +class SelectionError(Exception): + pass + + +def gh_api(path): + result = subprocess.run( + ["gh", "api", path], capture_output=True, text=True, check=False, timeout=60 + ) + if result.returncode != 0: + raise SelectionError("gh api {0} failed: {1}".format(path, result.stderr.strip())) + try: + return json.loads(result.stdout) + except ValueError as error: + raise SelectionError("gh api {0} returned invalid JSON".format(path)) from error + + +def parse_timestamp(value, label): + if not isinstance(value, str) or not TIMESTAMP.match(value): + raise SelectionError("{0}: missing or ambiguous timestamp: {1!r}".format(label, value)) + parsed = datetime.fromisoformat(value.replace("Z", "+00:00")) + return parsed.astimezone(timezone.utc) + + +def list_artifacts(repository, run_id, fetch): + artifacts = [] + page = 1 + while True: + document = fetch( + "/repos/{0}/actions/runs/{1}/artifacts?per_page={2}&page={3}".format( + repository, run_id, PAGE_SIZE, page + ) + ) + batch = document.get("artifacts") if isinstance(document, dict) else None + if not isinstance(batch, list): + raise SelectionError("artifact listing page {0} is malformed".format(page)) + artifacts.extend(batch) + total = document.get("total_count") + if len(batch) < PAGE_SIZE or (isinstance(total, int) and len(artifacts) >= total): + return artifacts + page += 1 + + +def select_artifacts(repository, run_id, attempt, pattern, fetch=gh_api): + attempt_run = fetch( + "/repos/{0}/actions/runs/{1}/attempts/{2}".format(repository, run_id, attempt) + ) + started_at = parse_timestamp( + attempt_run.get("run_started_at") if isinstance(attempt_run, dict) else None, + "attempt run_started_at", + ) + selected = [] + for artifact in list_artifacts(repository, run_id, fetch): + name = artifact.get("name") + if not isinstance(name, str) or not fnmatch.fnmatchcase(name, pattern): + continue + if artifact.get("expired") is True: + continue + created_at = parse_timestamp( + artifact.get("created_at"), "artifact {0} created_at".format(name) + ) + if created_at > started_at: + artifact_id = artifact.get("id") + if not isinstance(artifact_id, int) or isinstance(artifact_id, bool): + raise SelectionError("artifact {0} has no integer id".format(name)) + selected.append(artifact_id) + return sorted(set(selected)) + + +def write_output(path, ids): + if path is not None: + with open(path, "a") as handle: + handle.write("artifact_ids={0}\n".format(",".join(str(i) for i in ids))) + + +def main(argv=None, fetch=gh_api): + parser = argparse.ArgumentParser() + parser.add_argument("--repository", required=True) + parser.add_argument("--run-id", required=True) + parser.add_argument("--run-attempt", required=True) + parser.add_argument("--pattern", required=True) + parser.add_argument("--github-output") + args = parser.parse_args(argv) + try: + ids = select_artifacts( + args.repository, args.run_id, args.run_attempt, args.pattern, fetch + ) + except SelectionError as error: + write_output(args.github_output, []) + print("error: {0}".format(error), file=sys.stderr) + return 1 + write_output(args.github_output, ids) + print("selected {0} artifact(s) from attempt {1}".format(len(ids), args.run_attempt)) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) From 179cb70652a52f1e3f8128513805c41b29bf9bde Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:54:59 -0500 Subject: [PATCH 07/13] docs(onboarding): fix the starchart caller trigger guidance --- .../tests/starchart_refresh_contract_test.py | 18 ++++++++++++++++++ REPOSITORY_ONBOARDING.md | 16 +++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/tests/starchart_refresh_contract_test.py b/.github/tests/starchart_refresh_contract_test.py index e611d67..c749ccf 100644 --- a/.github/tests/starchart_refresh_contract_test.py +++ b/.github/tests/starchart_refresh_contract_test.py @@ -191,6 +191,24 @@ def test_the_documented_trigger_is_a_dispatch_not_a_cron_or_a_release(self): for dead in ("release:", "types: [published]", "cron", "schedule:"): self.assertNotIn(dead, example) + def test_onboarding_doc_recommends_dispatch_not_release_trigger(self): + doc = (ROOT / "REPOSITORY_ONBOARDING.md").read_text() + start = doc.index("A repository that still commits a first-party star-history") + item = " ".join(doc[start:].split("\n### ", 1)[0].split()) + + for expected in ( + "workflow_dispatch", + "integration branch", + "`actions: write`", + "`contents: write`", + "Do not trigger it with `release: [published]`", + ): + self.assertIn(expected, item) + + # Any mention of the release trigger must sit inside a prohibition. + for match in re.finditer(re.escape("`release: [published]`"), item): + self.assertRegex(item[: match.start()], r"Do not trigger it with $") + def test_the_suppression_trap_is_documented_not_just_avoided(self): """Removing the bad example only stops it being copied from here. The reason has to travel with it, or the next person reaches for the diff --git a/REPOSITORY_ONBOARDING.md b/REPOSITORY_ONBOARDING.md index a95300b..9d08a41 100644 --- a/REPOSITORY_ONBOARDING.md +++ b/REPOSITORY_ONBOARDING.md @@ -346,11 +346,17 @@ Add these only when the behavior exists: credential into the README. A hosted chart is live presentation rather than a release artifact, so it needs no refresh workflow. - [ ] A repository that still commits a first-party star-history SVG pair keeps - its pinned `starchart-refresh.yml` caller, on `release: [published]` plus - `workflow_dispatch` with the job granted `contents: write`, until it moves to - Star History through its own reviewed change. Trace other consumers of the - committed SVGs, such as a website, before removing them or the caller. The - reusable workflow keeps its interface for existing pins. + its pinned `starchart-refresh.yml` caller, on `workflow_dispatch` (and + `repository_dispatch` if used) with the job granted `contents: write`, until + it moves to Star History through its own reviewed change. Do not trigger it + with `release: [published]`. Releases published with GITHUB_TOKEN create no + downstream run, so the refresh silently never happens. The release-cut + workflow dispatches it instead, running `gh workflow run .yml --ref + "$BRANCH"` against the active integration branch, with `actions: write` on + the dispatching job. See the header of `.github/workflows/starchart-refresh.yml`. + Trace other consumers of the committed SVGs, such as a website, before + removing them or the caller. The reusable workflow keeps its interface for + existing pins. ### Qlty From 471af48a1327980f116566f6227139d32127bbc2 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:55:02 -0500 Subject: [PATCH 08/13] fix(starchart): retry transient API failures and rebase before pushing --- .../tests/starchart_refresh_contract_test.py | 170 ++++++++++++++++++ .github/workflows/starchart-refresh.yml | 90 ++++++++-- 2 files changed, 249 insertions(+), 11 deletions(-) diff --git a/.github/tests/starchart_refresh_contract_test.py b/.github/tests/starchart_refresh_contract_test.py index c749ccf..ac3743e 100644 --- a/.github/tests/starchart_refresh_contract_test.py +++ b/.github/tests/starchart_refresh_contract_test.py @@ -1,4 +1,6 @@ from pathlib import Path +import json +import os import re import shutil import subprocess @@ -334,6 +336,174 @@ def test_embedded_generator_is_valid_javascript(self): ) self.assertEqual(result.returncode, 0, result.stderr) + def test_api_helper_retries_transient_failures_and_bounds_each_request(self): + workflow = self.read_workflow() + for expected in ( + "AbortSignal.timeout(REQUEST_TIMEOUT_MS)", + "const REQUEST_TIMEOUT_MS = 15000", + "const MAX_ATTEMPTS = 4", + "const FETCH_BUDGET_MS = 7 * 60 * 1000", + "const MAX_BACKOFF_MS = 30000", + ): + self.assertIn(expected, workflow) + + def test_generator_recovers_from_a_transient_5xx_or_429(self): + for status in (502, 429): + with self.subTest(status=status): + result = self.run_generator( + [self.repo_reply(2), {"status": status}, self.stars_reply()] + ) + self.assertEqual(result["code"], 0, result["stderr"]) + self.assertEqual(len(result["fetches"]), 3) + self.assertEqual(len(result["sleeps"]), 1) + self.assertTrue(result["svgs"]) + + def test_generator_waits_out_a_rate_limit(self): + reply = {"status": 403, "headers": {"retry-after": "7"}} + result = self.run_generator([self.repo_reply(2), reply, self.stars_reply()]) + self.assertEqual(result["code"], 0, result["stderr"]) + self.assertEqual(result["sleeps"], [7000]) + + reset = { + "status": 403, + "headers": {"x-ratelimit-remaining": "0", "x-ratelimit-reset": "__SOON__"}, + } + result = self.run_generator([self.repo_reply(2), reset, self.stars_reply()]) + self.assertEqual(result["code"], 0, result["stderr"]) + self.assertEqual(len(result["sleeps"]), 1) + self.assertGreater(result["sleeps"][0], 1000) + + def test_generator_backs_off_exponentially_between_attempts(self): + result = self.run_generator( + [self.repo_reply(2), {"status": 500}, {"status": 503}, self.stars_reply()] + ) + self.assertEqual(result["code"], 0, result["stderr"]) + self.assertEqual(result["sleeps"], [1000, 2000]) + + def test_generator_aborts_a_hung_request_on_the_deadline(self): + result = self.run_generator([self.repo_reply(2), {"hang": True}, self.stars_reply()]) + self.assertEqual(result["code"], 0, result["stderr"]) + self.assertEqual(result["timeouts"][0], 15000) + self.assertEqual(len(result["fetches"]), 3) + + def test_generator_exits_nonzero_when_retries_are_exhausted(self): + result = self.run_generator([self.repo_reply(2)] + [{"status": 502}] * 4) + self.assertNotEqual(result["code"], 0) + self.assertEqual(len(result["fetches"]), 5) + self.assertIn("stargazers?per_page=100&page=1", result["stderr"]) + self.assertIn("502", result["stderr"]) + self.assertEqual(result["svgs"], []) + + def test_generator_fails_at_once_on_a_permanent_client_error(self): + for status in (404, 401, 403): + with self.subTest(status=status): + result = self.run_generator([{"status": status}]) + self.assertNotEqual(result["code"], 0) + self.assertEqual(len(result["fetches"]), 1) + self.assertEqual(result["sleeps"], []) + self.assertIn(str(status), result["stderr"]) + self.assertIn("https://api.github.com/repos/o/r", result["stderr"]) + self.assertEqual(result["svgs"], []) + + def test_commit_step_rebases_and_retries_a_rejected_push(self): + step = self.read_workflow().split("Commit the chart only when it actually changed", 1)[1] + self.assertIn('git push origin "HEAD:$TARGET_BRANCH"', step) + self.assertRegex(step, r"for attempt in 1 2 3; do") + self.assertIn('git fetch --depth=50 origin "$TARGET_BRANCH"', step) + self.assertIn('git rebase "origin/$TARGET_BRANCH"', step) + self.assertLess(step.index("for attempt in"), step.index("git push origin")) + self.assertLess(step.index("git rebase"), step.index("could not push the chart")) + self.assertIn("exit 1", step.split("could not push the chart", 1)[1]) + + @staticmethod + def repo_reply(count): + return {"status": 200, "body": {"stargazers_count": count}} + + @staticmethod + def stars_reply(): + return { + "status": 200, + "body": [ + {"starred_at": "2024-01-01T00:00:00Z"}, + {"starred_at": "2024-06-01T00:00:00Z"}, + ], + } + + def run_generator(self, replies): + """Run the extracted generator under node with fetch, timers and the + abort deadline mocked, in a scratch workspace. Returns exit code, + stderr, and what the mocks saw.""" + node = shutil.which("node") + if node is None: + self.skipTest("node is not available") + + soon = str(int(__import__("time").time()) + 5) + for reply in replies: + for key, value in reply.get("headers", {}).items(): + if value == "__SOON__": + reply["headers"][key] = soon + + preamble = """ +const __replies = JSON.parse(process.env.MOCK_REPLIES) +const __log = { fetches: [], sleeps: [], timeouts: [] } +const __realTimeout = AbortSignal.timeout.bind(AbortSignal) +AbortSignal.timeout = (ms) => { __log.timeouts.push(ms); return __realTimeout(40) } +globalThis.setTimeout = (fn, ms) => { __log.sleeps.push(ms); queueMicrotask(fn); return 0 } +Math.random = () => 0 +globalThis.fetch = (url, init) => { + __log.fetches.push(String(url)) + const reply = __replies.shift() + if (!reply) return Promise.reject(new Error('unexpected extra fetch')) + if (reply.hang) { + // AbortSignal.timeout timers are unref'd, so hold the loop open until it fires. + const keepAlive = setInterval(() => {}, 1000) + return new Promise((_, reject) => + init.signal.addEventListener('abort', () => { + clearInterval(keepAlive) + reject(init.signal.reason) + })) + } + const headers = new Headers(reply.headers ?? {}) + return Promise.resolve({ + ok: reply.status >= 200 && reply.status < 300, + status: reply.status, + statusText: 'mock', + headers, + json: async () => reply.body, + }) +} +process.on('exit', () => process.stdout.write('__LOG__' + JSON.stringify(__log))) +""" + with tempfile.TemporaryDirectory() as tmp: + workspace = Path(tmp) / "ws" + workspace.mkdir() + script = Path(tmp) / "generator.mjs" + script.write_text(preamble + self.read_generator()) + env = { + "PATH": os.environ.get("PATH", ""), + "TARGET_REPO": "o/r", + "OUTPUT_PATH": "out/chart.svg", + "ACCENT": "#aabbcc", + "MAX_PAGES": "100", + "GITHUB_API_TOKEN": "x", + "GITHUB_WORKSPACE": str(workspace), + "MOCK_REPLIES": json.dumps(replies), + } + proc = subprocess.run( + [node, str(script)], + capture_output=True, + text=True, + check=False, + env=env, + timeout=60, + ) + svgs = sorted(str(p.name) for p in workspace.rglob("*.svg")) + + self.assertIn("__LOG__", proc.stdout, proc.stderr) + log = json.loads(proc.stdout.rsplit("__LOG__", 1)[1]) + log.update(code=proc.returncode, stderr=proc.stderr, svgs=svgs) + return log + def test_workflow_pins_actions_and_is_run_by_standards_validation(self): workflow = self.read_workflow() actions = re.findall(r"^\s+uses: ([^\s#]+)", workflow, re.MULTILINE) diff --git a/.github/workflows/starchart-refresh.yml b/.github/workflows/starchart-refresh.yml index b1d3ca4..922518c 100644 --- a/.github/workflows/starchart-refresh.yml +++ b/.github/workflows/starchart-refresh.yml @@ -208,17 +208,75 @@ jobs: throw new Error(`max-pages must be a positive integer, got: ${process.env.MAX_PAGES}`) } + // One flaky response on page 60 of 100 shouldn't cost the whole run, + // and a hung socket shouldn't eat the job timeout. Each attempt has a + // 15 s deadline covering the body as well as the headers. Transient + // failures (network, timeout, 5xx, 429, and a 403 that is clearly a + // rate limit) retry up to 4 attempts inside one 7 minute budget. + // Anything else fails at once, so a bad credential or a missing repo + // isn't hammered. + const REQUEST_TIMEOUT_MS = 15000 + const MAX_ATTEMPTS = 4 + const FETCH_BUDGET_MS = 7 * 60 * 1000 + const MAX_BACKOFF_MS = 30000 + const fetchStarted = Date.now() + const sleep = (ms) => new Promise((done) => setTimeout(done, ms)) + + // Retry-After (seconds or a date) wins, then x-ratelimit-reset + // (epoch seconds), then exponential backoff with jitter. + const retryDelayMs = (res, attempt) => { + const retryAfter = res?.headers.get('retry-after') + if (retryAfter) { + const seconds = Number(retryAfter) + const ms = Number.isFinite(seconds) ? seconds * 1000 : Date.parse(retryAfter) - Date.now() + if (Number.isFinite(ms)) return Math.max(0, ms) + } + const reset = Number(res?.headers.get('x-ratelimit-reset')) + if (res?.headers.get('x-ratelimit-remaining') === '0' && Number.isFinite(reset) && reset > 0) { + return Math.max(0, reset * 1000 - Date.now()) + 1000 + } + return Math.min(MAX_BACKOFF_MS, 1000 * 2 ** (attempt - 1) + Math.random() * 500) + } + const api = async (path, accept) => { - const res = await fetch(`https://api.github.com/${path}`, { - headers: { - accept, - authorization: `Bearer ${auth}`, - 'user-agent': 'codeswhat-starchart', - 'x-github-api-version': '2022-11-28', - }, - }) - if (!res.ok) throw new Error(`GET ${path} -> ${res.status} ${res.statusText}`) - return res.json() + const url = `https://api.github.com/${path}` + for (let attempt = 1; ; attempt++) { + let res + let failure + try { + res = await fetch(url, { + headers: { + accept, + authorization: `Bearer ${auth}`, + 'user-agent': 'codeswhat-starchart', + 'x-github-api-version': '2022-11-28', + }, + signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), + }) + if (res.ok) return await res.json() + failure = `${res.status} ${res.statusText}` + } catch (err) { + // Network error, deadline abort, or a body that died mid-read. + res = undefined + failure = err?.name === 'TimeoutError' || err?.name === 'AbortError' + ? `timed out after ${REQUEST_TIMEOUT_MS} ms` + : `network error: ${err?.message ?? err}` + } + + const rateLimited = + res?.status === 429 || + (res?.status === 403 && + (res.headers.get('x-ratelimit-remaining') === '0' || res.headers.has('retry-after'))) + const retryable = !res || res.status >= 500 || rateLimited + if (!retryable) throw new Error(`GET ${url} -> ${failure}`) + + const delay = retryDelayMs(res, attempt) + if (attempt >= MAX_ATTEMPTS || Date.now() - fetchStarted + delay > FETCH_BUDGET_MS) { + throw new Error(`GET ${url} -> ${failure} (gave up after ${attempt} attempt(s))`) + } + console.log(`::warning::GET ${url} -> ${failure}; retrying in ${Math.round(delay)} ms (attempt ${attempt} of ${MAX_ATTEMPTS})`) + await sleep(delay) + } } const total = (await api(`repos/${repo}`, 'application/vnd.github+json')).stargazers_count @@ -558,4 +616,14 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add -- "$OUTPUT_PATH" "$DARK_PATH" git commit -m "chore(docs): refresh the star-history chart" - git push origin "HEAD:$TARGET_BRANCH" + # Another run or a human can land on the branch between checkout and + # here. The commit touches only the two SVGs, so rebasing onto + # whatever arrived is safe. Bounded, so a real rejection still fails. + for attempt in 1 2 3; do + if git push origin "HEAD:$TARGET_BRANCH"; then exit 0; fi + echo "::warning::push rejected (attempt $attempt); rebasing onto origin/$TARGET_BRANCH" + git fetch --depth=50 origin "$TARGET_BRANCH" + git rebase "origin/$TARGET_BRANCH" + done + echo "::error::could not push the chart after 3 attempts" >&2 + exit 1 From d33370df6a59a06ae81ef99aaed817cd10327e63 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:55:03 -0500 Subject: [PATCH 09/13] fix(release-gate): page run lookups to the API 1,000-run ceiling --- .github/tests/reusable_ci_contract_test.py | 45 ++++++++++++++++++++-- .github/workflows/release-gate.yml | 4 +- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/tests/reusable_ci_contract_test.py b/.github/tests/reusable_ci_contract_test.py index 22e18f9..3f6def3 100644 --- a/.github/tests/reusable_ci_contract_test.py +++ b/.github/tests/reusable_ci_contract_test.py @@ -297,7 +297,7 @@ def test_release_gate_checks_every_workflow_by_exact_sha_push_and_nonempty_branc def test_release_gate_keeps_authoritative_client_side_run_filtering(self): release = self.read_workflow(WORKFLOWS["release"]) - self.assertIn("for page in 1 2 3 4 5; do", release) + self.assertIn("for ((page=1; page<=10; page++)); do", release) self.assertIn("/runs?per_page=100&page=${page}\"", release) self.assertIn("-lt 100 ]; then", release) self.assertNotRegex(release, r"runs\?[^\"\n]*(?:event|head_sha)=") @@ -338,7 +338,44 @@ def test_release_gate_stops_paging_after_a_short_page(self): self.assertEqual(1, len(result.requests), result.requests) self.assertTrue(result.requests[0].endswith("/runs?per_page=100&page=1")) - def test_release_gate_caps_paging_at_five_pages(self): + def test_release_gate_finds_a_target_run_past_five_pages(self): + filler = { + "head_sha": "b" * 40, + "event": "push", + "head_branch": "main", + "status": "completed", + "conclusion": "success", + } + exact_success = {**filler, "head_sha": TARGET_SHA} + result = self.run_release_gate( + {"ci-verify.yml": [filler] * 100}, + extra_pages_by_workflow={ + "ci-verify.yml": [[filler] * 100] * 4 + [[exact_success]] + }, + ) + + self.assertEqual(0, result.returncode, result.stderr) + self.assertIn(f"Found successful CI Verify push run for {TARGET_SHA}.", result.stdout) + self.assertEqual(6, len(result.requests), result.requests) + + def test_release_gate_times_out_when_pages_are_exhausted_without_a_match(self): + filler = { + "head_sha": "b" * 40, + "event": "push", + "head_branch": "main", + "status": "completed", + "conclusion": "success", + } + result = self.run_release_gate( + {"ci-verify.yml": [filler] * 100}, + extra_pages_by_workflow={"ci-verify.yml": [[filler] * 100] * 4}, + ) + + self.assertNotEqual(0, result.returncode) + self.assertIn("Timed out waiting for successful CI Verify push run", result.stdout + result.stderr) + self.assertEqual(6, len(result.requests), result.requests) + + def test_release_gate_caps_paging_at_the_api_result_ceiling(self): filler = { "head_sha": "b" * 40, "event": "push", @@ -348,11 +385,11 @@ def test_release_gate_caps_paging_at_five_pages(self): } result = self.run_release_gate( {"ci-verify.yml": [filler] * 100}, - extra_pages_by_workflow={"ci-verify.yml": [[filler] * 100] * 5}, + extra_pages_by_workflow={"ci-verify.yml": [[filler] * 100] * 14}, ) self.assertNotEqual(0, result.returncode) - self.assertEqual(5, len(result.requests), result.requests) + self.assertEqual(10, len(result.requests), result.requests) def test_release_gate_uses_one_shared_poll_budget_for_every_workflow(self): in_progress = { diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.yml index 38be7ca..c279eb7 100644 --- a/.github/workflows/release-gate.yml +++ b/.github/workflows/release-gate.yml @@ -117,9 +117,9 @@ jobs: workflow_id="${workflow_ids[${index}]}" workflow_name="${workflow_names[${index}]}" # GitHub's `?head_sha=` and `?event=` query filters have been spuriously returning 0 results since 2026-04-27. - # Filter the latest runs client-side instead, paging up to 5 x 100 so an older target run is still found. + # Filter the latest runs client-side instead, paging until a short page or the API's 1,000-result ceiling (10 x 100). runs_pages=() - for page in 1 2 3 4 5; do + for ((page=1; page<=10; page++)); do runs_url="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow_id}/runs?per_page=100&page=${page}" page_json="$(curl --proto '=https' --tlsv1.2 --retry 3 --fail --silent --show-error \ -H "Authorization: Bearer ${GH_TOKEN}" \ From baccca7239084ecf073baaa99058b0acfcf24414 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 09:08:10 -0500 Subject: [PATCH 10/13] test(main-is-released): strip GIT_* env so hook runs cannot touch the real repo --- .../tests/main_is_released_contract_test.py | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/tests/main_is_released_contract_test.py b/.github/tests/main_is_released_contract_test.py index 897aedd..1a12a2f 100644 --- a/.github/tests/main_is_released_contract_test.py +++ b/.github/tests/main_is_released_contract_test.py @@ -6,12 +6,22 @@ import tempfile import textwrap import unittest +import unittest.mock ROOT = Path(__file__).resolve().parents[2] WORKFLOW = ROOT / ".github/workflows/main-is-released.yml" +def isolated_env(**extra): + """os.environ minus GIT_* variables. Under a git hook, GIT_DIR and + GIT_INDEX_FILE point at the real repository, and a throwaway repo's git + calls would write there instead.""" + env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")} + env.update(extra) + return env + + def extract_script(): """Return the `run: |` body of the assertion step, de-indented.""" lines = WORKFLOW.read_text().splitlines() @@ -156,6 +166,14 @@ def test_workflow_pins_actions_and_is_run_by_standards_validation(self): validation = (ROOT / ".github/workflows/standards-validation.yml").read_text() self.assertIn("main_is_released_contract_test.py", validation) + def test_isolated_env_drops_hook_git_variables(self): + """Pre-push runs these tests with GIT_DIR set to the real repo.""" + with unittest.mock.patch.dict(os.environ, {"GIT_DIR": "/real/.git", "GIT_INDEX_FILE": "/real/index"}): + env = isolated_env(EXTRA="1") + self.assertNotIn("GIT_DIR", env) + self.assertNotIn("GIT_INDEX_FILE", env) + self.assertEqual("1", env["EXTRA"]) + def test_main_is_released_script_behavior(self): """Run the extracted bash against throwaway repos so the pass/fail decision is exercised, not just grepped for.""" @@ -165,7 +183,7 @@ def test_main_is_released_script_behavior(self): def git(repo, *args): subprocess.run( - ["git", *args], cwd=repo, check=True, + ["git", *args], cwd=repo, check=True, env=isolated_env(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) @@ -208,10 +226,7 @@ def tag_old(repo): sleep.chmod(sleep.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) script = Path(tmp) / "assert.sh" script.write_text(script_text) - env = { - **os.environ, - "PATH": f"{bin_dir}{os.pathsep}{os.environ['PATH']}", - } + env = isolated_env(PATH=f"{bin_dir}{os.pathsep}{os.environ['PATH']}") for label, setup, allow, ok, stream, needle in cases: with self.subTest(label): @@ -242,12 +257,11 @@ def run_check(self, setup, allow_prerelease="false"): body = step.split(" run: |\n", 1)[1] script = textwrap.dedent(body) with tempfile.TemporaryDirectory() as tmp: - env = { - **os.environ, - "ALLOW_PRERELEASE": allow_prerelease, - "GIT_CONFIG_GLOBAL": os.devnull, - "GIT_CONFIG_SYSTEM": os.devnull, - } + env = isolated_env( + ALLOW_PRERELEASE=allow_prerelease, + GIT_CONFIG_GLOBAL=os.devnull, + GIT_CONFIG_SYSTEM=os.devnull, + ) def git(*args): subprocess.run( From 5efcd64906e02bd3b93b5883587eeed65d06ac1e Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 09:19:29 -0500 Subject: [PATCH 11/13] fix: expand artifact pattern braces and normalize the starchart retry branch --- .github/tests/quality_report_contract_test.py | 20 ++++++++ .../tests/starchart_refresh_contract_test.py | 7 ++- .github/workflows/starchart-refresh.yml | 7 +-- quality-report/v1/select_artifacts.py | 46 ++++++++++++++++++- 4 files changed, 74 insertions(+), 6 deletions(-) diff --git a/.github/tests/quality_report_contract_test.py b/.github/tests/quality_report_contract_test.py index 7bf79ad..09fbb45 100644 --- a/.github/tests/quality_report_contract_test.py +++ b/.github/tests/quality_report_contract_test.py @@ -163,6 +163,26 @@ def test_selector_keeps_only_fresh_artifacts_matching_the_pattern(self): self.assertEqual([2, 4], ids) self.assertIn("/repos/CodesWhat/example/actions/runs/1/attempts/2", calls[0]) + def test_selector_expands_brace_alternatives_like_download_artifact(self): + ids, _ = self.select( + [ + self.artifact(1, "2026-08-13T12:01:00Z", name="quality-result-auth"), + self.artifact(2, "2026-08-13T12:01:00Z", name="quality-result-stats"), + self.artifact(3, "2026-08-13T12:01:00Z", name="quality-result-other"), + self.artifact(4, "2026-08-13T11:00:00Z", name="quality-result-auth"), + ], + pattern="quality-result-{auth,stats}", + ) + + self.assertEqual([1, 2], ids) + + def test_brace_expansion_handles_nesting_and_literals(self): + expand = SELECTOR_MODULE["expand_braces"] + self.assertEqual(["a-x-1", "a-x-2", "a-y"], expand("a-{x-{1,2},y}")) + self.assertEqual(["a-{x}"], expand("a-{x}")) + self.assertEqual(["a-{x,y"], expand("a-{x,y")) + self.assertEqual(["quality-result-*"], expand("quality-result-*")) + def test_selector_rejects_an_artifact_created_at_the_attempt_start(self): ids, _ = self.select([self.artifact(1, "2026-08-13T12:00:00Z")]) diff --git a/.github/tests/starchart_refresh_contract_test.py b/.github/tests/starchart_refresh_contract_test.py index ac3743e..c8baabf 100644 --- a/.github/tests/starchart_refresh_contract_test.py +++ b/.github/tests/starchart_refresh_contract_test.py @@ -409,8 +409,11 @@ def test_commit_step_rebases_and_retries_a_rejected_push(self): step = self.read_workflow().split("Commit the chart only when it actually changed", 1)[1] self.assertIn('git push origin "HEAD:$TARGET_BRANCH"', step) self.assertRegex(step, r"for attempt in 1 2 3; do") - self.assertIn('git fetch --depth=50 origin "$TARGET_BRANCH"', step) - self.assertIn('git rebase "origin/$TARGET_BRANCH"', step) + # inputs.branch may be fully qualified; the remote-tracking ref may not. + self.assertIn('short_branch="${TARGET_BRANCH#refs/heads/}"', step) + self.assertIn('git fetch --depth=50 origin "+refs/heads/$short_branch:refs/remotes/origin/$short_branch"', step) + self.assertIn('git rebase "origin/$short_branch"', step) + self.assertNotIn('origin/$TARGET_BRANCH', step) self.assertLess(step.index("for attempt in"), step.index("git push origin")) self.assertLess(step.index("git rebase"), step.index("could not push the chart")) self.assertIn("exit 1", step.split("could not push the chart", 1)[1]) diff --git a/.github/workflows/starchart-refresh.yml b/.github/workflows/starchart-refresh.yml index 922518c..f0a5cb2 100644 --- a/.github/workflows/starchart-refresh.yml +++ b/.github/workflows/starchart-refresh.yml @@ -619,11 +619,12 @@ jobs: # Another run or a human can land on the branch between checkout and # here. The commit touches only the two SVGs, so rebasing onto # whatever arrived is safe. Bounded, so a real rejection still fails. + short_branch="${TARGET_BRANCH#refs/heads/}" for attempt in 1 2 3; do if git push origin "HEAD:$TARGET_BRANCH"; then exit 0; fi - echo "::warning::push rejected (attempt $attempt); rebasing onto origin/$TARGET_BRANCH" - git fetch --depth=50 origin "$TARGET_BRANCH" - git rebase "origin/$TARGET_BRANCH" + echo "::warning::push rejected (attempt $attempt); rebasing onto origin/$short_branch" + git fetch --depth=50 origin "+refs/heads/$short_branch:refs/remotes/origin/$short_branch" + git rebase "origin/$short_branch" done echo "::error::could not push the chart after 3 attempts" >&2 exit 1 diff --git a/quality-report/v1/select_artifacts.py b/quality-report/v1/select_artifacts.py index 4a13a25..669d0ce 100644 --- a/quality-report/v1/select_artifacts.py +++ b/quality-report/v1/select_artifacts.py @@ -17,6 +17,50 @@ class SelectionError(Exception): pass +def expand_braces(pattern): + """Expand {a,b} alternatives the way minimatch does for download-artifact. + + Nested groups expand recursively. A group with no top-level comma, or an + unbalanced brace, stays literal, which also matches minimatch. + """ + depth = 0 + start = None + for index, char in enumerate(pattern): + if char == "{": + if depth == 0: + start = index + depth += 1 + elif char == "}" and depth: + depth -= 1 + if depth == 0: + body = pattern[start + 1:index] + options, level, last = [], 0, 0 + for position, inner in enumerate(body): + if inner == "{": + level += 1 + elif inner == "}": + level -= 1 + elif inner == "," and level == 0: + options.append(body[last:position]) + last = position + 1 + if not options: + head, tail = pattern[:index + 1], pattern[index + 1:] + return [head + rest for rest in expand_braces(tail)] + options.append(body[last:]) + prefix, suffix = pattern[:start], pattern[index + 1:] + expanded = [] + for option in options: + for item in expand_braces(prefix + option + suffix): + if item not in expanded: + expanded.append(item) + return expanded + return [pattern] + + +def matches(name, pattern): + return any(fnmatch.fnmatchcase(name, item) for item in expand_braces(pattern)) + + def gh_api(path): result = subprocess.run( ["gh", "api", path], capture_output=True, text=True, check=False, timeout=60 @@ -66,7 +110,7 @@ def select_artifacts(repository, run_id, attempt, pattern, fetch=gh_api): selected = [] for artifact in list_artifacts(repository, run_id, fetch): name = artifact.get("name") - if not isinstance(name, str) or not fnmatch.fnmatchcase(name, pattern): + if not isinstance(name, str) or not matches(name, pattern): continue if artifact.get("expired") is True: continue From 3b3e3e8e8c83aacf54d562af46e64595688957b9 Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 12:13:08 -0500 Subject: [PATCH 12/13] fix(quality-report): reject extglob artifact patterns explicitly --- .github/tests/quality_report_contract_test.py | 8 ++++++++ .github/workflows/quality-report-aggregate.yml | 2 +- quality-report/v1/select_artifacts.py | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/tests/quality_report_contract_test.py b/.github/tests/quality_report_contract_test.py index 09fbb45..dcbc7ea 100644 --- a/.github/tests/quality_report_contract_test.py +++ b/.github/tests/quality_report_contract_test.py @@ -176,6 +176,14 @@ def test_selector_expands_brace_alternatives_like_download_artifact(self): self.assertEqual([1, 2], ids) + def test_selector_rejects_extglob_patterns(self): + with self.assertRaises(SELECTOR_MODULE["SelectionError"]) as caught: + self.select( + [self.artifact(1, "2026-08-13T12:01:00Z", name="quality-result-auth")], + pattern="quality-result-@(auth|stats)", + ) + self.assertIn("extglob", str(caught.exception)) + def test_brace_expansion_handles_nesting_and_literals(self): expand = SELECTOR_MODULE["expand_braces"] self.assertEqual(["a-x-1", "a-x-2", "a-y"], expand("a-{x-{1,2},y}")) diff --git a/.github/workflows/quality-report-aggregate.yml b/.github/workflows/quality-report-aggregate.yml index dd6c8e0..c8bd454 100644 --- a/.github/workflows/quality-report-aggregate.yml +++ b/.github/workflows/quality-report-aggregate.yml @@ -20,7 +20,7 @@ on: required: true type: string result_artifact_pattern: - description: Artifact-name pattern containing target-result.json files + description: Artifact-name glob (* ? [] and {a,b} alternatives; extglob is not supported) containing target-result.json files required: false type: string default: quality-result-* diff --git a/quality-report/v1/select_artifacts.py b/quality-report/v1/select_artifacts.py index 669d0ce..de96d6e 100644 --- a/quality-report/v1/select_artifacts.py +++ b/quality-report/v1/select_artifacts.py @@ -13,6 +13,9 @@ TIMESTAMP = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$") +EXTGLOB = re.compile(r"[@+!?*]\(") + + class SelectionError(Exception): pass @@ -100,6 +103,10 @@ def list_artifacts(repository, run_id, fetch): def select_artifacts(repository, run_id, attempt, pattern, fetch=gh_api): + if EXTGLOB.search(pattern): + raise SelectionError( + "unsupported extglob in artifact pattern: {0}".format(pattern) + ) attempt_run = fetch( "/repos/{0}/actions/runs/{1}/attempts/{2}".format(repository, run_id, attempt) ) From 174590acccb471f46aaeda8dd86036a1fffc7eea Mon Sep 17 00:00:00 2001 From: scttbnsn <80784472+scttbnsn@users.noreply.github.com> Date: Thu, 26 Nov 2026 12:13:09 -0500 Subject: [PATCH 13/13] fix(ci): add retry and timeouts to the actionlint download --- .../tests/community_health_contract_test.py | 18 ++++++++++++++++++ .github/workflows/standards-validation.yml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/tests/community_health_contract_test.py b/.github/tests/community_health_contract_test.py index 8596696..77cb67a 100644 --- a/.github/tests/community_health_contract_test.py +++ b/.github/tests/community_health_contract_test.py @@ -202,6 +202,24 @@ def test_zizmor_action_owns_its_supported_cli_version(self): self.assertNotIn("\n version:", zizmor_step) + def test_actionlint_download_retries_and_is_bounded(self): + workflow = self.read_text(".github/workflows/standards-validation.yml") + curl_line = next( + line for line in workflow.splitlines() + if "curl" in line and "actionlint_1.7.12" in line + ) + + for flag in ( + "--proto =https", + "--tlsv1.2", + "--retry 3", + "--retry-all-errors", + "--connect-timeout 10", + "--max-time 120", + ): + self.assertIn(flag, curl_line) + self.assertIn("sha256", workflow) + def test_linter_configs_do_not_suppress_workflow_findings(self): markdown_config = self.read_text(".github/markdownlint-profile.yaml") diff --git a/.github/workflows/standards-validation.yml b/.github/workflows/standards-validation.yml index 29e86ec..8f07336 100644 --- a/.github/workflows/standards-validation.yml +++ b/.github/workflows/standards-validation.yml @@ -70,7 +70,7 @@ jobs: run: | set -euo pipefail archive="$RUNNER_TEMP/actionlint_1.7.12_linux_amd64.tar.gz" - curl -fsSL -o "$archive" https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz + curl -fsSL --proto =https --tlsv1.2 --retry 3 --retry-all-errors --connect-timeout 10 --max-time 120 -o "$archive" https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 $archive" | sha256sum -c - tar -xzf "$archive" -C "$RUNNER_TEMP" actionlint "$RUNNER_TEMP/actionlint" -color