From 71d9ced0781afb2a8a3450ad740a09abac81a049 Mon Sep 17 00:00:00 2001 From: nullStack65 Date: Mon, 23 Nov 2026 04:23:04 +0000 Subject: [PATCH] ci: run check:changed on pre-push and skip ARC workers on drafts Shift-left and waste elimination for the fork's ARC CI: - .vite-hooks/pre-push runs `vp run check:changed` against the release or main line the branch is closest to, so format, lint, knip, typecheck and nearby-test failures stop before a push reaches ARC. `pnpm install` already wires .vite-hooks through `vp config`; `--no-verify` skips once. A Node older than package.json engines warns and skips instead of blocking. - closura-arc-ci.yml skips the three ARC workers on draft pull requests and runs on `ready_for_review`. The required "Voice + founder inbox (Linux ARC)" check fails fast on a free hosted runner for drafts, so it is never green without the tests and never wakes ARC for a parked draft. Model: claude-opus-5-5 Task: implementation Agent: CI shift-left implementation sub-agent Harness: t3/claude-code Model-family: claude Model-generation: 5.5 Skills-SHA: none loaded; followed bot-baseline.md and repo AGENTS.md; installed identity unverified Co-Authored-By: Claude Opus 5.5 --- .github/workflows/closura-arc-ci.yml | 21 ++++++++++- .vite-hooks/pre-push | 55 ++++++++++++++++++++++++++++ AGENTS.md | 2 +- 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100755 .vite-hooks/pre-push diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index cb9f3d471eea9..fb9b20d1b5055 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -13,7 +13,9 @@ on: # A founder's edit reruns the full job. An edit by anyone else (for example # CodeRabbit rewriting the description) starts a run whose job is skipped; # the concurrency group below keeps it from cancelling the real run. - types: [opened, synchronize, reopened, edited] + # Draft pull requests skip the three ARC workers, so parked drafts use no + # ARC time. `ready_for_review` starts the full run when a draft is marked ready. + types: [opened, synchronize, reopened, edited, ready_for_review] branches: [feat/assemblyai-current, release/native-0.1.10] workflow_dispatch: @@ -43,6 +45,7 @@ jobs: github.repository == 'nullStack65/t3code' && ( (github.event_name == 'pull_request' && + !github.event.pull_request.draft && github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && @@ -196,6 +199,7 @@ jobs: github.repository == 'nullStack65/t3code' && ( (github.event_name == 'pull_request' && + !github.event.pull_request.draft && github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && @@ -273,6 +277,7 @@ jobs: github.repository == 'nullStack65/t3code' && ( (github.event_name == 'pull_request' && + !github.event.pull_request.draft && github.event.pull_request.head.repo.full_name == github.repository && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && @@ -453,13 +458,25 @@ jobs: # the previous in-progress run on every new push, so that would mark the # required check green for a run whose tests never ran. `!cancelled()` still # runs when a worker failed or was skipped. + # + # On a draft pull request the workers are skipped and this job fails at its + # first step, so the required check stays red until the full run passes. It + # reads only the event payload there, so it uses a free hosted runner (this + # repository is public) and never wakes an ARC runner for a parked draft. voice-and-inbox: name: Voice + founder inbox (Linux ARC) needs: [voice-and-inbox-core, voice-and-inbox-web, voice-and-inbox-mobile] if: ${{ !cancelled() }} - runs-on: t3code-ci-arc + runs-on: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft && 'ubuntu-latest' || 't3code-ci-arc' }} timeout-minutes: 5 steps: + - name: Hold drafts until ready for review + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft }} + shell: bash + run: | + echo "::error::Draft pull request: the ARC workers run when it is marked ready for review." + exit 1 + - name: Checkout trusted source (no persistent credentials) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: diff --git a/.vite-hooks/pre-push b/.vite-hooks/pre-push new file mode 100755 index 0000000000000..bc58b85e3f2f7 --- /dev/null +++ b/.vite-hooks/pre-push @@ -0,0 +1,55 @@ +# Runs CI's fast checks (`vp run check:changed`) on what this push changes, so a +# format, lint, knip, typecheck or nearby-test failure stops here instead of +# costing an ARC run. `pnpm install` wires this hook through `vp config`. +# +# Skip once: `git push --no-verify` (or VP_GIT_HOOKS=0 git push). +# Choose the comparison base: T3_PRE_PUSH_BASE= git push. +# +# The Vite+ dispatcher runs this file with `sh -e`, so keep it POSIX sh. + +zero=0000000000000000000000000000000000000000 +remote="${1:-origin}" +head_sha=$(git rev-parse HEAD) +check="" +# Only branch updates are checked; tags and deletions are not. +while read -r _local_ref local_sha remote_ref _remote_sha; do + case "$remote_ref" in refs/heads/*) ;; *) continue ;; esac + [ "$local_sha" = "$zero" ] && continue + if [ "$local_sha" = "$head_sha" ]; then + check=1 + else + echo "pre-push: $remote_ref is not being pushed from the checked-out commit; not checked locally (CI still runs)." + fi +done +[ -n "$check" ] || exit 0 + +# check:changed needs the Node version in package.json `engines` (it runs .ts +# directly). An older Node is a setup gap, not a code failure: say so and let +# CI do the checking rather than blocking every push from that machine. +want=$(sed -n 's/^ *"node": *"\([0-9]*\)\..*/\1/p' package.json | head -n 1) +have=$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0) +if [ -n "$want" ] && [ "$have" -lt "$want" ]; then + echo "pre-push: WARNING skipped checks: Node $have is older than engines Node $want. Run \`vp env use\` or install Node $want." + exit 0 +fi + +# Compare against the release or main line of the push remote that this branch +# is closest to (fewest commits ahead), the same base its pull request will use. +base="${T3_PRE_PUSH_BASE:-}" +if [ -z "$base" ]; then + best="" + for ref in $(git for-each-ref --format='%(refname)' \ + "refs/remotes/$remote/release/" "refs/remotes/$remote/main"); do + ahead=$(git rev-list --count "$ref..HEAD" 2>/dev/null) || continue + if [ -z "$best" ] || [ "$ahead" -lt "$best" ]; then + best=$ahead + base=$ref + fi + done +fi +if [ -n "$(git status --porcelain --untracked-files=no)" ]; then + echo "pre-push: note: uncommitted changes are included in the check." +fi +# With no base found, check:changed falls back to the nearest remote main. +echo "pre-push: vp run check:changed ${base:-}" +vp run check:changed ${base:+"$base"} diff --git a/AGENTS.md b/AGENTS.md index 7e2ca356ed2b3..8f46ebff6b79a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -108,7 +108,7 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real ## Verifying -- Before you push, run `vp run check:changed`. It runs CI's fast checks for changed files: format, lint, knip, typecheck of affected packages and dependents, tests beside changes, and the cross-file checks those miss. CI still runs the full test suites. +- Before you push, run `vp run check:changed`. It runs CI's fast checks for changed files: format, lint, knip, typecheck of affected packages and dependents, tests beside changes, and the cross-file checks those miss. CI still runs the full test suites. The pre-push hook runs it on `git push`. - While you iterate, run `vp test run `. For big files, add `-t ""`. - Use `vp run typecheck`; it caches per package. Each package runs `effect-tsgo tsrs --noEmit`, the Rust TypeScript 7 checker with Effect's diagnostics built in. There is no `typescript` package to run. - Run `node -e` snippets from `apps/server` or the owning package. `effect` does not resolve from the repo root.