Skip to content

Commit 4f18a87

Browse files
donjor-agent[bot]rsi-pr-agent
authored andcommitted
fix(ci): provision browser and fold replay prerequisites (#1666)
## Problem The post-sync GitHub CI run failed because fresh runners lacked Chromium and Git identity for the disposable fixup replay, blocking nightly publication. ## Change - **Browser:** provision CI and release tests. - **Sync:** download the matching browser locally. - **Replay:** scope identity to temporary commits. - **Errors:** retain Git stderr and timeout details. The sync host keeps its existing system libraries; fresh GitHub runners install them with Chromium. ## Scope and approval The maintainer authorized repairing these CI prerequisites, landing the change, and verifying a new nightly in the T3 thread. No product behavior, runner selection, or required check is changed. ## Verification | Command | Result | | --- | --- | | `vp run --filter @t3tools/scripts test fork-fixup-fold.test.ts fork-ci-jobs.test.ts` | exit 0; 13 tests | | `vp run --filter @t3tools/scripts typecheck` | exit 0 | | `vp run fork:ci` | exit 0; 63 script files, 761 tests | | `vp run build:desktop` | exit 0 | | Chromium download via derived `vp exec` command | exit 0 | Regressions cover absent Git identity, unchanged live HEAD/config, cleanup, diagnostic preservation, and sync battery setup ordering. GitHub CI and nightly publication remain pending. Model: GPT-6.1 Sol. Harness: Pi. ## Fork trailers Squashes: - 6e4bdd4 fix(ci): provision browser and fold replay prerequisites (#1666) (#1666) - 43f40d1 fixup! fix(ci): provision browser and fold replay prerequisites (#1666) (#1666) Fork-Domain: fork-meta Fork-Tier: bugfix Fork-Upstreamable: no
1 parent 85cd0f8 commit 4f18a87

6 files changed

Lines changed: 136 additions & 6 deletions

File tree

‎.github/workflows/hyprws-ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ jobs:
257257
run: node apps/web/node_modules/playwright/cli.js install --with-deps --only-shell chromium
258258

259259
- name: Test
260+
# Upstream's release-link tests assume `GITHUB_REPOSITORY` names upstream.
261+
env:
262+
T3CODE_DESKTOP_UPDATE_REPOSITORY: pingdotgg/t3code
260263
run: vp run --filter @t3tools/web test --testTimeout=60000
261264

262265
# The fork's scripts suite is large and does not shrink with the
@@ -325,5 +328,8 @@ jobs:
325328
cache: true
326329
run-install: true
327330

331+
- name: Install Chromium for server browser integration tests
332+
run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
333+
328334
- name: Test
329335
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}

‎.github/workflows/hyprws-release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ jobs:
482482
cache: true
483483
run-install: true
484484

485+
- name: Install Chromium for server browser integration tests
486+
run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
487+
485488
- name: Test
486489
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
487490

‎scripts/fork-fixup-fold.test.ts‎

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import * as NodeChildProcess from "node:child_process";
44
import * as NodeFS from "node:fs";
55
import * as NodeOS from "node:os";
66

7-
import { assert, it } from "@effect/vitest";
7+
import { assert, it, vi } from "@effect/vitest";
88

9+
import * as ForkCommand from "./lib/fork-command.ts";
910
import { fixupFoldFailures } from "./fork-fixup-fold.ts";
1011

1112
const git = (root: string, args: ReadonlyArray<string>): string =>
@@ -48,6 +49,85 @@ it("passes a stack whose fixups fold at their owners, squash suffix included", (
4849
}
4950
});
5051

