Skip to content

Commit acb154c

Browse files
committed
merge: reconcile turn-start index with upstream migration 068
2 parents 79adb8e + 5127302 commit acb154c

727 files changed

Lines changed: 57531 additions & 36960 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.devcontainer/devcontainer.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Dev container for T3 Code. Mirrors CI (ubuntu-24.04, Node 24, Rust stable)
1+
// Dev container for T3 Code. Mirrors CI (ubuntu-24.04, Node 26, Rust stable)
22
// and the canonical setup in docs/operations/development.md: global `vp`, `vp i`.
33
// Contributor doc: docs/internals/devcontainer.md
44
{
@@ -8,7 +8,7 @@
88
// nodeGypDependencies (default true) brings python3/make/g++, which Linux
99
// needs for node-pty's node-gyp fallback (its prebuilds are mac/win only).
1010
"ghcr.io/devcontainers/features/node:2": {
11-
"version": "24"
11+
"version": "26"
1212
},
1313
// native/resource-monitor (edition 2024, needs stable >= 1.85). The server
1414
// degrades gracefully without the binary, but CI checks cargo fmt + test.

‎.github/actions/setup-ci-deps/action.yml‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,38 @@ description: Install Vite+ and the workspace dependencies from cache.
33
runs:
44
using: composite
55
steps:
6-
# setup-vp reuses an installed exact version, so restoring its home skips the
7-
# installer download on every job.
6+
# ~/.vite-plus holds vp, the Node.js runtime, and pnpm. A cache entry never
7+
# updates, so the key names all three versions; otherwise a pnpm or Node.js
8+
# bump makes every job download them from npm again.
89
- name: Resolve Vite+ version
910
id: vp
1011
shell: bash
1112
run: |
1213
echo "version=$(sed -nE 's/^ vite-plus: ([0-9][^ ]*)$/\1/p' pnpm-workspace.yaml)" >> "$GITHUB_OUTPUT"
14+
echo "node=$(jq -r '.engines.node' package.json)" >> "$GITHUB_OUTPUT"
15+
echo "pnpm=$(jq -r '.packageManager' package.json)" >> "$GITHUB_OUTPUT"
1316
1417
- name: Cache Vite+
18+
id: vp_cache
1519
if: steps.vp.outputs.version != ''
1620
uses: actions/cache@v6
1721
with:
1822
path: ~/.vite-plus
19-
key: vite-plus-home-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.vp.outputs.version }}
23+
key: vite-plus-home-v2-${{ runner.os }}-${{ runner.arch }}-${{ steps.vp.outputs.version }}-node${{ steps.vp.outputs.node }}-${{ steps.vp.outputs.pnpm }}
24+
25+
# setup-vp always runs the installer, which fetches vp from npm even when
26+
# this exact version is installed. A cache hit already has everything, so
27+
# skip setup-vp and do its remaining work here. This keeps npm outages from
28+
# failing jobs.
29+
- name: Use cached Vite+
30+
if: steps.vp_cache.outputs.cache-hit == 'true'
31+
shell: bash
32+
run: |
33+
echo "$HOME/.vite-plus/bin" >> "$GITHUB_PATH"
34+
"$HOME/.vite-plus/bin/vp" env use "${{ steps.vp.outputs.node }}"
2035
2136
- name: Setup Vite+
37+
if: steps.vp_cache.outputs.cache-hit != 'true'
2238
uses: voidzero-dev/setup-vp@v1
2339
with:
2440
node-version-file: package.json

‎.github/scripts/ci-changes.cjs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// node ci-changes.cjs --paths <file> --full run every Linux job, gate only the macOS lint
66
// node ci-changes.cjs changed paths unknown: run everything
77
//
8+
// scripts/check-changed.ts requires the same decisions so local runs match CI.
9+
//
810
// Every changed path maps to workspace packages, which then pull in their
911
// dependents from package.json. A path this file does not recognize runs
1012
// everything, so a new root file or directory can only cost minutes.
@@ -201,4 +203,6 @@ function main() {
201203
for (const [key, value] of Object.entries(outputs)) console.log(`${key}=${value}`);
202204
}
203205

