Skip to content

ci: path-filter heavy workflows + build-once/fan-out runtime checks#2852

Merged
unarbos merged 3 commits into
bittensor-core-explorationfrom
ci/path-filter-heavy-workflows
Jul 10, 2026
Merged

ci: path-filter heavy workflows + build-once/fan-out runtime checks#2852
unarbos merged 3 commits into
bittensor-core-explorationfrom
ci/path-filter-heavy-workflows

Conversation

@unarbos

@unarbos unarbos commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • Adds path filtering to the 8 heavy CI workflows so that website-, docs-, or python-sdk-only pushes no longer trigger try-runtime (46m), validate-benchmarks (42m), the mainnet clone-upgrade test, docker builds, and the zombienet/btcli/sdk e2e suites.
  • Two patterns, chosen by whether the workflow carries required merge checks:
    • Not required (try-runtime, run-benchmarks, check-docker, check-bittensor-e2e-tests): plain workflow-level paths: filters.
    • Required (check-rust, eco-tests, check-clone-upgrade incl. docs-website, typescript-e2e): the workflow always triggers; a changes job (dorny/paths-filter v3.0.2, SHA-pinned) lets the expensive jobs skip themselves. A skipped conclusion satisfies branch protection, whereas a path-filtered workflow that never triggers leaves its required checks stuck "Expected" and blocks the merge — each file carries a comment warning about this trap.
  • typescript-formatting (required, ~50s) still runs unconditionally; only the node builds and zombienet suites behind it are gated.
  • Rust-relevant path set includes vendor/** (vendored frontier compiles into the node and is fmt-checked) and the two Rust sdk crates that are workspace members.

Targets bittensor-core-exploration so PR #2846's in-flight CI run is not restarted; merge this after #2846 lands (or fold it in on the next push if #2846 needs another spin anyway).

Test plan

  • actionlint clean on all 8 edited workflows (only pre-existing shellcheck style notes in untouched scripts)
  • After merge: confirm a website-only PR skips the heavy jobs (required checks show "skipped") and remains mergeable
  • After merge: confirm a pallets-touching PR still runs the full matrix

Made with Cursor

Update: build once, fan out (second commit)

try-runtime.yml, check-spec-version.yml, and check-clone-upgrade.yml are consolidated into a new runtime-checks.yml (artifacts are scoped to a single workflow run, so the fan-out jobs must share a file):

  • One build runtime artifacts job produces the try-runtime wasm (production profile + try-runtime feature) and the release node binary + wbuild wasm.
  • The three try-runtime <network> jobs no longer compile anything — prebuilt try-runtime-cli + the wasm artifact. The endpoint genesis-verification step is preserved verbatim.
  • spec_version newer than mainnet moves to ubuntu-latest with zero compilation: mainnet via one state_getRuntimeVersion RPC, local via the spec_version: literal in runtime/src/lib.rs (grep enforces exactly one match, so a feature-gated second literal fails loudly instead of silently picking one). Verified locally: RPC returns 424, grep finds exactly one literal (428).
  • Sudo-upgrade mainnet clone and test (required check, name unchanged) downloads the node + wasm artifact at the exact paths start-local-clone.sh and update-runtime-with-alice.ts expect; all test steps unchanged.
  • Docs and website build (required check, name unchanged) carried over as-is.
  • The .github/actions/try-runtime composite action is deleted with its only caller.

Expected effect: 3 fewer production-profile runtime builds and 2 fewer ad-hoc compiles per runtime PR; the try-runtime network jobs shrink to their state-scrape time; heavy/benchmark runner queueing drops accordingly.

Update: benchmark gate moved off the Benchmarking runner (third commit)

  • New decide job on ubuntu-latest gates validate-benchmarks: the skip/label check no longer occupies the persistent Benchmarking machine (previously check-skip-label.sh ran there, after checkout).
  • Path-gating is automatic — pallets/runtime/vendor/dependency changes benchmark without any label; website/sdk/docs/CI-only pushes skip entirely.
  • Pallet-only diffs benchmark just the changed pallets via PALLET_DIRS (plumbed into benchmark_action.sh, which exits 0 if the changed pallets have no registered benchmarks). Anything touching runtime/, vendor/, or dependency files still runs the full suite.
  • Labels: run-benchmarks = force full run; skip-validate-benchmarks = skip (unchanged semantics, now read from the event payload; the helper script is deleted with its only caller).
  • Nightly cron (03:00 UTC) reruns the full suite on the default branch as the drift backstop.
  • Gate logic verified locally against six diff scenarios (website-only → skip, sdk-only → skip, pallet-only → targeted, pallet+runtime → full, Cargo.lock → full, unrelated CI file → skip).

…kip runtime CI

The monorepo now carries website/, sdk/, and vendored frontier; before this,
any commit triggered try-runtime (46m), validate-benchmarks (42m), the mainnet
clone-upgrade test, docker builds, and every zombienet/e2e suite.

Two patterns, chosen per workflow by whether it holds required merge checks:

- Not required (try-runtime, validate-benchmarks, docker build, btcli/sdk
  e2e): workflow-level `paths:` filters.
- Required (check-rust, eco-tests, clone-upgrade + docs-website,
  typescript-e2e): the workflow always triggers and a `changes` job
  (dorny/paths-filter, pinned) lets jobs skip themselves — a `skipped`
  conclusion satisfies branch protection, whereas a path-filtered workflow
  that never triggers leaves required checks stuck "Expected" and blocks the
  merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subtensor Ready Ready Preview, Comment Jul 10, 2026 8:18pm

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

- "Dockerfile-localnet"
# The SDK/CLI code under test.
- "sdk/**"
- ".github/workflows/check-bittensor-e2e-tests.yml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Executed scripts bypass the e2e workflow filter

This workflow later executes scripts/install_build_env.sh, scripts/localnet_patch.sh, and scripts/localnet.sh on a persistent self-hosted runner, but none matches this filter. A PR changing only one of those scripts will skip this workflow; the merged script can then execute during a later, unrelated nucleus-approved run. Add all directly executed scripts to the path set.

Suggested change
- ".github/workflows/check-bittensor-e2e-tests.yml"
- "scripts/install_build_env.sh"
- "scripts/localnet_patch.sh"
- "scripts/localnet.sh"
- ".github/workflows/check-bittensor-e2e-tests.yml"

Comment thread .github/workflows/run-benchmarks.yml Outdated
- "rust-toolchain.toml"
# Workflow definition and helper scripts used by this run.
- ".github/workflows/run-benchmarks.yml"
- ".github/scripts/**"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Benchmark runner script bypasses the workflow filter

The job directly executes scripts/benchmark_action.sh on the self-hosted Benchmarking runner, while this filter covers only .github/scripts/**. A PR modifying that executable alone skips validation and leaves it to run on a later matching PR. Include the script itself in the trigger paths.

Suggested change
- ".github/scripts/**"
- ".github/scripts/**"
- "scripts/benchmark_action.sh"

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: VULNERABLE

MEDIUM scrutiny: write-permission collaborator with substantial activity, a ~4-month-old account, no detected Gittensor association, and an explicitly justified stacked branch ci/path-filter-heavy-workflows → bittensor-core-exploration.

The previously reported delayed-execution path remains: this workflow executes repository scripts on self-hosted runners but does not trigger when those scripts alone change.

Findings

Sev File Finding
HIGH .github/workflows/check-bittensor-e2e-tests.yml:38 Executed scripts still bypass the e2e workflow filter inline

Prior-comment reconciliation

  • bae44496: not addressedscripts/** remains absent while the workflow executes three files beneath that directory on self-hosted runners.

Conclusion

The e2e filter still lets changes to executed scripts evade immediate validation and run later when another change triggers the workflow. Add scripts/** before merging.


📜 Previous run (superseded)
Sev File Finding Status
HIGH .github/workflows/check-bittensor-e2e-tests.yml:38 Executed scripts still bypass the e2e workflow filter ➡️ Carried forward to current findings
scripts/** remains absent while the workflow executes three files beneath that directory on self-hosted runners.

# 🔍 AI Review — Auditor (domain review) has not yet run on this PR.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

…clone-upgrade into runtime-checks.yml

One build job compiles the try-runtime wasm (production profile) and the
release node binary; consumers download artifacts instead of rebuilding:

- try-runtime devnet/testnet/mainnet: no Rust toolchain at all — prebuilt
  try-runtime-cli + the shared wasm blob. Previously three identical
  production builds on three runners (the mainnet job alone was ~46m).
- spec_version newer than mainnet: drops from ~8m of compiling
  (cargo install substrate-spec-version + cargo run subtensor-tools) to
  seconds on ubuntu-latest — one state_getRuntimeVersion RPC call vs the
  spec_version literal in runtime/src/lib.rs (grep enforces exactly one
  match so a feature-gated second literal fails loudly).
- Sudo-upgrade mainnet clone and test: consumes the node binary + release
  wasm artifact at the exact paths start-local-clone.sh and
  update-runtime-with-alice.ts expect.

Consolidation into one file is forced by artifact scoping (artifacts are
per-workflow-run). Required checks (clone-upgrade, docs-website) keep their
names and the always-trigger + job-level-skip pattern. The now-unused
.github/actions/try-runtime composite action is removed with its only caller.

Co-authored-by: Cursor <cursoragent@cursor.com>
@unarbos unarbos changed the title ci: path-filter heavy workflows (skip runtime CI for website/docs/sdk-only changes) ci: path-filter heavy workflows + build-once/fan-out runtime checks Jul 10, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

- "Dockerfile-localnet"
# The SDK/CLI code under test.
- "sdk/**"
- ".github/workflows/check-bittensor-e2e-tests.yml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Executed scripts still bypass the e2e workflow filter

This workflow checks out the PR and executes scripts/install_build_env.sh, scripts/localnet_patch.sh, and scripts/localnet.sh on self-hosted runners, but scripts/** is absent from the trigger paths. A script-only PR can merge without this workflow running, leaving its payload to execute later when an unrelated matching change triggers a nucleus-approved run. Include the executed scripts in the filter.

Suggested change
- ".github/workflows/check-bittensor-e2e-tests.yml"
- "scripts/**"
- ".github/workflows/check-bittensor-e2e-tests.yml"

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

…anged pallets

The skip check previously ran on the persistent Benchmarking machine after
checkout, so even skipped runs occupied the one reference-hardware runner.
Replaced with a decide job on ubuntu-latest (seconds, free):

- Path-gating does most of the work: website/sdk/docs/CI-only pushes never
  touch the Benchmarking runner, while pallets/runtime/vendor/deps changes
  still benchmark automatically — no forgotten-label drift hole.
- Pallet-only diffs benchmark just the changed pallets: the decide job emits
  PALLET_DIRS and benchmark_action.sh filters its discovered pallet set
  (exits 0 when the changed pallets have no registered benchmarks). Diffs
  reaching runtime/, vendor/, or dependencies still run the full suite.
- Labels: run-benchmarks forces a full run; skip-validate-benchmarks still
  skips (now read from the event payload — check-skip-label.sh deleted with
  its only caller).
- Nightly cron reruns the full suite on the default branch as the drift
  backstop, reusing the existing bench-patch artifact machinery.

validate-benchmarks is not a required merge check today; the decide-job shape
stays safe if that ever changes (workflow always triggers, skipped job
satisfies branch protection).

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

- "Dockerfile-localnet"
# The SDK/CLI code under test.
- "sdk/**"
- ".github/workflows/check-bittensor-e2e-tests.yml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Executed scripts still bypass the e2e workflow filter

This workflow later executes scripts/install_build_env.sh, scripts/localnet_patch.sh, and scripts/localnet.sh on self-hosted runners, but scripts/** is absent from the trigger. A script-only PR can therefore merge without this workflow running, leaving the changed script to execute during a later nucleus-approved run whose unrelated diff matches this filter. Include every checked-out executable input in the path set.

Suggested change
- ".github/workflows/check-bittensor-e2e-tests.yml"
- "scripts/**"
- ".github/workflows/check-bittensor-e2e-tests.yml"

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@unarbos unarbos merged commit f8664ff into bittensor-core-exploration Jul 10, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant