Skip to content

chore(ci): four per-PR runner reductions (dependency-review fold, selfhost push-only, one-runner previews, merged advisories)#8523

Merged
JSONbored merged 1 commit into
mainfrom
chore/per-pr-runner-reductions
Jul 24, 2026
Merged

chore(ci): four per-PR runner reductions (dependency-review fold, selfhost push-only, one-runner previews, merged advisories)#8523
JSONbored merged 1 commit into
mainfrom
chore/per-pr-runner-reductions

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Follow-up to #8514's unsharding, attacking the remaining per-PR runner fan-out at the source (observed today: 44-deep Actions queue with 3 running — the same starvation that stalled release-please and left #8506 conflicted for 1.5h).

1. security folds into changes (−1 slot on every PR). The dependency-review API check becomes a PR-only, draft-skipped step at the end of changes (which gains pull-requests: write solely for comment-summary-in-pr). validate's needs drops the job; a dep failure reddens validate through changes exactly as before, one job earlier. Branch protection unaffected (only validate + Superagent are required).

2. selfhost.yml goes push-to-main only (−~99 × 5.2 min/week). Its PR path list included migrations/**, so nearly every backend PR paid a docker build+boot. Pre-merge, ci.yml already enforces db:migrations:check, schema drift, and the selfhost pg integration suites; the boot smoke still runs on every main push (break caught minutes post-merge), and self-host users only consume tagged releases. Trade-off documented in the workflow header with a revisit condition (a hosted deploy tracking main).

3. Same-repo UI PRs deploy in ONE runner (−1 slot per UI push, ~100/wk). The trusted deploy half moves to a shared .github/actions/deploy-ui-preview composite (the setup-workspace precedent); ui-preview.yml gains an inline build-deploy job for same-repo PRs (same-repo = collaborator = secrets available), and ui-preview-deploy.yml becomes fork-only — its job's if compares head_repository to the base repo, so same-repo builds skip it without consuming a runner. The fork trust boundary is byte-for-byte preserved: fork code still builds with zero secrets and deploys only through the trusted workflow_run half, with the same bundle validation (symlink/structure/extension allowlist) now living in the composite both paths share. Bonus: the deploy job gained a trusted default-branch checkout, retiring the hand-synced hardcoded Node version.

4. The two calibration advisories merge into calibration-advisory.yml (−1 slot when both fired, one npm ci always). backtest-logic-check.yml + counterfactual-replay-check.yml had identical scaffolding and overlapping paths (src/services/ai-review.ts triggered both). One job now runs both halves; the replay half keeps its COUNTERFACTUAL_REPLAY_BUDGET spend guard and self-gates on the canonical prompt actually differing between base/head (which replaces its narrower path filter at the cost of two script invocations). The fail-open posture (#8105 — notice + green, never a red check) is preserved verbatim on every advisory step, fork-notice pairing included.

Net: every PR's floor drops 5 → 4 slots, UI PRs 7 → 5, migration-touching PRs lose the 5-minute docker job — on top of yesterday-today's unsharding (7 → 5), CodeQL removal, and cache-cleanup batching.

Validation

actionlint clean across all workflows; tsc --noEmit clean; full unit suite green (the one red file, miner-metrics-cli, was a stale local miner build artifact — passes after rebuild, untouched by this PR). Pinned CI-topology tests updated and passing: ci-skip-draft-prs (dependency-review step assertion + pinned absence of a resurrected security job), workflow-runner-labels (needs list, job slicing, selfhost concurrency group). Skill reference.md rows updated to match. The preview-pipeline change is validated structurally here; its first live exercise will be the next same-repo UI PR (Reviewbot reads the same Deployments API records, written by the same composite logic).

…o changes, make selfhost push-only, one-runner same-repo previews, merge the calibration advisories

Follow-up to the validate-tests unsharding (#8514), attacking the remaining
per-PR runner fan-out at the source (observed 44-deep queue with 3 running):

1. The standalone `security` job folds into `changes` as a PR-only
   dependency-review step -- one fewer runner slot on EVERY PR at zero
   wall-clock cost (the API lockfile diff takes seconds). `validate`'s
   needs drops it; a dep failure still reddens `validate` via `changes`.

2. selfhost.yml drops its pull_request trigger (~99 x 5.2min/week --
   migrations/** made nearly every backend PR pay a docker build+boot).
   ci.yml still validates migrations/schema/pg suites pre-merge; the boot
   smoke now catches a break minutes after merge, and self-host users only
   consume tagged releases, never main.

3. Same-repo UI PRs build AND deploy their preview in ONE job: the deploy
   half moves to a shared .github/actions/deploy-ui-preview composite
   (setup-workspace precedent), ui-preview.yml gains the inline
   build-deploy job, and ui-preview-deploy.yml becomes fork-only (its job
   skips runner-free for same-repo builds via head_repository comparison).
   The fork trust boundary is untouched: fork code still builds with zero
   secrets and deploys only through the trusted workflow_run half. Bonus:
   the deploy job now has a trusted default-branch checkout, retiring the
   hand-synced hardcoded Node version.

4. backtest-logic-check.yml + counterfactual-replay-check.yml merge into
   calibration-advisory.yml -- identical scaffolding, overlapping paths
   (ai-review.ts fired BOTH), so one job runs both halves for one npm ci
   and one runner slot. The replay half keeps its budget spend-guard and
   now self-gates on the canonical prompt actually differing (replacing
   its ai-review.ts-only path filter). Fail-open posture preserved
   verbatim on every advisory step.

Net per-PR floor drops 5 -> 4 slots, UI PRs 7 -> 5, migration PRs lose the
5-minute docker job. Pinned tests updated (ci-skip-draft-prs,
workflow-runner-labels); skill reference.md rows updated.
@JSONbored JSONbored self-assigned this Jul 24, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored merged commit a20ddd8 into main Jul 24, 2026
4 checks passed
@JSONbored
JSONbored deleted the chore/per-pr-runner-reductions branch July 24, 2026 18:16
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 24, 2026
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.53%. Comparing base (ac5ffbd) to head (dd720d5).
⚠️ Report is 22 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #8523       +/-   ##
===========================================
+ Coverage   78.66%   92.53%   +13.87%     
===========================================
  Files         793      793               
  Lines       79483    79551       +68     
  Branches    24017    24039       +22     
===========================================
+ Hits        62526    73615    +11089     
+ Misses      13908     4799     -9109     
+ Partials     3049     1137     -1912     
Flag Coverage Δ
backend 93.71% <ø> (?)
control-plane 99.85% <ø> (ø)
rees 88.56% <ø> (ø)
shard-1 ?
shard-2 ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 251 files with indirect coverage changes

JSONbored added a commit that referenced this pull request Jul 24, 2026
Build UI preview artifact failed on this PR (and would fail on any UI PR)
with 'Bundle contains unexpected file types: ./client/.nojekyll'. The
extensionless-file allowlist in the deploy-ui-preview composite action
(new as of #8523's runner-reduction consolidation, never actually exercised
against a real bundle until this PR) didn't include .nojekyll -- a
zero-byte, purely-advisory host-compatibility marker the SSR build tooling
emits by default, same risk profile (no executable content) as the
already-allowlisted _headers/_redirects/_routes.json/.assetsignore.
JSONbored added a commit that referenced this pull request Jul 24, 2026
…atest (#8566)

* chore(ui): sync MCP_PACKAGE_KNOWN_LATEST_VERSION with npm dist-tags.latest

* fix(ci): allowlist .nojekyll in the UI preview bundle validator

Build UI preview artifact failed on this PR (and would fail on any UI PR)
with 'Bundle contains unexpected file types: ./client/.nojekyll'. The
extensionless-file allowlist in the deploy-ui-preview composite action
(new as of #8523's runner-reduction consolidation, never actually exercised
against a real bundle until this PR) didn't include .nojekyll -- a
zero-byte, purely-advisory host-compatibility marker the SSR build tooling
emits by default, same risk profile (no executable content) as the
already-allowlisted _headers/_redirects/_routes.json/.assetsignore.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant