Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

test(ci): scope the cancellation guard to evals.yml

Bruce-Yiid91e46b76637
diff --git a/tests/test_packaging.py b/tests/test_packaging.py
index 7537e940..b184b4fc 100644
--- a/tests/test_packaging.py
+++ b/tests/test_packaging.py
@@ -611,41 +611,38 @@ for _wf in _concurrency_workflows:
"a ref-only group collapses every push to main into one run",
)
-# ------------------------------------------------- cancelling runs that are not pull requests
-# Every workflow above cancels obsolete pull-request runs and nothing else. A workflow that
-# never runs on a pull request has no obsolete run to throw away, so an unconditional
-# `cancel-in-progress: true` can only discard a result someone is waiting for. evals.yml runs
-# weekly, on `release: published` and on `workflow_dispatch`, and all three land in the same
-# `evals-${{ github.ref }}` group, so whichever started second cancelled the first: a manual
-# re-run cancelled the weekly baseline, and the release gate could be cancelled by a dispatch
-# started a minute earlier. That job spends 60 minutes downloading weights and the dataset, and
-# a cancelled run uploads no report, so the cancellation reads as "nothing regressed".
-_WORKFLOW_DIR = os.path.join(".github", "workflows")
-_cancel_values = {}
-for _name in sorted(os.listdir(_WORKFLOW_DIR)):
- if not _name.endswith((".yml", ".yaml")):
- continue
- _match = re.search(
- r"(?m)^[ \t]*cancel-in-progress:\s*(.+?)\s*$",
- _concurrency_block(read(os.path.join(_WORKFLOW_DIR, _name))),
- )
- if _match:
- _cancel_values[_name] = _match.group(1)
-
-# Non-vacuity: a pattern that stops matching would empty this and pass every loop below.
-check_true("concurrency/the cancel-in-progress workflows are all inspected",
- len(_cancel_values) >= 5, sorted(_cancel_values))
-
-for _name, _value in sorted(_cancel_values.items()):
- # Two policies are correct here and anything else is not: never cancel, or cancel only
- # obsolete pull-request runs. `cancel-in-progress: true` is neither.
- _never_cancels = _value.strip().lower() in ("false", "no", "off")
- check_true(
- "concurrency/%s cancels no run it cannot supersede" % _name,
- _never_cancels or "pull_request" in _value,
- "cancel-in-progress: %s discards a validation run that is not an obsolete "
- "pull-request one" % _value,
- )
+# ------------------------------------------------- the eval gate is not cancelled mid-run
+# Scoped to evals.yml on purpose. A general "cancel-in-progress may only be false or name
+# pull_request" rule would also have to be right about every workflow a future change adds, and
+# nothing in the repository establishes it; the workflows that run on pull requests are already
+# covered by the per-commit group checks above.
+#
+# What is true here, and only here: no evals trigger makes an in-flight run obsolete.
+# `github.ref` is the default branch for `schedule` and for a `workflow_dispatch` on it, so the
+# weekly baseline shared a group with a manual re-run, as do two dispatches on one ref, and
+# `cancel-in-progress: true` made whichever started second kill the first. `release: published`
+# never collided: its ref is the tag (`refs/tags/<tag_name>`), so each release had its own group.
+# The job spends 60 minutes downloading weights and the dataset, and a cancelled run uploads no
+# report, so a cancellation reads as a clean gate.
+_EVALS_WORKFLOW = read(os.path.join(".github", "workflows", "evals.yml"))
+# Non-vacuity, independent of the concurrency block: if evals.yml is renamed or its triggers
+# change, this reports instead of the check below passing on a file it did not understand.
+check_true("evals.yml still declares its three triggers",
+ "schedule:" in _EVALS_WORKFLOW
+ and "release:" in _EVALS_WORKFLOW
+ and "workflow_dispatch:" in _EVALS_WORKFLOW)
+
+_EVALS_CANCEL = re.search(
+ r"(?m)^[ \t]*cancel-in-progress:\s*(.+?)\s*$", _concurrency_block(_EVALS_WORKFLOW))
+# An absent key means the Actions default, which is false, so nothing is cancelled. A bare `true`
+# is the only value that discards a run in flight.
+check_true(
+ "evals.yml/cancels no in-flight run",
+ _EVALS_CANCEL is None or _EVALS_CANCEL.group(1).strip().lower() in ("false", "no", "off"),
+ "cancel-in-progress: %s discards a 60-minute run that has already started; a cancelled run "
+ "uploads no report, so it reads as a clean gate"
+ % (_EVALS_CANCEL.group(1) if _EVALS_CANCEL else "true"),
+)
# --------------------------------------------------------------- the API reference
# `laya.__all__` is what `from laya import *` ships and what the README tells people to call, so