From e40937044d3ee584279ca97eb1deda1a96a71735 Mon Sep 17 00:00:00 2001 From: mubeda <1380447+mubeda@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:27:53 -0300 Subject: [PATCH 1/3] fix(ci): rebuild workspace crates in every seeded upgrade build The protected baseline is the candidate's source stamped with the previous-stable version, and all builds share one Cargo target. Cargo's mtime check took previous-stable's server as fresh and linked it into the protected build, which broke once the desktop called a server function the previous release lacks. Each build now drops the workspace crates' fingerprints first; registry dependencies stay shared. Co-Authored-By: Claude Opus 5.5 --- docs/operations/release.md | 5 +++- scripts/seeded-desktop-upgrade-smoke.test.ts | 21 ++++++++++++++ scripts/seeded-desktop-upgrade-smoke.ts | 29 ++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/docs/operations/release.md b/docs/operations/release.md index 6ebf35f4c7..1391a17bb4 100644 --- a/docs/operations/release.md +++ b/docs/operations/release.md @@ -375,7 +375,10 @@ server versions describe the same build. The calling checkout is not rewritten. The three packages compile sequentially into one shared Cargo target under the isolated run root; the workflow's cached repository `target` does not warm it. -The later builds reuse the first build's registry dependencies, and after each +The later builds reuse the first build's registry dependencies. Before each +build the harness drops the workspace crates' Cargo fingerprints, because the +protected baseline and previous-stable share a version and Cargo would otherwise +link one checkout's server into the other's package. After each build the harness renames its whole bundle directory into that build's own artifact root, so packages never mix. The macOS packaging children have a 90-minute bound, Windows children 60 minutes, and Linux children 45 minutes. Each checkout's frozen dependency install retains diff --git a/scripts/seeded-desktop-upgrade-smoke.test.ts b/scripts/seeded-desktop-upgrade-smoke.test.ts index df07ac74c9..fd64044d3a 100644 --- a/scripts/seeded-desktop-upgrade-smoke.test.ts +++ b/scripts/seeded-desktop-upgrade-smoke.test.ts @@ -51,6 +51,7 @@ import { createSeededUpgradeWdioConfig, ManagedProcessRegistry, parseSeededDesktopUpgradeSmokeArgs, + dropWorkspaceFingerprints, prepareSeededUpgradeBuild, redactAndBoundUpgradeEvidence, writeRemoteUploadCapabilityReceipt, @@ -981,6 +982,7 @@ describe("seeded packaging build budgets", () => { const layout = createSeededUpgradeRunLayout(root, "budget-fixture"); const triple = seededUpgradeRustTarget(platform, arch); const bundleAtStart: Record> = {}; + const fingerprintsAtStart: Record> = {}; // Stands in for `tauri build`: like Tauri, it adds to whatever bundle directory exists // and leaves compilation state beside it in the Cargo target it was given. const runCommand = vi.fn(async (command: Parameters[0]) => { @@ -998,6 +1000,13 @@ describe("seeded packaging build budgets", () => { NodeFS.mkdirSync(NodePath.dirname(path), { recursive: true }); NodeFS.writeFileSync(path, text); }; + const fingerprints = NodePath.join(release, ".fingerprint"); + fingerprintsAtStart[build] = NodeFS.existsSync(fingerprints) + ? NodeFS.readdirSync(fingerprints).toSorted() + : []; + // A workspace crate and a registry dependency, as Cargo names their fingerprints. + write(NodePath.join(fingerprints, "bibcode-server-0a1b2c", "lib-bibcode_server"), build); + write(NodePath.join(fingerprints, "serde-3d4e5f", "lib-serde"), build); write(NodePath.join(release, "deps", `${build}.rlib`), build); if (options.omitBundleFor !== build) { write(NodePath.join(bundle, packageName(platform)), `${build} package`); @@ -1029,6 +1038,7 @@ describe("seeded packaging build budgets", () => { SeededUpgradeCommandTimeoutError, runCommand, prepareSeededUpgradeBuild, + dropWorkspaceFingerprints, seededUpgradeBundleRoot, seededUpgradeVitePlusExecutable, seededUpgradeRustTarget, @@ -1057,6 +1067,7 @@ describe("seeded packaging build budgets", () => { return { ...context, bundleAtStart, + fingerprintsAtStart, rename, sharedBundle: seededUpgradeBundleRoot(layout.cargoTargetRoot, platform, arch), staged, @@ -1265,6 +1276,16 @@ describe("seeded packaging build budgets", () => { expect(NodeFS.existsSync(owned.sharedBundle)).toBe(false); }); + it("rebuilds the workspace crates in every build while registry dependencies stay shared", async () => { + const owned = fixture("linux", "x64"); + await owned.run(); + expect(owned.fingerprintsAtStart).toEqual({ + candidate: [], + "previous-stable": ["serde-3d4e5f"], + "protected-baseline": ["serde-3d4e5f"], + }); + }); + it("stops before later builds when a build leaves no bundle to stage", async () => { const owned = fixture("linux", "x64", { omitBundleFor: "candidate" }); await expect(owned.run()).rejects.toThrow(/stage the candidate bundle/); diff --git a/scripts/seeded-desktop-upgrade-smoke.ts b/scripts/seeded-desktop-upgrade-smoke.ts index 8cfde5ea11..a5d7991836 100644 --- a/scripts/seeded-desktop-upgrade-smoke.ts +++ b/scripts/seeded-desktop-upgrade-smoke.ts @@ -2166,6 +2166,34 @@ export async function prepareSeededUpgradeBuild( await assertSeededUpgradeBuildVersion(input); } +/** + * The protected baseline is the candidate's source stamped with the previous-stable version, so + * it shares that build's workspace crate versions, and Cargo's mtime check took previous-stable's + * server as fresh and linked it into the protected build. Dropping only the workspace crates' + * fingerprints rebuilds them from this checkout while registry dependencies stay shared. + */ +export async function dropWorkspaceFingerprints( + cargoTargetDirectory: string, + platform: SeededUpgradePlatform, + arch: SeededUpgradeArch, +): Promise { + const fingerprints = NodePath.join( + cargoTargetDirectory, + seededUpgradeRustTarget(platform, arch), + "release", + ".fingerprint", + ); + const entries = await NodeFS.promises.readdir(fingerprints).catch(() => []); + for (const entry of entries) { + if (/^bibcode-(server|desktop)-[0-9a-f]+$/.test(entry)) { + await NodeFS.promises.rm(NodePath.join(fingerprints, entry), { + recursive: true, + force: true, + }); + } + } +} + const buildPackagedApplication = async (input: { readonly arch: SeededUpgradeArch; readonly artifactDirectory: string; @@ -2190,6 +2218,7 @@ const buildPackagedApplication = async (input: { ); // Tauri adds to an existing bundle directory, so clear only it; Cargo's state stays reusable. await NodeFS.promises.rm(sharedBundle, { recursive: true, force: true }); + await dropWorkspaceFingerprints(input.cargoTargetDirectory, input.platform, input.arch); await runTimedBuildCommand({ artifactDirectory: input.artifactDirectory, command: seededUpgradeVitePlusExecutable, From e5a5176ea4326a82ca19423abb5255c3eac474ae Mon Sep 17 00:00:00 2001 From: mubeda <1380447+mubeda@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:39:28 -0300 Subject: [PATCH 2/3] test(send-requests): count terminal writes before the racing send When a run's cancel won, the terminal stayed ready, so the next run's request could be pasted before the test read its write count. The refused cancel then saw no new write. The count is now taken before the send. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/send_requests/terminal/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/server/src/send_requests/terminal/tests.rs b/apps/server/src/send_requests/terminal/tests.rs index 2c434f69ee..c067bf5ed3 100644 --- a/apps/server/src/send_requests/terminal/tests.rs +++ b/apps/server/src/send_requests/terminal/tests.rs @@ -835,6 +835,9 @@ async fn cancel_racing_a_pointer_paste_has_exactly_one_winner() { let context = person(); for run in 0..50 { let request_id = format!("race-{run}"); + // Counted before the send: a cancelled run leaves the terminal ready, so the next + // request can be pasted before the send returns. + let before = fixture.terminals.writes("b", "term-1").len(); fixture .send(input( &request_id, @@ -844,7 +847,6 @@ async fn cancel_racing_a_pointer_paste_has_exactly_one_winner() { )) .await .unwrap(); - let before = fixture.terminals.writes("b", "term-1").len(); let (cancel, ()) = tokio::join!(fixture.service.cancel(&context, &request_id), async { fixture.terminals.set_ready("b", "term-1"); }); From d4855e566a46c3233b7cf0f5ed941fb5f6c1dc5f Mon Sep 17 00:00:00 2001 From: mubeda <1380447+mubeda@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:43:03 -0300 Subject: [PATCH 3/3] fix(ci): also rebuild portable-pty and host build scripts per seeded build The patched local portable-pty sits in the desktop graph with an unchanged version, and compiled build scripts keep their fingerprints under the host profile, so both could also be reused from another checkout. Co-Authored-By: Claude Opus 5.5 --- scripts/seeded-desktop-upgrade-smoke.test.ts | 16 ++++++++- scripts/seeded-desktop-upgrade-smoke.ts | 35 ++++++++++++-------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/scripts/seeded-desktop-upgrade-smoke.test.ts b/scripts/seeded-desktop-upgrade-smoke.test.ts index fd64044d3a..cd437c34f3 100644 --- a/scripts/seeded-desktop-upgrade-smoke.test.ts +++ b/scripts/seeded-desktop-upgrade-smoke.test.ts @@ -983,6 +983,7 @@ describe("seeded packaging build budgets", () => { const triple = seededUpgradeRustTarget(platform, arch); const bundleAtStart: Record> = {}; const fingerprintsAtStart: Record> = {}; + const hostFingerprintsAtStart: Record> = {}; // Stands in for `tauri build`: like Tauri, it adds to whatever bundle directory exists // and leaves compilation state beside it in the Cargo target it was given. const runCommand = vi.fn(async (command: Parameters[0]) => { @@ -1004,9 +1005,16 @@ describe("seeded packaging build budgets", () => { fingerprintsAtStart[build] = NodeFS.existsSync(fingerprints) ? NodeFS.readdirSync(fingerprints).toSorted() : []; - // A workspace crate and a registry dependency, as Cargo names their fingerprints. + // Local crates and a registry dependency, as Cargo names their fingerprints. write(NodePath.join(fingerprints, "bibcode-server-0a1b2c", "lib-bibcode_server"), build); write(NodePath.join(fingerprints, "serde-3d4e5f", "lib-serde"), build); + write(NodePath.join(fingerprints, "portable-pty-6a7b8c", "lib-portable_pty"), build); + const hostFingerprints = NodePath.join(target, "release", ".fingerprint"); + hostFingerprintsAtStart[build] = NodeFS.existsSync(hostFingerprints) + ? NodeFS.readdirSync(hostFingerprints).toSorted() + : []; + write(NodePath.join(hostFingerprints, "bibcode-desktop-9d0e1f", "build-script"), build); + write(NodePath.join(hostFingerprints, "serde-2c3d4e", "build-script"), build); write(NodePath.join(release, "deps", `${build}.rlib`), build); if (options.omitBundleFor !== build) { write(NodePath.join(bundle, packageName(platform)), `${build} package`); @@ -1068,6 +1076,7 @@ describe("seeded packaging build budgets", () => { ...context, bundleAtStart, fingerprintsAtStart, + hostFingerprintsAtStart, rename, sharedBundle: seededUpgradeBundleRoot(layout.cargoTargetRoot, platform, arch), staged, @@ -1284,6 +1293,11 @@ describe("seeded packaging build budgets", () => { "previous-stable": ["serde-3d4e5f"], "protected-baseline": ["serde-3d4e5f"], }); + expect(owned.hostFingerprintsAtStart).toEqual({ + candidate: [], + "previous-stable": ["serde-2c3d4e"], + "protected-baseline": ["serde-2c3d4e"], + }); }); it("stops before later builds when a build leaves no bundle to stage", async () => { diff --git a/scripts/seeded-desktop-upgrade-smoke.ts b/scripts/seeded-desktop-upgrade-smoke.ts index a5d7991836..9146d51d01 100644 --- a/scripts/seeded-desktop-upgrade-smoke.ts +++ b/scripts/seeded-desktop-upgrade-smoke.ts @@ -2170,26 +2170,33 @@ export async function prepareSeededUpgradeBuild( * The protected baseline is the candidate's source stamped with the previous-stable version, so * it shares that build's workspace crate versions, and Cargo's mtime check took previous-stable's * server as fresh and linked it into the protected build. Dropping only the workspace crates' - * fingerprints rebuilds them from this checkout while registry dependencies stay shared. + * fingerprints (and the patched portable-pty's) rebuilds them from this checkout while registry + * dependencies stay shared. */ export async function dropWorkspaceFingerprints( cargoTargetDirectory: string, platform: SeededUpgradePlatform, arch: SeededUpgradeArch, ): Promise { - const fingerprints = NodePath.join( - cargoTargetDirectory, - seededUpgradeRustTarget(platform, arch), - "release", - ".fingerprint", - ); - const entries = await NodeFS.promises.readdir(fingerprints).catch(() => []); - for (const entry of entries) { - if (/^bibcode-(server|desktop)-[0-9a-f]+$/.test(entry)) { - await NodeFS.promises.rm(NodePath.join(fingerprints, entry), { - recursive: true, - force: true, - }); + // Target units live under the triple; compiled build scripts under the host profile. + for (const fingerprints of [ + NodePath.join( + cargoTargetDirectory, + seededUpgradeRustTarget(platform, arch), + "release", + ".fingerprint", + ), + NodePath.join(cargoTargetDirectory, "release", ".fingerprint"), + ]) { + const entries = await NodeFS.promises.readdir(fingerprints).catch(() => []); + for (const entry of entries) { + // The desktop graph's local crates, including the patched portable-pty. + if (/^(bibcode-server|bibcode-desktop|portable-pty)-[0-9a-f]+$/.test(entry)) { + await NodeFS.promises.rm(NodePath.join(fingerprints, entry), { + recursive: true, + force: true, + }); + } } } }