204-
main();
206+
module.exports = { readWorkspace, decide };
207+
208+
if (require.main === module) main();

‎.github/scripts/ci-changes.d.cts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
interface WorkspacePackage {
2+
readonly name: string;
3+
readonly dir: string;
4+
readonly hasTest: boolean;
5+
readonly deps: ReadonlyArray<string>;
6+
}
7+
8+
export function readWorkspace(): Array<WorkspacePackage>;
9+
10+
export function decide(
11+
files: ReadonlyArray<string> | null,
12+
packages: ReadonlyArray<WorkspacePackage>,
13+
full: boolean,
14+
): {
15+
affected: Array<string>;
16+
outputs: {
17+
typecheck: boolean;
18+
build: boolean;
19+
test: boolean;
20+
test_packages: string;
21+
test_web: boolean;
22+
test_server: boolean;
23+
rust: boolean;
24+
release_smoke: boolean;
25+
mobile_native: boolean;
26+
};
27+
};
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
const assert = require("node:assert/strict");
2+
const { spawnSync } = require("node:child_process");
3+
const { mkdtempSync, readFileSync, rmSync, existsSync } = require("node:fs");
4+
const { tmpdir } = require("node:os");
5+
const { join } = require("node:path");
6+
const { test } = require("node:test");
7+
8+
const release = readFileSync(join(__dirname, "../workflows/release.yml"), "utf8");
9+
const preview = readFileSync(join(__dirname, "../workflows/web-preview.yml"), "utf8");
10+
const stepPattern =
11+
/ name: (?:Build staged deployment|Deploy preview)\n shell: bash\n run: \|\n((?: .*\n|\n)+)/g;
12+
const steps = [
13+
...Array.from(release.matchAll(stepPattern), (match, index) => [
14+
index === 0 ? "hosted web" : "marketing",
15+
match[1],
16+
]),
17+
...Array.from(preview.matchAll(stepPattern), (match) => ["web preview", match[1]]),
18+
];
19+
assert.equal(steps.length, 3, "Expected both release steps and the preview step");
20+
21+
const url = "https://t3code-fixture-pinglabs.vercel.app";
22+
const warning = 'Error while parsing config file: "/runner/t3code/pnpm-lock.yaml"';
23+
24+
function runStep(script, stdout, exitCode = 0) {
25+
const directory = mkdtempSync(join(tmpdir(), "t3-vercel-output-"));
26+
const outputFile = join(directory, "output");
27+
try {
28+
const result = spawnSync(
29+
"bash",
30+
[
31+
"-c",
32+
'vp() { printf "%s\\n" "$FIXTURE_STDOUT"; return "$FIXTURE_EXIT"; }\n' +
33+
'curl() { printf \'{"id":"fixture-project"}\\n\'; }\n' +
34+
script.replace(/^ /gm, "").replace(/\$\{\{.*?\}\}/g, "fixture"),
35+
],
36+
{
37+
encoding: "utf8",
38+
env: {
39+
PATH: process.env.PATH,
40+
VERCEL_TOKEN: "fixture-token",
41+
VERCEL_ORG_ID: "fixture-org",
42+
VERCEL_PROJECT_ID: "fixture-project",
43+
GITHUB_OUTPUT: outputFile,
44+
FIXTURE_STDOUT: stdout,
45+
FIXTURE_EXIT: String(exitCode),
46+
},
47+
},
48+
);
49+
assert.ifError(result.error);
50+
return {
51+
...result,
52+
output: existsSync(outputFile) ? readFileSync(outputFile, "utf8") : "",
53+
};
54+
} finally {
55+
rmSync(directory, { recursive: true, force: true });
56+
}
57+
}
58+
59+
for (const [name, script] of steps) {
60+
for (const [label, stdout] of [
61+
["plain URL", url],
62+
["lockfile warning", `${warning}\n${url}`],
63+
["trailing diagnostic", `${url}\nDone`],
64+
]) {
65+
test(`${name}: saves one deployment URL after ${label}`, () => {
66+
const result = runStep(script, stdout);
67+
assert.equal(result.status, 0, result.stderr);
68+
assert.deepEqual(
69+
result.output.split("\n").filter((line) => !line.startsWith("project_id=")),
70+
[`deployment_url=${url}`, ""],
71+
);
72+
});
73+
}
74+
75+
for (const [label, stdout, exitCode] of [
76+
["missing URL", warning, 0],
77+
["invalid URL", "https://example.invalid/deployment", 0],
78+
["multiple URLs", `${url}\nhttps://other.vercel.app`, 0],
79+
["failed deployment", url, 1],
80+
]) {
81+
test(`${name}: rejects ${label} without saving output`, () => {
82+
const result = runStep(script, stdout, exitCode);
83+
assert.notEqual(result.status, 0);
84+
assert.equal(result.output, "");
85+
});
86+
}
87+
}

