4 Commits
Author SHA1 Message Date
Waleed 003c3527b1 improvement(ci): run affected suites and reuse production builds (#9297)
* improvement(ci): reuse E2E builds and rebalance integration runners

* improvement(ci): use free integration runners and shard browser viewports

* improvement(ci): share production builds across HTTP and Electron suites

* improvement(ci): select affected task groups with Turborepo

* improvement(ci): scope type checks and right-size hosted runners

* improvement(ci): partition macOS desktop smoke coverage

* fix(ci): retain integration coverage for shared UI and harness changes

* fix(ci): preserve landing dependencies and favor integration latency

* docs(ci): clarify paired provider benchmark count

* ci: retain free GitHub integration runners

* docs(ci): clarify push and manual check selection

* fix(ci): preserve hosted SCIM entitlement coverage
2026-10-22 11:05:50 -07:00
Waleed 7d090d1e7f ci: ratchet type errors in apps/sim test files (#8959)
* ci: ratchet type errors in apps/sim unit tests per file

apps/sim's tsconfig excludes *.test.ts(x), so ~3.4k test files are never
type-checked and any new test can add errors. check:test-types runs the
native tsc on apps/sim/tsconfig.tests.json (the app config with tests left
in), counts errors per file, and compares with a shrink-only baseline,
matching check:explicit-any's semantics: a rise or a new file fails, a drop
fails until --update shrinks it, --update never raises, --update --init only
creates a missing baseline. Output it cannot place (global diagnostics, a
crash) fails outright instead of reading as fewer errors.

It type-checks the whole app, so it runs in its own test-types job gated
like test (wired into ci-gate.sh), not in check:audits. On failure the job
uploads counts.json and the compiler output; --counts <file> lets the
baseline be bootstrapped or shrunk from that artifact without a local
compile.

* ci: commit the test type-error baseline from CI and drop the one-time --init path

Baseline from run 38342772080's test-types counts: 3209 errors in 874 files.
--update stays shrink-only; a missing baseline is restored from git.

* ci: ratchet test type errors per file and TS code, with command-level tests

A per-file count let one new error replace a fixed one with the total flat.
The baseline is now { file: { TSnnnn: count } }: any (file, code) count
that rises fails, including a new code in a baselined file, and --update
stays shrink-only per pair. The key stops at the code: line and column
move with edits, and messages print types that change with unrelated
source or compiler versions.

--diagnostics <file> replaces --counts: it reads a saved compiler output
(the CI artifact's diagnostics.txt) through the same parser and undercount
checks, so a fix can shrink the baseline without a local compile. The
baseline was migrated from run 38342772080's diagnostics.txt with the
script's parser: 3209 errors in 874 files across 52 codes, every per-file
total equal to the previous baseline's.

Command-level tests run the real script on fixture diagnostics: unchanged,
a rising count, a new code replacing a fixed error, a new file, a dropped
count, --update refusing a raise, --update shrinking, and unparseable or
inconsistent output. The checks.yml comment now describes the artifact as
input for shrinking the existing baseline.

* ci: verify saved test-type diagnostics against the compile's exit status

--diagnostics read an empty or truncated diagnostics.txt as fewer errors,
so a failed compile's artifact plus --update could erase the baseline.
--report now writes status.json (exit code and printed error count) once
the compile's output and exit code agree, and --diagnostics requires it:
exit 0 must mean no errors, the parse must match the recorded count, and
a missing or malformed status fails. Command-level tests cover each case
and that --update never writes the baseline from such input.

Also passes a route context to the socket-token route test's POST call,
the one new test type error (TS2554) the ratchet caught after #8958.

* ci: read the saved compiler status through toRecord
2026-10-12 21:51:14 -07:00
Waleed caa925a86b ci: run the mobile e2e suite on a production build, one job per browser (#8948)
* ci: run the mobile e2e suite on the shared production build, one job per browser

The build job now packages .next (zstd, cache excluded) and uploads it for a
day. A new e2e-mobile job, one per browser (chromium, webkit), extracts it and
serves it with `next start`, so the suite no longer waits on dev compiles or
runs both browsers back to back. The mobile group leaves the e2e matrix.

On runs that execute e2e, the build bakes NEXT_PUBLIC_APP_URL=http://localhost:3000,
which is what production images bake, so the served build is the one that ships.
Content-only pull requests keep the hosted value, under which next build
prerenders every post.

http-e2e.sh gains a `next start` mode used only by mobile: it installs only the
selected browser, drops the dev heap override, and rebuilds the HTTP status log
from RouteHandler's JSON lines at LOG_LEVEL=INFO. The ci gate treats e2e-mobile
like e2e: a skip passes only when `full` is exactly false.

* ci: build mobile's artifact in its own job and keep the hosted build untouched

The `build` job is back to staging byte for byte: its www.sim.ai build is CI's
only render of every post, and it must stay on every run. A new `e2e-build`
job, gated on `full` with its own Turbo cache key, builds with
NEXT_PUBLIC_APP_URL=http://localhost:3000 (the Dockerfile default, so the same
public-env mode production images use; images run the standalone server) and
packages and uploads it for e2e-mobile, now kept 3 days and without
.next/trace.

e2e-mobile fails fast when the downloaded build prerendered posts, which only a
hosted build does; the URL is no marker, since next.config's redirects name
www.sim.ai in every build. The ci gate treats e2e-build like e2e.

* ci: key the non-hosted guard on prerendered post pages, not every /blog/ route

* ci: expect the socket-token rate limit in the mobile e2e suite

Each document load mints one realtime token from a route capped at 30/min
per IP. On the production build the suite loads well over 30 documents a
minute from loopback, so the route's designed 429 is recorded apart from
httpErrors (only with Retry-After), and each browser must still mint at
least once.
2026-10-12 16:54:12 -07:00
Waleed d3e97f4f03 ci: scope pull request checks to what the diff can affect (#8946)
* ci: scope pull request checks to what the diff can affect

A `changes` job classifies the pull request's files against explicit
allowlists (.github/scripts/ci-changes.sh, replacing
desktop-live-changes.sh):

- content posts, author profiles and their public assets: lint, test, build
- apps/docs: lint, test
- apps/desktop: lint, test, desktop-live
- agent guidance (.agents, .claude, .cursor, AGENTS.md, CLAUDE.md, root README): lint

Any other file, any .github change, an empty diff, or a diff that cannot
be worked out runs everything; pushes and dispatches always run
everything. The live desktop suite keeps its own skip list, now including
the content asset folders it previously missed.

`ci` accepts a skip only when `changes` set that job's flag to exactly
`false`, so a failed or skipped `changes`, or a lost output, fails it.

* ci: move the ci gate into a tested script and reject non-boolean change flags

The ci aggregator's skip rules now live in .github/scripts/ci-gate.sh, read from
NEEDS, with table-driven tests covering every guard. The change-classifier test
helper fails on any flag value other than exactly true or false.
2026-10-12 15:39:25 -07:00