Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: run the frontend unit tests on Windows in CI (#9099)
Daniel Han5a1655ca1b22
diff --git a/.github/workflows/studio-frontend-ci.yml b/.github/workflows/studio-frontend-ci.ymlindex 3cad7fa05ea..bfa140e3d2d 100644--- a/.github/workflows/studio-frontend-ci.yml+++ b/.github/workflows/studio-frontend-ci.yml@@ -239,3 +239,63 @@ jobs:name: studio-frontend-distpath: studio/frontend/distretention-days: 1++ # The suite reads its own sources off disk, resolves modules by URL and walks+ # directories, so it can be correct on POSIX and wrong on Windows. Running it+ # on ubuntu only, this job's absence let 13 such failures accumulate unseen+ # across three files: two shapes of path/URL confusion, one of them added by a+ # PR whose whole purpose was to fix a Windows bug.+ #+ # Deliberately NOT a matrix over the job above. Measured on a staging replica+ # of this workflow, `windows-latest` runs `npm test` in 49s against ubuntu's+ # 47s, so the tests themselves are not the expensive part; typecheck (48s),+ # build (33s), the Chromium install and the three browser smokes are, and none+ # of them can fail on Windows for a reason they would not also fail on ubuntu.+ # Repeating them would roughly triple the cost of this workflow to re-answer a+ # question ubuntu already answered. Checkout, node, `npm ci` and `npm test` on+ # Windows measured ~132s.+ #+ # Line endings need no special handling here: .gitattributes pins+ # `studio/frontend/** text=auto eol=lf`, so the tree checks out LF whatever the+ # runner's core.autocrlf says, and the assertions that match on exact source+ # substrings see the bytes in the repo.+ windows:+ name: Frontend unit tests (Windows)+ runs-on: windows-latest+ timeout-minutes: 15+ defaults:+ run:+ shell: bash+ working-directory: studio/frontend+ steps:+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false++ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0+ with:+ node-version: '22'++ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0+ with:+ python-version: '3.12'++ # The same pre-install scan the ubuntu job runs, and for the same reason:+ # a compromised tarball runs its `prepare` / `postinstall` during `npm ci`,+ # so any catch has to fire upstream of that. Jobs run concurrently, so the+ # ubuntu job rejecting the lockfile does not help a Windows runner that has+ # already installed it. Pure-Python and read-only.+ - name: Lockfile supply-chain audit (pre-install scan)+ working-directory: ${{ github.workspace }}+ run: python scripts/lockfile_supply_chain_audit.py++ # `--ignore-scripts`, not the `--strict-allow-scripts` install the ubuntu+ # job runs. That one needs the npm 11.16 upgrade step, and the pins it+ # enforces are a property of the lockfile, which this job does not need to+ # re-check: it is a platform gate. Running no install script at all is the+ # stronger position anyway, and the suite is node:test over TypeScript+ # sources, so nothing here needs a native build step.+ - run: npm ci --ignore-scripts --no-fund --no-audit++ - name: Unit tests+ run: npm testdiff --git a/studio/frontend/tests/background-load-notice.test.ts b/studio/frontend/tests/background-load-notice.test.tsindex a1c3b178f52..a31bd1a0c10 100644--- a/studio/frontend/tests/background-load-notice.test.ts+++ b/studio/frontend/tests/background-load-notice.test.ts@@ -320,29 +320,62 @@ test("a long but healthy download is never abandoned", async () => {stop();});-test("a healthy read resets the stall window", async () => {+const STALL_MS = 400;++/**+ * Poll until the notice settles, with the read at `healthyAt` reporting progress+ * and every other read unreadable. `healthyAt: 0` means none of them do.+ * Returns how many reads the loop survived.+ */+async function readsBeforeSettling(healthyAt: number): Promise<number> {const { settled, stop } = record();let read = 0;-await withBackgroundLoadNotice("image","unsloth/flux",async () => null,async () => {read += 1;- // Unreadable, then healthy, then unreadable again. Without the reset the- // second run of failures would inherit the first one's elapsed time.- if (read === 1 || read === 2) throw new Error("backend restarting");- if (read === 3) return "downloading";+ if (read === healthyAt) return "downloading";throw new Error("backend restarting");},- { pollMs: 1, readTimeoutMs: 25, stallMs: 30 },+ // readTimeoutMs is generous on purpose: the read answers immediately, and a+ // busy runner must not turn a healthy read into an unreadable one.+ { pollMs: 1, readTimeoutMs: 5_000, stallMs: STALL_MS },);-await settled;- // It survived past the point an unreset window would have expired.- assert.ok(read > 4, `expected the window to restart, got ${read} reads`);stop();+ return read;+}++test("a healthy read resets the stall window", async () => {+ // The source reads `Date.now()` and arms `setTimeout` itself, so this runs on+ // the wall clock. That rules out asserting a read count against a millisecond+ // budget: one poll costs about 1 ms here and about 15 ms on a Windows runner,+ // whose default timer granularity is coarser than any margin small enough to+ // keep the test quick. The previous version asserted `reads > 4` against a+ // 30 ms window and was both flaky on Windows (2 reads consumed it before the+ // healthy one arrived) and vacuous on Linux, where 30 ms of 1 ms polls clears+ // 4 reads whether or not the window is ever reset.+ //+ // So measure the reset against the same loop without one. The comparison+ // divides the platform out: whatever a poll costs, a window restarted halfway+ // through must carry the loop about half as far again.+ const withoutReset = await readsBeforeSettling(0);+ assert.ok(+ withoutReset > 8,+ `the baseline is too short to compare against: ${withoutReset} reads. ` ++ "Raise STALL_MS.",+ );++ const withReset = await readsBeforeSettling(Math.floor(withoutReset / 2));+ assert.ok(+ withReset >= withoutReset * 1.25,+ "a healthy read did not restart the stall window: " ++ `${withReset} reads with one, ${withoutReset} without. A run of ` ++ "unreadable polls is inheriting the elapsed time of the run before it, so " ++ "a slow download that keeps reporting progress can still be abandoned.",+ );});test("the load is announced again once the POST has committed", async () => {