‎.github/workflows/ci.yml‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ jobs:
8383
- name: Setup Vite+
8484
uses: ./.github/actions/setup-ci-deps
8585

86+
# electron's install.js (run by ensure:electron) reads this cache before it
87+
# downloads from GitHub. The key changes only with the Electron version.
88+
- name: Cache Electron download
89+
uses: actions/cache@v6
90+
with:
91+
path: ~/.cache/electron
92+
key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
93+
8694
- name: Ensure Electron runtime is installed
8795
run: vp run --filter @t3tools/desktop ensure:electron
8896

@@ -132,6 +140,14 @@ jobs:
132140
- name: Setup Vite+
133141
uses: ./.github/actions/setup-ci-deps
134142

143+
# electron's install.js (run by ensure:electron) reads this cache before it
144+
# downloads from GitHub. The key changes only with the Electron version.
145+
- name: Cache Electron download
146+
uses: actions/cache@v6
147+
with:
148+
path: ~/.cache/electron
149+
key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
150+
135151
- name: Ensure Electron runtime is installed
136152
id: electron
137153
run: vp run --filter @t3tools/desktop ensure:electron
@@ -222,14 +238,22 @@ jobs:
222238
- name: Setup Vite+
223239
uses: ./.github/actions/setup-ci-deps
224240

241+
# electron's install.js (run by ensure:electron) reads this cache before it
242+
# downloads from GitHub. The key changes only with the Electron version.
243+
- name: Cache Electron download
244+
uses: actions/cache@v6
245+
with:
246+
path: ~/.cache/electron
247+
key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/.pnpm/electron@*/node_modules/electron/package.json') }}
248+
225249
- name: Ensure Electron runtime is installed
226250
run: vp run --filter @t3tools/desktop ensure:electron
227251

228252
- name: Test preview artifact validation
229253
run: python3 -B .github/scripts/stage-preview-bundle.test.py
230254

231255
- name: Test release checks
232-
run: node --test .github/scripts/check-nightly-release.test.cjs
256+
run: node --test .github/scripts/check-nightly-release.test.cjs .github/scripts/vercel-deployment-output.test.cjs
233257

234258
- name: Finish installing browser secret helper build libraries
235259
timeout-minutes: 5

‎.github/workflows/mobile-showcase-screenshots.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ env:
4343

