:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): make required gates fail closed on a broken change detector (#96671)
Julian Bez3527ee08da1a
diff --git a/.agents/skills/authoring-ci-workflows/SKILL.md b/.agents/skills/authoring-ci-workflows/SKILL.mdindex 7658640ed4dd..9dddea6a2577 100644--- a/.agents/skills/authoring-ci-workflows/SKILL.md+++ b/.agents/skills/authoring-ci-workflows/SKILL.md@@ -158,9 +158,11 @@ Four rules for the gate body:1. **Allowlist every dependency, never denylist.** Assert `success`/`skipped` and fail everything else.A dependency tested only against `== 'failure'` lets `cancelled` through, and one bad dependency is enough — a gate that clears four correctly and one with a bare `failure` test is still wrong.The trap is the `changes` detector: clearing it with `== 'failure'` and then reading `needs.changes.outputs.*` reports green on cancellation, because those outputs are empty and the gate takes its "nothing to test" exit.-2. **`needs` every job that produces coverage.**+2. **`needs` every job that produces coverage, and every upstream that can skip one.**If a job's failure would only cascade into a downstream job being _skipped_, the gate reads that as a pass and you get a green check with zero tests run.- Name the upstream job explicitly.+ The usual shape is a `changes` detector one step above the suite: it fails, the suite skips, and the gate reports success having run nothing ([measured on ci-nodejs](https://github.com/PostHog/posthog/actions/runs/32472790735)).+ Name every job whose failure would skip one you do test, not only the direct ones.+ Stop there. A test selector whose failure leaves the suite running in full is not gate-critical, and demanding it turns a recovered run into a red required check.3. **Legitimate skips must still pass.** A frontend-only PR skips backend jobs by design.4. **Every dependency's result must reach a fail-closed allowlist guard.**One inline `if` per dependency is the clearest form, but a shared shell helper or an `env:` block is equally fine: `WF007` traces each result through assignments, `${!var}` indirection, and helper argument positions within that step.@@ -168,8 +170,12 @@ Four rules for the gate body:Comparisons in another step, comments, logs, or branches that do not exit nonzero prove nothing and are rejected.A result whose guard `WF007` cannot follow is reported rather than assumed safe, so an unusual routing may need the checks moved inline.-`WF007` enforces 1, 4, and the `!cancelled()` condition, and it takes the dependency list from `needs:` as well as the step body, so a job you wired into `needs:` and then forgot to test is reported rather than silently trusted.-The half of rule 2 it cannot check is whether you named the right jobs in `needs:` to begin with: "reporting job" and "coverage job" look identical to a linter, so that one is on you and the reviewer.+`WF007` enforces 1, 2, 4, and the `!cancelled()` condition, and it takes the dependency list from `needs:` as well as the step body, so a job you wired into `needs:` and then forgot to test is reported rather than silently trusted.+For rule 2 it walks the `needs:` graph above each dependency and reports any job the gate does not test, which is the half a linter can see.+It follows an edge only when the upstream's failure would actually skip the job below it.+A job whose `if` calls no status function is skipped by any failed upstream, and so is one held behind `success()` or `cancelled()`, since neither is true in that state.+A job that reaches `always()`, `!cancelled()` or `failure()` keeps running, and is skipped only where its own condition compares against the failed job and goes false: an output reads back empty, while `result` reads back `failure`, so a recovery path testing `result == 'failure'` still runs.+The half it cannot see is a coverage job with no `needs:` edge into the gate at all: "reporting job" and "coverage job" look identical from outside the graph, so that one is on you and the reviewer.### What GitHub does with each conclusiondiff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex 389277d321e8..185da4342fa5 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -2649,6 +2649,7 @@ jobs:turbo-discover,build-product-test-matrix,turbo-tests,+ detect-snapshot-mode,repo-checks,]name: '[optional, does not block merge] Django Tests Pass'@@ -2703,6 +2704,7 @@ jobs:check_required_result "Turbo discover" "${{ needs.turbo-discover.result }}"check_required_result "Product test matrix build" "${{ needs.build-product-test-matrix.result }}"check_required_result "Product/Turbo tests" "${{ needs.turbo-tests.result }}"+ check_required_result "Snapshot mode detection" "${{ needs.detect-snapshot-mode.result }}"echo "All backend and product checks passed."# Depot shadow: calculate-running-time is omitted so shadow runs are not recorded as canonical CI data.diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 824adac64138..fcce59dd90ab 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -3849,6 +3849,7 @@ jobs:turbo-discover,build-product-test-matrix,turbo-tests,+ detect-snapshot-mode,handle-snapshots,repo-checks,]@@ -4015,6 +4016,7 @@ jobs:check_required_result "Turbo discover" "${{ needs.turbo-discover.result }}"check_required_result "Product test matrix build" "${{ needs.build-product-test-matrix.result }}"check_required_result "Product/Turbo tests" "${{ needs.turbo-tests.result }}"+ check_required_result "Snapshot mode detection" "${{ needs.detect-snapshot-mode.result }}"check_required_result "Snapshot commit job" "${{ needs.handle-snapshots.result }}"echo "All backend and product checks passed."diff --git a/.github/workflows/ci-dagster.yml b/.github/workflows/ci-dagster.ymlindex 00cd7faf07c5..09e0cc352e2c 100644--- a/.github/workflows/ci-dagster.yml+++ b/.github/workflows/ci-dagster.yml@@ -730,7 +730,7 @@ jobs:# Job just to collate the status of the matrix jobs for requiring passing statusdagster_tests:- needs: [dagster]+ needs: [changes, dagster]name: Dagster Tests Passruns-on: ubuntu-latesttimeout-minutes: 5@@ -738,6 +738,14 @@ jobs:steps:- name: Check matrix outcomerun: |+ # Change detection gates the matrix. A failure there skips it, and this gate+ # reads a skip as a pass, so test its result directly. select-tests is not tested+ # here: an empty mode makes the matrix run in full, so a failed selector costs+ # runner time but never coverage.+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."+ exit 1+ fi# The `needs.dagster.result` will be 'success' only if all jobs in the matrix succeeded.# Otherwise, it will be 'failure'.if [[ "${{ needs.dagster.result }}" != "success" && "${{ needs.dagster.result }}" != "skipped" ]]; thendiff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex 7a3e73c8396c..b2f35af19386 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -1333,7 +1333,7 @@ jobs:# Collate test + VR completion status for the required checkplaywright_tests:- needs: [playwright, vr-complete]+ needs: [changes, playwright, vr-complete]name: Playwright tests passruns-on: ubuntu-latesttimeout-minutes: 5@@ -1341,6 +1341,14 @@ jobs:steps:- name: Check outcomerun: |+ # Change detection gates the playwright job. A failure there skips it, and this+ # gate reads a skip as a pass, so test its result directly. select-specs is not+ # tested here: the playwright job runs past a failed selector and takes the full+ # suite, so its failure costs runner time but never coverage.+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."+ exit 1+ fiif [[ "${{ needs.playwright.result }}" != "success" && "${{ needs.playwright.result }}" != "skipped" ]]; thenecho "Playwright tests failed."exit 1diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex c6887f48a619..8fc151fe3ca5 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -1198,7 +1198,7 @@ jobs:}frontend_tests:- needs: [jest, jest-replay-shared, frontend-format, frontend-bundle-size, frontend-typescript-checks]+ needs: [changes, jest, jest-replay-shared, frontend-format, frontend-bundle-size, frontend-typescript-checks]name: Frontend Tests Passruns-on: ubuntu-latesttimeout-minutes: 5@@ -1207,6 +1207,14 @@ jobs:- run: exit 0- name: Check outcomesrun: |+ # Change detection gates every job below. A failure there skips them all, and+ # this gate reads a skip as a pass, so test its result directly. select-jest-tests+ # is not tested here: an empty selection makes jest take the full matrix, so a+ # failed selector costs runner time but never coverage.+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."+ exit 1+ fiif [[ "${{ needs.jest.result }}" != "success" && "${{ needs.jest.result }}" != "skipped" ]]; thenecho "Frontend jest tests failed."exit 1diff --git a/.github/workflows/ci-nodejs.yml b/.github/workflows/ci-nodejs.ymlindex 3c36df209ff8..225a72297337 100644--- a/.github/workflows/ci-nodejs.yml+++ b/.github/workflows/ci-nodejs.yml@@ -1035,7 +1035,7 @@ jobs:node_tests:# report-test-speed is deliberately not in needs: it is visible but non-gating.- needs: [tests, rust_ingestion_e2e, build, lint]+ needs: [changes, tests, rust_ingestion_e2e, build, lint]name: Node.js Tests Passruns-on: ubuntu-latesttimeout-minutes: 5@@ -1044,6 +1044,12 @@ jobs:- run: exit 0- name: Check outcomesrun: |+ # Change detection gates every job below. A failure there skips them all, and+ # this gate reads a skip as a pass, so test its result directly.+ if [[ "${{ needs.changes.result }}" != "success" && "${{ needs.changes.result }}" != "skipped" ]]; then+ echo "Change detection did not succeed (result: ${{ needs.changes.result }})."+ exit 1+ fiif [[ "${{ needs.tests.result }}" != "success" && "${{ needs.tests.result }}" != "skipped" ]]; thenecho "One or more jobs in the Node.js test matrix failed."exit 1diff --git a/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py b/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.pyindex e7394e53e69f..016995cc2b1b 100644--- a/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py+++ b/tools/hogli-commands/hogli_commands/tests/test_workflow_lint.py@@ -1422,6 +1422,52 @@ def _nested_allow_marker_gate() -> str:)+_CHAIN_GUARD = """+ if [[ "${{ needs.DEP.result }}" != "success" && "${{ needs.DEP.result }}" != "skipped" ]]; then+ exit 1+ fi+"""+++def _chained_gate(*dependencies: str, build_if: str | None = None) -> str:+ """A gate over `build`, which itself needs `detect`.++ GitHub skips `build` when `detect` fails, and the gate reads that skip as a+ pass, so `detect` has to be a dependency of the gate too. `build_if` sets the+ condition on `build`, which is what decides whether the skip travels: a job that+ runs past a failed `detect` recovers, and the gate must not demand it.+ """+ body = "".join(_CHAIN_GUARD.replace("DEP", dep) for dep in dependencies)+ build_condition = f" if: {build_if}\n" if build_if else ""+ return (+ """+ name: ci-thing+ on: pull_request+ jobs:+ detect:+ timeout-minutes: 5+ steps:+ - run: echo detect+ build:+ needs: [detect]+"""+ + build_condition+ + """ timeout-minutes: 5+ steps:+ - run: echo build+ thing_tests:+ name: Thing Tests Pass+ needs: [DEPENDENCIES]+ timeout-minutes: 5+ if: ${{ !cancelled() }}+ steps:+ - run: |+""".replace("DEPENDENCIES", ", ".join(dependencies))+ + textwrap.indent(textwrap.dedent(body).strip(), " " * 14)+ + "\n"+ )++class TestRequiredGateCheck:@pytest.mark.parametrize("content",@@ -1526,6 +1572,39 @@ class TestRequiredGateCheck:assert [i.message.split("'")[1] for i in issues] == ["lint"]assert "never reaches" in issues[0].message+ # Each row is a shape our workflows really use: a worker with no condition, a gate+ # that names the whole chain, a suite that runs past a failed selector, a job held+ # behind success(), a recovery job that reads the failure, and a consumer that+ # demands a detector's output.+ @pytest.mark.parametrize(+ "dependencies,build_if,expected_missing",+ [+ (("build",), None, ["detect"]),+ (("detect", "build"), None, []),+ (("build",), "${{ !cancelled() }}", []),+ (("build",), "${{ success() }}", ["detect"]),+ (("build",), "${{ failure() && needs.detect.result == 'failure' }}", []),+ (("build",), "${{ !cancelled() && success() }}", ["detect"]),+ (("build",), "${{ !cancelled() && needs.detect.outputs.mode == 'go' }}", ["detect"]),+ ],+ ids=[+ "upstream-of-a-dependency-unnamed",+ "whole-chain-named",+ "dependency-recovers-from-upstream",+ "dependency-held-behind-success",+ "dependency-recovers-on-the-failure-itself",+ "dependency-mixes-a-surviving-and-a-skipping-status-call",+ "dependency-demands-an-upstream-output",+ ],+ )+ def test_flags_upstream_of_a_dependency_that_the_gate_never_tests(+ self, tmp_path: Path, dependencies: tuple[str, ...], build_if: str | None, expected_missing: list[str]+ ) -> None:+ _write(tmp_path, "ci-thing.yml", _chained_gate(*dependencies, build_if=build_if))+ issues = RequiredGateCheck().run(_read_all(tmp_path)).issues+ assert [i.message.split("'")[1] for i in issues] == expected_missing+ assert all("is not a dependency of this gate" in i.message for i in issues)+def test_ignores_non_gate_jobs(self, tmp_path: Path) -> None:# Worker jobs share the !cancelled() condition, but they gate nothing,# so WF007 has no dependency-guard demands on them.diff --git a/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py b/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.pyindex df715ac71742..0f6a4f780768 100644--- a/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py+++ b/tools/hogli-commands/hogli_commands/workflow_lint/checks/required_gates.py@@ -1,7 +1,7 @@"""Collate gates must run on every completed run and fail closed on every dependency.A "collate gate" is the job that emits a required status check by inspecting its-dependencies' ``needs.*.result``. Two properties keep it honest:+dependencies' ``needs.*.result``. Three properties keep it honest:1. ``if: !cancelled()`` — the gate must emit an explicit verdict on every run thatis not superseded. On a cancelled run a ``!cancelled()`` job records conclusion@@ -23,6 +23,17 @@ dependencies' ``needs.*.result``. Two properties keep it honest:then reads ``needs.changes.outputs.*``, which is empty on a cancelled job, andtakes its "nothing to test" exit — green, with zero tests run.+3. ``needs`` closed over the upstreams that can skip a dependency — the gate must name+ every job whose failure would skip a job it does test, not only the ones it needs+ directly. GitHub skips a job when a job in its ``needs:`` fails, and the gate reads a+ skip as a pass, so a change detector one step further up produces a green check with+ zero tests behind it. Measured on ci-nodejs in run 32472790735: change detection+ failed, every Node.js job skipped, and "Node.js Tests Pass" reported success.++ Only edges that carry the skip count. A test selector whose failure leaves the suite+ running in full is not gate-critical, and demanding it would turn a recovered run+ into a red required check.+Gates are found two ways, because the "name it ``… Pass``" convention is notuniversally followed: by that name, and structurally when a step reads``needs.<dep>.result`` in its shell or environment. Detection is independent of@@ -55,6 +66,25 @@ GATE_NAME = re.compile(r"\bpass$", re.IGNORECASE)ALWAYS = re.compile(r"always\s*\(\s*\)")NOT_CANCELLED = re.compile(r"!\s*cancelled\s*\(\s*\)")READS_RESULT = re.compile(r"needs\.(?P<dep>[A-Za-z0-9_\-]+)\.result")+STATUS_CALL = re.compile(r"(?P<negated>!\s*)?\b(?P<name>always|cancelled|failure|success)\s*\(\s*\)")++# Status calls that are true in the state this module reasons about: an upstream job+# failed and the run itself was not cancelled. `success()` and `cancelled()` are false+# there, so a job conditioned on either is skipped exactly like a job with no status+# call at all.+TRUE_AFTER_UPSTREAM_FAILURE = frozenset({("always", False), ("cancelled", True), ("failure", False), ("success", True)})++# What a failed job's own references read as. Outputs are empty because the job never+# set them; `result` carries the failure itself, which is why the two cannot share a rule.+FAILED_RESULT = "failure"+FAILED_OUTPUT = ""++COMPARISON = re.compile(+ r"""(?P<left>needs\.(?P<ldep>[A-Za-z0-9_\-]+)\.(?P<lkind>outputs\.[A-Za-z0-9_\-]+|result)|'[^']*'|"[^"]*")"""+ r"""\s*(?P<op>==|!=)\s*"""+ r"""(?P<right>needs\.(?P<rdep>[A-Za-z0-9_\-]+)\.(?P<rkind>outputs\.[A-Za-z0-9_\-]+|result)|'[^']*'|"[^"]*")"""+)+# `foo() {` / `function foo() {`, whose body ends at the first `}` sitting at or# left of the definition's own indentation. Brace counting would be the general@@ -363,6 +393,13 @@ def _reachable(start: str, edges: dict[str, set[str]]) -> Iterable[str]:queue.append(nxt)+def _declared_needs(job: Job) -> set[str]:+ """The job ids in ``needs:``, whether written as one string or a list."""+ declared = job.raw.get("needs") or []+ declared = [declared] if isinstance(declared, str) else declared+ return {dep for dep in declared if isinstance(dep, str)}++def _dependencies(job: Job) -> set[str]:"""Every dependency the gate is answerable for.@@ -371,14 +408,105 @@ def _dependencies(job: Job) -> set[str]:reading only the body would judge the assertions that were written and staysilent about the one that was forgotten."""- declared = job.raw.get("needs") or []- declared = [declared] if isinstance(declared, str) else declared- named = {dep for dep in declared if isinstance(dep, str)}referenced = {dep for source in _result_sources(job) for dep in READS_RESULT.findall(source)}- return named | referenced+ return _declared_needs(job) | referenced+++def _runs_past_an_upstream_failure(condition: str) -> bool:+ """Does this ``if`` still dispatch its job after a job it needs failed?++ GitHub runs a job only when every job in its ``needs:`` succeeded, unless the+ job's own ``if`` calls a status function. Calling one is not enough on its own:+ the call also has to be true in that state, which `success()` and `cancelled()`+ are not.++ A condition that carries both kinds is read as skipping, without solving the+ boolean expression: `!cancelled() && success()` is false in that state, and the+ conjunction is the only composition of the two anyone writes. Reading it the+ other way would drop a skip-propagating edge and let the gate go green with the+ worker skipped.+ """+ calls = {(call.group("name"), call.group("negated") is not None) for call in STATUS_CALL.finditer(condition)}+ return bool(calls & TRUE_AFTER_UPSTREAM_FAILURE) and not (calls - TRUE_AFTER_UPSTREAM_FAILURE)+++def _falsified_by(condition: str, upstream: str) -> bool:+ """Does any comparison in this ``if`` turn false once ``upstream`` fails?++ Each comparison against the failed job is evaluated with the value it really+ reads back: an empty string for an output, and `failure` for `result`. So+ `outputs.x == 'true'` and `result == 'success'` both go false and skip the job,+ while `outputs.mode != 'none'` and a recovery path's `result == 'failure'` stay+ true and let it run.++ A false term is read as a skip without solving the whole boolean expression. That+ over-reports a condition where a disjunct unrelated to the upstream can still+ carry the job, which fails the gate closed rather than open.+ The empty-output model assumes a failed job published nothing. A job that sets an+ output from a `failure()`-guarded step breaks that assumption, and a consumer+ testing the value it did publish would skip without this seeing it. Reading those+ outputs as unknown instead would make every inequality against a selector look+ false, which is what makes a recovered selector gate-critical, so the assumption+ stays and the narrower miss is the accepted cost.+ """+ for comparison in COMPARISON.finditer(condition):+ for side, other in (("l", "right"), ("r", "left")):+ if comparison.group(f"{side}dep") != upstream:+ continue+ literal = comparison.group(other)+ if literal.startswith("needs."):+ continue+ actual = FAILED_RESULT if comparison.group(f"{side}kind") == "result" else FAILED_OUTPUT+ equal = literal[1:-1] == actual+ if equal is (comparison.group("op") == "!="):+ return True+ return False+++def _skips_when_upstream_fails(job: Job, upstream: str) -> bool:+ """Would ``job`` be skipped if ``upstream`` failed?++ This is what separates a detector from a selector. `ci-e2e-playwright` reads+ `needs.changes.outputs.shouldRun == 'true'`, so a failed `changes` skips the+ suite. It never reads `select-specs`, and an empty selection makes the suite run+ in full, so a failed selector costs runner time and no coverage.+ """+ condition = job.raw.get("if")+ if not isinstance(condition, str):+ return True+ if not _runs_past_an_upstream_failure(condition):+ return True+ return _falsified_by(condition, upstream)-def _problems(job: Job) -> Iterator[str]:++def _upstream_gaps(job: Job, jobs: dict[str, Job]) -> Iterator[str]:+ """Jobs that a gate dependency needs, whose failure the gate would read as a pass.++ GitHub skips a job when a job in its ``needs:`` fails, and the gate reads a+ skip as a pass. A failure one step further up the graph therefore arrives at+ the gate as a green verdict with no tests behind it. The gate has to name every+ job that can skip one of its dependencies this way.++ Only edges that propagate a skip count. An upstream a dependency recovers from+ stays out, because failing the gate on it turns a recovered run into a red+ required check.+ """+ dependencies = _dependencies(job) & jobs.keys()+ skip_graph = {+ name: {up for up in _declared_needs(other) & jobs.keys() if _skips_when_upstream_fails(other, up)}+ for name, other in jobs.items()+ }+ reached = {upstream for dep in dependencies for upstream in _reachable(dep, skip_graph)}+ for missing in sorted(reached - dependencies):+ yield (+ f"upstream '{missing}' is not a dependency of this gate. A failure there skips a job the "+ f"gate does test, and the gate reads that skip as a pass. Add '{missing}' to `needs:` "+ "and test its result"+ )+++def _problems(job: Job, jobs: dict[str, Job]) -> Iterator[str]:if not _gate_condition_ok(job.raw.get("if")):yield ("required-check gate must use `if: ${{ !cancelled() }}` so it emits a verdict on every "@@ -396,6 +524,8 @@ def _problems(job: Job) -> Iterator[str]:f'cancelled \'{dep}\'. Test `!= "success" && != "skipped"`, then exit nonzero')+ yield from _upstream_gaps(job, jobs)+class RequiredGateCheck(WorkflowCheck):id = "WF007-required-check-gates"@@ -409,7 +539,8 @@ class RequiredGateCheck(WorkflowCheck):"`&&`-ing it, and test every dependency as "'`!= "success" && != "skipped"` rather than `== "failure"`. Inline tests, an `env:` '"block and a shared shell helper all work, so long as the failing branch exits nonzero. "- "A job that reads results without gating anything opts out with "+ "`needs:` every job your dependencies need, so an upstream failure meets a guard "+ "instead of a skip. A job that reads results without gating anything opts out with "f"`# {ALLOW_MARKER} — <reason>`. See .agents/skills/authoring-ci-workflows/SKILL.md.")@@ -421,9 +552,10 @@ class RequiredGateCheck(WorkflowCheck):continue# Only worth re-reading the file once we know there's a gate to exempt.exempt = _exempt_jobs(wf.path, frozenset(job.name for job in wf.jobs))+ jobs = {job.name: job for job in wf.jobs}for job in gates:if job.name in exempt:continue- for message in _problems(job):+ for message in _problems(job, jobs):result.issues.append(Issue(workflow=wf.path.name, job=job.name, message=message, file=str(wf.path)))return result