52+
it("folds without configured Git identity and leaves the live repository unchanged", () => {
53+
const root = NodeFS.mkdtempSync(NodeOS.tmpdir() + "/fork-fixup-fold-");
54+
try {
55+
git(root, ["init", "--quiet", "--initial-branch", "main"]);
56+
identity(root);
57+
commit(root, "upstream base", { "file.txt": "one\ntwo\n" });
58+
const base = git(root, ["rev-parse", "HEAD"]);
59+
commit(root, "owner edit", { "file.txt": "ONE\ntwo\n" });
60+
commit(root, "fixup! owner edit", { "file.txt": "ONE!\ntwo\n" });
61+
const tip = git(root, ["rev-parse", "HEAD"]);
62+
// Empty local values mask any ambient global identity, like a clean CI runner.
63+
git(root, ["config", "user.name", ""]);
64+
git(root, ["config", "user.email", ""]);
65+
assert.deepStrictEqual(fixupFoldFailures(root, base, "HEAD"), []);
66+
assert.strictEqual(git(root, ["rev-parse", "HEAD"]), tip);
67+
assert.strictEqual(git(root, ["config", "user.name"]), "");
68+
assert.strictEqual(git(root, ["config", "user.email"]), "");
69+
assert.strictEqual(worktreeCount(root), 1);
70+
} finally {
71+
NodeFS.rmSync(root, { recursive: true, force: true });
72+
}
73+
});
74+
75+
it("reports Git's error when the replay fails before applying a commit", () => {
76+
const root = NodeFS.mkdtempSync(NodeOS.tmpdir() + "/fork-fixup-fold-");
77+
try {
78+
git(root, ["init", "--quiet", "--initial-branch", "main"]);
79+
identity(root);
80+
commit(root, "upstream base", { "file.txt": "one\n" });
81+
const base = git(root, ["rev-parse", "HEAD"]);
82+
commit(root, "owner edit", { "file.txt": "ONE\n" });
83+
commit(root, "fixup! owner edit", { "file.txt": "ONE!\n" });
84+
const hooks = `${root}/hooks`;
85+
NodeFS.mkdirSync(hooks);
86+
NodeFS.writeFileSync(
87+
`${hooks}/pre-rebase`,
88+
"#!/bin/sh\necho 'fixture refuses replay' >&2\nexit 1\n",
89+
{ mode: 0o755 },
90+
);
91+
git(root, ["config", "core.hooksPath", hooks]);
92+
const [failure] = fixupFoldFailures(root, base, "HEAD");
93+
assert.ok(failure?.includes("the replay failed before applying a commit"), failure);
94+
assert.ok(failure?.includes("fixture refuses replay"), failure);
95+
assert.strictEqual(worktreeCount(root), 1);
96+
} finally {
97+
NodeFS.rmSync(root, { recursive: true, force: true });
98+
}
99+
});
100+
101+
it("keeps both Git stderr and a subprocess timeout error", () => {
102+
const root = NodeFS.mkdtempSync(NodeOS.tmpdir() + "/fork-fixup-fold-");
103+
try {
104+
git(root, ["init", "--quiet", "--initial-branch", "main"]);
105+
identity(root);
106+
commit(root, "upstream base", { "file.txt": "one\n" });
107+
const base = git(root, ["rev-parse", "HEAD"]);
108+
commit(root, "owner edit", { "file.txt": "ONE\n" });
109+
commit(root, "fixup! owner edit", { "file.txt": "ONE!\n" });
110+
const runCommand = ForkCommand.runCommand;
111+
vi.spyOn(ForkCommand, "runCommand").mockImplementation((command, args, options) =>
112+
command === "git" && args.includes("rebase") && args.includes("-i")
113+
? {
114+
status: 1,
115+
stdout: "",
116+
stderr: "replay progress",
117+
error: new Error("spawnSync git ETIMEDOUT"),
118+
}
119+
: runCommand(command, args, options),
120+
);
121+
const [failure] = fixupFoldFailures(root, base, "HEAD");
122+
assert.ok(failure?.includes("replay progress"), failure);
123+
assert.ok(failure?.includes("spawnSync git ETIMEDOUT"), failure);
124+
assert.strictEqual(worktreeCount(root), 1);
125+
} finally {
126+
vi.restoreAllMocks();
127+
NodeFS.rmSync(root, { recursive: true, force: true });
128+
}
129+
});
130+
51131
it("refuses a fixup that only folds at the tip, naming fixup and owner", () => {
52132
const root = NodeFS.mkdtempSync(NodeOS.tmpdir() + "/fork-fixup-fold-");
53133
try {

‎scripts/fork-fixup-fold.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ export const fixupFoldFailures = (
9999
cwd: worktree,
100100
env: {
101101
...process.env,
102+
// Only the discarded replay commits need an identity; preserve the original authors.
103+
GIT_COMMITTER_NAME: "Fork Fixup Fold",
104+
GIT_COMMITTER_EMAIL: "[email protected]",
102105
GIT_EDITOR: "true",
103106
GIT_SEQUENCE_EDITOR: sequenceEditor(),
104107
[FIXUP_OWNERS_ENV]: JSON.stringify(fixups.owners),
@@ -108,11 +111,14 @@ export const fixupFoldFailures = (
108111
const stopped = replay.runResult(["rev-parse", "--verify", "REBASE_HEAD"]);
109112
const stoppedSha = stopped.status === 0 ? stopped.stdout.trim() : "";
110113
const pair = fixups.owners.find(([fixup]) => stoppedSha.startsWith(fixup));
111-
return pair === undefined
112-
? [`the replay stopped at ${name(stoppedSha)}`]
113-
: [
114-
`fixup "${subjectOf(pair[0])}" (${shortSha(pair[0])}) does not fold into its owner "${subjectOf(pair[1])}" (${shortSha(pair[1])}): the replay stopped applying it there`,
115-
];
114+
const reason =
115+
pair === undefined
116+
? stoppedSha === ""
117+
? "the replay failed before applying a commit"
118+
: `the replay stopped at ${name(stoppedSha)}`
119+
: `fixup "${subjectOf(pair[0])}" (${shortSha(pair[0])}) does not fold into its owner "${subjectOf(pair[1])}" (${shortSha(pair[1])}): the replay stopped applying it there`;
120+
const detail = [result.stderr.trim(), result.error?.message].filter(Boolean).join("\n");
121+
return [detail === "" ? reason : `${reason}\n${detail}`];
116122
}
117123
const replayedTree = replay.run(["rev-parse", "HEAD^{tree}"]).trim();
118124
const tipTree = git.run(["rev-parse", `${head}^{tree}`]).trim();

‎scripts/lib/fork-ci-jobs.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,27 @@ it("keeps every vp step in order, skips provisioning, and reads vpr as vp run",
5353
});
5454
});
5555

56+
it("downloads the server browser without reinstalling runner-only system libraries", () => {
57+
const [job] = deriveCiTestJobs(
58+
workflow(` test_server:
59+
steps:
60+
- run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
61+
- run: vp run --filter t3 test
62+
`),
63+
);
64+
assert.deepStrictEqual(job?.commands, [
65+
[
66+
"exec",
67+
"node",
68+
"apps/server/node_modules/playwright-core/cli.js",
69+
"install",
70+
"--only-shell",
71+
"chromium",
72+
],
73+
["run", "--filter", "t3", "test"],
74+
]);
75+
});
76+
5677
it("refuses a test job step it cannot run exactly", () => {
5778
const derive = (step: string) => () =>
5879
deriveCiTestJobs(workflow(` test:\n name: Test\n steps:\n - run: ${step}\n`));

‎scripts/lib/fork-ci-jobs.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ const stepCommand = (jobId: string, run: string): ReadonlyArray<string> | null =
112112
.map((line) => line.trim())
113113
.filter(Boolean);
114114
if (lines.every((line) => PROVISIONING_LINE.test(line))) return null;
115+
// The sync host already carries system libraries, but needs the matching browser download.
116+
if (
117+
lines.length === 1 &&
118+
lines[0] ===
119+
"node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium"
120+
)
121+
return [
122+
"exec",
123+
"node",
124+
"apps/server/node_modules/playwright-core/cli.js",
125+
"install",
126+
"--only-shell",
127+
"chromium",
128+
];
115129
const words = lines.length === 1 ? shellWords(lines[0]!) : [];
116130
if (words[0] === "vp") return words.slice(1);
117131
if (words[0] === "vpr") return ["run", ...words.slice(1)];

0 commit comments

Comments
 (0)