Skip to content

Commit 66deb1a

Browse files
donjor-agent[bot]donjor
authored andcommitted
fix(fork-ci): fork:ci runs every app and package fork test, so a session hands off no tip they fail (#1899)
## Problem Job run 8 on #1896 pushed its tip, and the land run refused it on red candidate CI: `serverDevWatcher.fork.test.ts` failed in Test Server 3. `fork:ci` runs no product tests, so the session's local check passed and the hand-off cost a land cycle. ## Change - **`fork:ci`:** runs app and package fork tests - **Form:** one repo-root `vp test run <files>` - **Routing:** each file uses its package's config - **Desktop:** `ensure:electron` first, as CI does - **Excluded:** browser tests, `.repos/` - **Cost:** about 90 s Fork tests guard fork contracts against upstream drift, the usual sync red. The red here: upstream's new `provider-fx` package is missing from the fork's dev watch list. ## Scope and approval Found by the #1886 job proof run. Refs #1886 ## Verification - `vp test run scripts/fork-ci.test.ts` → 5/5 - `vp run fork:ci` → exit 0, 161 s - **Fork tests:** 213 files, 1,230 tests green Claude Opus 5.5 via Claude Code. ## Fork trailers Fork-Domain: fork-meta Fork-Tier: bugfix Fork-Upstreamable: no Co-authored-by: donjor <[email protected]>
1 parent 534ee07 commit 66deb1a

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

‎scripts/fork-ci.test.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,19 @@ it("fails an untagged tip through the delta check, before the scan", () => {
6969
}
7070
});
7171

72-
it("runs delta, stale-delete, fixup fold, merge-tree, scan, knip, check, typecheck, and suite in order when every step passes", () => {
72+
it("runs delta, stale-delete, fixup fold, merge-tree, scan, knip, check, typecheck, suite, and fork tests in order when every step passes", () => {
7373
const { root, head, base } = untaggedFixture();
7474
try {
75+
// Only app and package fork unit tests run; browser tests and vendored copies stay out.
76+
for (const path of [
77+
"apps/server/src/watch.fork.test.ts",
78+
"apps/web/src/save.fork.browser.test.tsx",
79+
".repos/vendor/src/copy.fork.test.ts",
80+
]) {
81+
NodeFS.mkdirSync(NodePath.dirname(NodePath.join(root, path)), { recursive: true });
82+
NodeFS.writeFileSync(NodePath.join(root, path), "");
83+
}
84+
git(root, ["add", "."]);
7585
const calls: Array<ReadonlyArray<string>> = [];
7686
const step: ForkCiStep = (command, args) => {
7787
calls.push([command, ...args]);
@@ -101,6 +111,8 @@ it("runs delta, stale-delete, fixup fold, merge-tree, scan, knip, check, typeche
101111
["vp", "check"],
102112
["vp", "run", "typecheck"],
103113
["vp", "run", "--filter", "@t3tools/scripts", "test"],
114+
["vp", "run", "--filter", "@t3tools/desktop", "ensure:electron"],
115+
["vp", "test", "run", "apps/server/src/watch.fork.test.ts"],
104116
]);
105117
} finally {
106118
NodeFS.rmSync(root, { recursive: true, force: true });

‎scripts/fork-ci.ts‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
// @effect-diagnostics nodeBuiltinImport:off - This pre-pull-request battery runs before an Effect runtime exists.
33

44
// The local pre-pull-request battery, each check as hyprws-ci.yml runs it so local green is never
5-
// greener than CI: the Fork ledger delta, stale-delete, and fixup fold checks, the merge-tree job,
6-
// the rebase scan (flags from scripts/lib/fork-ci-flags.ts), knip, read-only `vp check` (never
7-
// `--fix`), typecheck, and the whole scripts suite. Body, builds, and product tests run apart.
5+
// greener than CI; HELP lists the steps. Body, builds, browser tests, and the non-fork product
6+
// tests run apart.
87

98
import { deriveForkCiFlags, forkScanArguments, systemForkCiGit } from "./lib/fork-ci-flags.ts";
109
import { runCommand } from "./lib/fork-command.ts";
@@ -38,6 +37,8 @@ Runs what the fork's pull-request CI jobs run, in CI's own shape:
3837
outside branch scope on this trunk)
3938
9. vp run typecheck, the Check job's typecheck step
4039
10. the whole @t3tools/scripts test suite
40+
11. every app and package *.fork.test.ts(x) from the repo root, which
41+
hands each file to its package's config (browser tests excluded)
4142
4243
Stops at the first failing step. Never runs the Body job's squash-body
4344
check, nor the release or sync workflows.
@@ -140,8 +141,31 @@ export const run = (
140141
}
141142
}
142143

144+
// The fork's own contracts against upstream drift (a sync candidate's usual red), about 90 s;
145+
// desktop's tests need Electron installed first, as CI's test jobs do.
146+
const forkTests = git
147+
.run([
148+
"ls-files",
149+
"--full-name",
150+
"--",
151+
...["apps", "packages"].flatMap((dir) =>
152+
["ts", "tsx"].map((ext) => `:(top,glob)${dir}/**/*.fork.test.${ext}`),
153+
),
154+
])
155+
.split("\n")
156+
.filter((path) => path.length > 0);
157+
// An empty file list would run every test.
158+
if (
159+
forkTests.length > 0 &&
160+
(step("vp", ["run", "--filter", "@t3tools/desktop", "ensure:electron"], root) !== 0 ||
161+
step("vp", ["test", "run", ...forkTests], root) !== 0)
162+
) {
163+
process.stderr.write("fork:ci: fork tests failed; fix above before pushing\n");
164+
return 1;
165+
}
166+
143167
process.stdout.write(
144-
"fork:ci: ok; the delta check, stale-delete check, fixup fold check, merge-tree check, rebase scan, knip, vp check, typecheck, and scripts suite are green on this head\n",
168+
"fork:ci: ok; the delta check, stale-delete check, fixup fold check, merge-tree check, rebase scan, knip, vp check, typecheck, scripts suite, and fork tests are green on this head\n",
145169
);
146170
return 0;
147171
};

0 commit comments

Comments
 (0)