4444
jobs:
4545
ios:
46-
name: iPhone 6.9, iPhone 6.5, and iPad 13
46+
name: iPhone, iPhone Duo, and iPad 13
4747
if: inputs.platform == 'all' || inputs.platform == 'ios'
4848
runs-on: blacksmith-12vcpu-macos-26
4949
# Capturing every palette multiplies the device matrix by six, and only the
@@ -87,6 +87,9 @@ jobs:
8787
brew install cameroncooke/axe/axe
8888
axe --version
8989
90+
- name: Install foldable simulator controls
91+
run: npm install --global [email protected]
92+
9093
- name: Capture iOS showcase
9194
run: pnpm screenshots:mobile --platform ios --appearance "${{ inputs.appearance }}" --theme "${{ inputs.theme }}"
9295

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,13 @@ jobs:
253253
if [[ "${{ inputs.version }}" =~ -nightly\.[0-9]{8}\.[0-9]+$ ]]; then brand=nightly; fi
254254
node scripts/apply-web-brand-assets.ts "$brand" apps/server/dist/client
255255
256-
# The single-executable is built with a Node that supports --build-sea
257-
# (25.7+); the repo itself stays on the engines.node version. A native
258-
# build injects into the runner's own Node; a Windows target downloads its
259-
# node.exe.
256+
# Setup Vite+ selects the exact engines.node version from package.json.
257+
# Native builds embed that executable; cross-target builds download the
258+
# same version for their target.
260259
- name: Build CLI single-executable
261260
if: inputs.cli_archive
262261
shell: bash
263262
env:
264-
# The exact version, not a major: vp downloads it from nodejs.org/dist on
265-
# the runner, and only exact versions have a dist directory. Keep in
266-
# step with SEA_NODE_VERSION in apps/server/vite.config.ts.
267-
VP_NODE_VERSION: "26.8.2"
268263
# The executable bundles the server again, so it needs the same stamp
269264
# as release.yml's JS bundle.
270265
T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && inputs.release_channel || 'dev' }}

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ jobs:
10721072
fi
10731073
10741074
echo "Building hosted web app for $channel_name channel."
1075-
deployment_url="$(
1075+
deployment_output="$(
10761076
vp dlx [email protected] deploy \
10771077
--archive=tgz \
10781078
--prod \
@@ -1091,6 +1091,13 @@ jobs:
10911091
--build-env "VITE_HOSTED_APP_URL=$router_url" \
10921092
--build-env "VITE_HOSTED_APP_CHANNEL=$channel_name"
10931093
)"
1094+
printf '%s\n' "$deployment_output"
1095+
# Vercel can print lockfile warnings to stdout before the deployment URL.
1096+
deployment_url="$(printf '%s\n' "$deployment_output" | grep -E '^https://[[:alnum:].-]+\.vercel\.app$')"
1097+
if [[ "$deployment_url" == *$'\n'* ]]; then
1098+
echo "Vercel returned multiple deployment URLs." >&2
1099+
exit 1
1100+
fi
10941101
echo "Staged $deployment_url."
10951102
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
10961103
@@ -1219,7 +1226,7 @@ jobs:
12191226
)"
12201227
export VERCEL_PROJECT_ID
12211228
1222-
deployment_url="$(
1229+
deployment_output="$(
12231230
vp dlx [email protected] deploy \
12241231
--archive=tgz \
12251232
--prod \
@@ -1228,6 +1235,13 @@ jobs:
12281235
--token "$VERCEL_TOKEN" \
12291236
--scope "${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
12301237
)"
1238+
printf '%s\n' "$deployment_output"
1239+
# Vercel can print lockfile warnings to stdout before the deployment URL.
1240+
deployment_url="$(printf '%s\n' "$deployment_output" | grep -E '^https://[[:alnum:].-]+\.vercel\.app$')"
1241+
if [[ "$deployment_url" == *$'\n'* ]]; then
1242+
echo "Vercel returned multiple deployment URLs." >&2
1243+
exit 1
1244+
fi
12311245
echo "Staged $deployment_url."
12321246
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"
12331247
echo "project_id=$VERCEL_PROJECT_ID" >> "$GITHUB_OUTPUT"

‎.github/workflows/web-preview.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,20 @@ jobs:
7777
7878
vercel_scope="${VERCEL_TEAM_SLUG:-$VERCEL_ORG_ID}"
7979
80-
deployment_url="$(
80+
deployment_output="$(
8181
vp dlx [email protected] deploy \
8282
--archive=tgz \
8383
--yes \
8484
--token "$VERCEL_TOKEN" \
8585
--scope "$vercel_scope"
8686
)"
87+
printf '%s\n' "$deployment_output"
88+
# Vercel can print lockfile warnings to stdout before the deployment URL.
89+
deployment_url="$(printf '%s\n' "$deployment_output" | grep -E '^https://[[:alnum:].-]+\.vercel\.app$')"
90+
if [[ "$deployment_url" == *$'\n'* ]]; then
91+
echo "Vercel returned multiple deployment URLs." >&2
92+
exit 1
93+
fi
8794
8895
echo "Deployed $deployment_url"
8996
echo "deployment_url=$deployment_url" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)