diff --git a/apps/docs/package.json b/apps/docs/package.json index 5dcd754dc..21deb7537 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -5,10 +5,11 @@ "type": "module", "scripts": { "dev": "next dev --port 4000", - "build": "fumadocs-mdx && next build", + "build": "next build", "start": "next start", - "typecheck": "fumadocs-mdx && tsc --noEmit", + "typecheck": "tsc --noEmit", "test": "vitest run", + "mdx": "fumadocs-mdx", "postinstall": "fumadocs-mdx" }, "dependencies": { diff --git a/apps/web/package.json b/apps/web/package.json index 4ba75ce9c..ad25a9ca5 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,11 +5,12 @@ "type": "module", "scripts": { "dev": "sh -c 'next dev --webpack --port \"${FRONTEND_PORT:-3000}\"'", - "build": "fumadocs-mdx && next build --webpack", + "build": "next build --webpack", "start": "next start", - "typecheck": "fumadocs-mdx && tsc --noEmit", + "typecheck": "tsc --noEmit", "lint": "eslint .", "test": "vitest run", + "mdx": "fumadocs-mdx", "postinstall": "fumadocs-mdx" }, "dependencies": { diff --git a/server/internal/integrations/wecom/relay_ordering_db_test.go b/server/internal/integrations/wecom/relay_ordering_db_test.go index a4589aaf5..e1a2339d3 100644 --- a/server/internal/integrations/wecom/relay_ordering_db_test.go +++ b/server/internal/integrations/wecom/relay_ordering_db_test.go @@ -37,7 +37,15 @@ import ( // wecomTestRedis is the same gate the rest of the repository uses for // Redis-backed tests: REDIS_TEST_URL, a dedicated DB index, flushed around // each test so one run cannot see another's claims. -const wecomRelayTestRedisDB = 12 +// +// The index has to be unique across PACKAGES, not just within this one. `go +// test ./...` runs packages concurrently, every Redis-backed suite flushes its +// own DB on entry and exit, and a flush is indiscriminate: sharing an index +// means another package can delete a live delivery claim mid-test, and the +// outcome watch then reports a reply that was delivered as lost. Current +// allocation — 11 internal/auth, 12 internal/service, 13 internal/middleware, +// 14 internal/handler, 15 here. +const wecomRelayTestRedisDB = 15 // testClaimBudget is the claim round trip these tests give the real store. It // sizes outcomeGrace (once per offer), so the production 2s would make the diff --git a/turbo.json b/turbo.json index c1852127f..2561d4177 100644 --- a/turbo.json +++ b/turbo.json @@ -21,8 +21,20 @@ "DESKTOP_APP_SUFFIX" ], "tasks": { + // `fumadocs-mdx` regenerates `.source/` by removing the directory and + // writing it again, so two of them in the same package at once is a race: + // one process rm -rf's the tree the other has already mkdir'd, and the + // loser dies on `ENOENT .source/index.ts`. `build` and `typecheck` both + // needed those types and both used to shell out to it, which turbo is free + // to run concurrently — a red CI job on nothing but timing. One task the + // two depend on generates it once, and its output is cached like any + // other. Packages without an `mdx` script are unaffected: turbo skips a + // dependency no package implements. + "mdx": { + "outputs": [".source/**"] + }, "build": { - "dependsOn": ["^build"], + "dependsOn": ["^build", "mdx"], // No explicit `inputs`: turbo's default (every git-tracked file in the // package) is the only safe hash source now that the cache is actually // restored in CI. The previous narrow glob list matched neither @@ -41,7 +53,7 @@ "persistent": true }, "typecheck": { - "dependsOn": ["^typecheck"] + "dependsOn": ["^typecheck", "mdx"] }, // Hash-only transit task. No package implements a `cache-inputs` script, // so every node resolves to and nothing is ever executed --