ci-required-drift: also skip jobs gated on github.ref (fixes mc#958/mc#959)
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
publish-runtime-autobump / bump-and-tag (pull_request) Has been skipped
CI / Detect changes (pull_request) Successful in 19s
E2E API Smoke Test / detect-changes (pull_request) Successful in 19s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 19s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 19s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 20s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 11s
gate-check-v3 / gate-check (pull_request) Successful in 15s
qa-review / approved (pull_request) Failing after 11s
publish-runtime-autobump / pr-validate (pull_request) Successful in 36s
Harness Replays / detect-changes (pull_request) Successful in 38s
security-review / approved (pull_request) Failing after 12s
sop-tier-check / tier-check (pull_request) Successful in 11s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 4s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m9s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Failing after 1m12s
CI / Platform (Go) (pull_request) Failing after 3m50s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3m46s
Harness Replays / Harness Replays (pull_request) Failing after 1m46s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 3m8s
sop-checklist / na-declarations (pull_request) awaiting /sop-n/a declaration for: qa-review, security-review
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, l
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 3m25s
CI / Python Lint & Test (pull_request) Failing after 7m5s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9m18s
CI / Canvas (Next.js) (pull_request) Failing after 10m48s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / all-required (pull_request) Failing after 4s

canvas-deploy-reminder has:
  if: needs.changes.outputs.canvas == 'true'
      && github.event_name == 'push'
      && github.ref == 'refs/heads/main'

ci_job_names() only skipped jobs with `github.event_name` in their `if:`.
The `github.ref` branch was invisible to the detector, so
canvas-deploy-reminder was flagged as missing from all-required.needs —
a false positive that fires on every PR touching canvas/ code.

Now the skip check also fires when `github.ref` is present in the `if:`
condition string, matching the same rationale as the event_name skip:
these jobs never execute in a PR context, so requiring them under
all-required.needs: is not meaningful.

Refs: mc#958 (main), mc#959 (staging)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · core-devops 2026-05-14 09:04:28 +00:00
parent 5531b471d1
commit 8becae14f9

View File

@ -203,12 +203,17 @@ def ci_jobs_all(ci_doc: dict) -> set[str]:
def ci_job_names(ci_doc: dict) -> set[str]:
"""Set of job keys in ci.yml MINUS the sentinel itself MINUS jobs
whose `if:` gates on `github.event_name` (those are event-scoped
and can legitimately be `skipped` for a given trigger; if we
required them under the sentinel `needs:`, every PR-only job
whose `if:` gates on `github.event_name` or `github.ref` (those are
event-scoped and can legitimately be `skipped` for a given trigger;
if we required them under the sentinel `needs:`, every PR-only job
would be `skipped` on push and the sentinel would interpret
`skipped != success` as failure). RFC §4 spec.
`github.ref` is the companion gate for jobs that run only on direct
pushes to specific branches (e.g. `github.ref == 'refs/heads/main'`).
These never execute in a PR context, so flagging them as missing
from `all-required.needs:` is a false positive (mc#958 / mc#959).
Used for F1 (jobs missing from sentinel needs). NOT used for F1b
(typos in needs) see `ci_jobs_all` for that."""
jobs = ci_doc.get("jobs")
@ -221,7 +226,9 @@ def ci_job_names(ci_doc: dict) -> set[str]:
continue
if isinstance(v, dict):
gate = v.get("if")
if isinstance(gate, str) and "github.event_name" in gate:
if isinstance(gate, str) and (
"github.event_name" in gate or "github.ref" in gate
):
continue
names.add(k)
return names