From b1d5965eec84a34476f3d11022bae11b7f1faaeb Mon Sep 17 00:00:00 2001 From: Filip <34747899+neriousy@users.noreply.github.com> Date: Fri, 16 Oct 2026 17:31:14 +0200 Subject: [PATCH] fix(ci): run app e2e on dev and every package's unit tests (#56117) --- .github/workflows/test.yml | 2 +- .opencode/skills/unit-tests/SKILL.md | 2 +- packages/console/app/package.json | 3 +- .../console/app/test/consoleMarketing.test.ts | 3 +- packages/protocol/package.json | 1 + packages/schema/package.json | 1 + packages/schema/test/contract-hygiene.test.ts | 3 +- packages/schema/test/v1-isolation.test.ts | 10 +- packages/stats/app/package.json | 3 +- packages/stats/core/package.json | 1 + turbo.json | 91 +------------------ 11 files changed, 18 insertions(+), 102 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0926bbe4d190..a653c180126c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: name: affected packages runs-on: blacksmith-4vcpu-ubuntu-2404 outputs: - e2e: ${{ steps.packages.outputs.app == 'true' && github.ref_name != 'dev' && github.head_ref != 'dev' }} + e2e: ${{ steps.packages.outputs.app }} steps: - name: Checkout repository uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 diff --git a/.opencode/skills/unit-tests/SKILL.md b/.opencode/skills/unit-tests/SKILL.md index 0fd114e9edf0..8dfcc7cf6765 100644 --- a/.opencode/skills/unit-tests/SKILL.md +++ b/.opencode/skills/unit-tests/SKILL.md @@ -113,7 +113,7 @@ To avoid adding more: ## Turbo test tasks -- `bun turbo test` runs only packages with an `@opencode/#test` entry in `turbo.json`; all 24 packages with a `test` script have one. A new suite copies its neighbors (`"dependsOn": ["transit"], "outputs": []`); check with `bun turbo test --dry=json`. Suites without an entry rotted: client, util, sdk, http-recorder and merman needed fixes before CI could run them. +- `bun turbo test` runs every workspace package that has a `test` script, through the generic `test` task in `turbo.json` (`"dependsOn": ["transit"], "outputs": []`). A package with test files but no `test` script never runs in CI: give a new suite a script, and check with `bun turbo test --dry=json`. Add an `@opencode/#test` entry only to override the generic task (desktop disables caching). Suites CI skipped rotted: client, util, sdk, http-recorder and merman needed fixes before CI could run them. - `transit` runs nothing and depends on `^transit`, so a test hash covers the package's whole workspace closure. The global dependencies add root `package.json` (whose `packageManager` pins Bun), `bunfig.toml`, `patches/**`, `.npmrc`, `.github/actions/setup-bun/**` and `test.yml`. - Tests do not wait for builds: workspace packages export their sources (`"./*": "./src/*.ts"` in `packages/core/package.json`), so a test must not read a dependency's `dist`. The build job's "Build workspace libraries" step checks the library builds on Linux. - A package that compiles `src` with tsc keeps colocated tests out of the build (`"exclude": ["src/**/*.test.ts"]` in `packages/util/tsconfig.build.json`). Otherwise `bun test` also runs the compiled copies, as Windows CI did with `packages/util/dist/retry.test.js`. diff --git a/packages/console/app/package.json b/packages/console/app/package.json index 702039e1f533..9baf2949ef01 100644 --- a/packages/console/app/package.json +++ b/packages/console/app/package.json @@ -9,7 +9,8 @@ "dev:enterprise": "bun --watch script/dev-enterprise.ts", "dev:remote": "bun sst shell --stage=dev bun dev", "build": "bun ./script/generate-sitemap.ts && vite build && bun ../../schema/script/config-schema.ts ./.output/public/config.json", - "start": "vite start" + "start": "vite start", + "test": "bun test --only-failures" }, "dependencies": { "@cloudflare/vite-plugin": "1.15.2", diff --git a/packages/console/app/test/consoleMarketing.test.ts b/packages/console/app/test/consoleMarketing.test.ts index a18a99d94231..b177a5a92dcd 100644 --- a/packages/console/app/test/consoleMarketing.test.ts +++ b/packages/console/app/test/consoleMarketing.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test" +import path from "node:path" import { i18n } from "../src/i18n" import { LOCALES } from "../src/lib/language" @@ -15,7 +16,7 @@ describe("Console marketing navigation gate", () => { "--eval", 'import { config } from "./src/config.ts"; console.log(config.consoleMarketingEnabled)', ], - cwd: new URL("..", import.meta.url).pathname, + cwd: path.join(import.meta.dir, ".."), env: { ...Object.fromEntries(Object.entries(process.env).filter(([key]) => key !== "VITE_CONSOLE_MARKETING_ENABLED")), ...(value === undefined ? {} : { VITE_CONSOLE_MARKETING_ENABLED: value }), diff --git a/packages/protocol/package.json b/packages/protocol/package.json index efa4e0c30608..13ccf080d1c5 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -23,6 +23,7 @@ "build": "bun run script/build.ts", "generate": "bun run script/generate-openapi.ts", "check:generated": "bun run script/generate-openapi.ts --check", + "test": "bun test --only-failures", "typecheck": "tsgo --noEmit" }, "dependencies": { diff --git a/packages/schema/package.json b/packages/schema/package.json index 7f417082f229..191ec3e44fdf 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -21,6 +21,7 @@ }, "scripts": { "build": "bun run script/build.ts", + "test": "bun test --only-failures", "typecheck": "tsgo --noEmit" }, "dependencies": { diff --git a/packages/schema/test/contract-hygiene.test.ts b/packages/schema/test/contract-hygiene.test.ts index 19836738a29a..030e4d18e463 100644 --- a/packages/schema/test/contract-hygiene.test.ts +++ b/packages/schema/test/contract-hygiene.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test" +import path from "node:path" import { DateTime, Schema } from "effect" import { Agent } from "../src/agent.js" import { ConfigAgent } from "../src/config/agent.js" @@ -231,7 +232,7 @@ describe("contract hygiene", () => { }) test("current source limits Any to reviewed boundaries and avoids mutable contract wrappers", async () => { - const files = [...new Bun.Glob("*.ts").scanSync(new URL("../src", import.meta.url).pathname)].filter( + const files = [...new Bun.Glob("*.ts").scanSync(path.join(import.meta.dir, "../src"))].filter( (file) => !file.endsWith("-v1.ts"), ) const sources = await Promise.all( diff --git a/packages/schema/test/v1-isolation.test.ts b/packages/schema/test/v1-isolation.test.ts index f1cd627c37d9..bc6d943f881e 100644 --- a/packages/schema/test/v1-isolation.test.ts +++ b/packages/schema/test/v1-isolation.test.ts @@ -1,4 +1,5 @@ import { expect, test } from "bun:test" +import path from "node:path" import { LegacyEventV1 } from "../src/legacy-event.js" import { PermissionV1 } from "../src/permission-v1.js" import { SessionV1 } from "../src/session-v1.js" @@ -13,13 +14,8 @@ test("compatibility entrypoints preserve isolated V1 schema identity", () => { }) test("current source does not import the V1 subtree directly", async () => { - const allowed = new Set([ - "filesystem-v1.ts", - "legacy-event.ts", - "permission-v1.ts", - "session-v1.ts", - ]) - const files = [...new Bun.Glob("*.ts").scanSync(new URL("../src", import.meta.url).pathname)].filter( + const allowed = new Set(["filesystem-v1.ts", "legacy-event.ts", "permission-v1.ts", "session-v1.ts"]) + const files = [...new Bun.Glob("*.ts").scanSync(path.join(import.meta.dir, "../src"))].filter( (file) => !allowed.has(file), ) const directImports = await Promise.all( diff --git a/packages/stats/app/package.json b/packages/stats/app/package.json index bf9b47375c15..1f9fe5c66be0 100644 --- a/packages/stats/app/package.json +++ b/packages/stats/app/package.json @@ -9,7 +9,8 @@ "typecheck": "tsgo --noEmit", "dev": "vite dev --host 0.0.0.0", "build": "vite build", - "start": "vite start" + "start": "vite start", + "test": "bun test --only-failures" }, "dependencies": { "@ibm/plex": "6.4.1", diff --git a/packages/stats/core/package.json b/packages/stats/core/package.json index a4242b2784b9..d9a46561958b 100644 --- a/packages/stats/core/package.json +++ b/packages/stats/core/package.json @@ -23,6 +23,7 @@ "db:push": "drizzle-kit push --config=drizzle.config.ts", "db:studio": "drizzle-kit studio --config=drizzle.config.ts", "honeycomb:backfill": "bun src/honeycomb-backfill.ts", + "test": "bun test --only-failures", "typecheck": "tsgo --noEmit" }, "dependencies": { diff --git a/turbo.json b/turbo.json index 1006b66068a3..30b72ed83855 100644 --- a/turbo.json +++ b/turbo.json @@ -41,19 +41,8 @@ "transit": { "dependsOn": ["^transit"] }, - "@opencode/ai#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/codemode#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/core#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/function#test": { + // Every package with a test script runs here, so a new suite cannot be left out of CI. + "test": { "dependsOn": ["transit"], "outputs": [] }, @@ -61,82 +50,6 @@ "outputs": [], "cache": false }, - "@opencode/httpapi-codegen#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/server#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/cli#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/tui#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/latex#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/app#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/ui#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/session-ui#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/client#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/gui-extensions#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/http-recorder#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/merman#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/plugin#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/plugin-browser#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/script#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/sdk#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/simulation#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/theme#test": { - "dependsOn": ["transit"], - "outputs": [] - }, - "@opencode/util#test": { - "dependsOn": ["transit"], - "outputs": [] - }, "@opencode/sdk#verify:package": { "outputs": [] }