Files
79559ebb92 fix(ci): unblock the release by fixing two flaky main failures (MUL-6890) (#7828)
* test(wecom): move the relay claim tests off a shared Redis DB index (MUL-6890)

The relay outcome tests keep their claims in Redis DB 12, which
internal/service also takes for its own suite — and both flush that DB on
entry and exit. `go test ./...` runs packages concurrently, so a flush from
one package can delete a live delivery claim held by the other, and the
publisher's outcome watch then reads an absent claim as "nobody delivered"
and counts a drop for a reply the holder had already sent.

That is the intermittent `outbound_dropped on the publisher = 1, want 0 —
it was delivered` on main. Reproduced by running internal/service's
Redis-backed tests alongside this one; fixed by giving the package an index
nothing else uses, with the current allocation written down so the next one
does not collide either.

Co-authored-by: multica-agent <[email protected]>

* build(turbo): generate fumadocs .source once instead of racing (MUL-6890)

`build` and `typecheck` both ran `fumadocs-mdx` before their real work, and
turbo is free to run those two tasks for the same package at the same time.
fumadocs-mdx regenerates `.source/` by removing the directory and writing it
back, so the two processes fight over one tree: whichever one mkdir's first
can have it deleted underneath, and its write dies on `ENOENT: no such file
or directory, open '.source/index.ts'` — the frontend-build failure on main,
which is pure timing and passes on a rerun.

Move the generation into its own `mdx` task that both depend on. It runs
once, its output is cached like any other task's, and the two consumers can
still run concurrently. Packages with no `mdx` script are unaffected: turbo
skips a dependency nobody implements, the same way `cache-inputs` already
works here.

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: J <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-08-31 18:29:37 +08:00

84 lines
3.6 KiB
JSON

{
"$schema": "https://turbo.build/schema.json",
// The CI workflow pins the toolchain these tasks run under (Node 22 today).
// Without it in the global hash, bumping that version would replay cached
// typecheck/test results produced by the old runtime and hide an
// incompatibility behind a green check.
"globalDependencies": [".github/workflows/ci.yml"],
"globalEnv": [
"DATABASE_URL",
"PORT",
"FRONTEND_PORT",
"FRONTEND_ORIGIN",
"NEXT_PUBLIC_API_URL",
"NEXT_PUBLIC_WS_URL",
"MULTICA_SERVER_URL",
"DOCS_URL",
"COMPOSE_PROJECT_NAME",
"POSTGRES_DB",
"POSTGRES_PORT",
"DESKTOP_RENDERER_PORT",
"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", "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
// `content/**/*.mdx` (compiled by fumadocs-mdx during the build),
// `public/**` assets, nor `package.json` / `tsconfig.json`, so the task
// hash was unchanged by edits to any of them -- harmless while nothing
// was ever cached, a stale-build bug the moment it is.
"outputs": [".next/**", "!.next/cache/**", "dist/**", "out/**"]
},
"dev": {
"cache": false,
"persistent": true
},
"dev:staging": {
"cache": false,
"persistent": true
},
"typecheck": {
"dependsOn": ["^typecheck", "mdx"]
},
// Hash-only transit task. No package implements a `cache-inputs` script,
// so every node resolves to <NONEXISTENT> and nothing is ever executed --
// but the edges still pull each dependency's file hashes into whatever
// depends on it. `dependsOn: ["^cache-inputs"]` makes that recursive, so
// the chain stays complete if a package ever gains a purely transitive
// dependency. This exists because a turbo task hash covers a workspace
// dependency's sources only when a task edge reaches them.
"cache-inputs": {
"dependsOn": ["^cache-inputs"]
},
// Without a dependency edge, editing packages/views or packages/ui left
// `@multica/web#test` and `@multica/desktop#test` byte-identical in hash,
// so a cached pass would be replayed over changed code. `^cache-inputs`
// closes that without side effects: `^typecheck` would also work but drags
// three real `tsc --noEmit` runs (~223 CPU-seconds) into the test job, and
// `^test` would serialise the suites behind each other.
"test": {
"dependsOn": ["^cache-inputs"]
},
// `lint` keeps no dependency edge: eslint here is not type-aware (no
// `projectService` / `parserOptions.project` anywhere in
// packages/eslint-config), so it only ever reads its own package's files
// and a dependency's source cannot change its result.
"lint": {}
}
}