Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/server/src/send_requests/terminal/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
});
Expand Down
5 changes: 4 additions & 1 deletion docs/operations/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions scripts/seeded-desktop-upgrade-smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
createSeededUpgradeWdioConfig,
ManagedProcessRegistry,
parseSeededDesktopUpgradeSmokeArgs,
dropWorkspaceFingerprints,
prepareSeededUpgradeBuild,
redactAndBoundUpgradeEvidence,
writeRemoteUploadCapabilityReceipt,
Expand Down Expand Up @@ -981,6 +982,8 @@ describe("seeded packaging build budgets", () => {
const layout = createSeededUpgradeRunLayout(root, "budget-fixture");
const triple = seededUpgradeRustTarget(platform, arch);
const bundleAtStart: Record<string, ReadonlyArray<string>> = {};
const fingerprintsAtStart: Record<string, ReadonlyArray<string>> = {};
const hostFingerprintsAtStart: Record<string, ReadonlyArray<string>> = {};
// 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<typeof runBoundedCommand>[0]) => {
Expand All @@ -998,6 +1001,20 @@ 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()
: [];
// 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`);
Expand Down Expand Up @@ -1029,6 +1046,7 @@ describe("seeded packaging build budgets", () => {
SeededUpgradeCommandTimeoutError,
runCommand,
prepareSeededUpgradeBuild,
dropWorkspaceFingerprints,
seededUpgradeBundleRoot,
seededUpgradeVitePlusExecutable,
seededUpgradeRustTarget,
Expand Down Expand Up @@ -1057,6 +1075,8 @@ describe("seeded packaging build budgets", () => {
return {
...context,
bundleAtStart,
fingerprintsAtStart,
hostFingerprintsAtStart,
rename,
sharedBundle: seededUpgradeBundleRoot(layout.cargoTargetRoot, platform, arch),
staged,
Expand Down Expand Up @@ -1265,6 +1285,21 @@ 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"],
});
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 () => {
const owned = fixture("linux", "x64", { omitBundleFor: "candidate" });
await expect(owned.run()).rejects.toThrow(/stage the candidate bundle/);
Expand Down
36 changes: 36 additions & 0 deletions scripts/seeded-desktop-upgrade-smoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,41 @@ 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 (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<void> {
// 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,
});
}
}
}
}

const buildPackagedApplication = async (input: {
readonly arch: SeededUpgradeArch;
readonly artifactDirectory: string;
Expand All @@ -2190,6 +2225,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,
Expand Down
Loading