Skip to content

Commit 660d3c6

Browse files
Kron00claude
andcommitted
Merge main c728c8c into feat/send-later
Take main's second-pass test pruning and keep the branch's mobile release label test. #22581's shared cancelIdleOrphans treats any queued child run as busy, so scheduled and held follow-ups are not cancelled as orphans. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 parents 72abd7e + c728c8c commit 660d3c6

647 files changed

Lines changed: 4962 additions & 28276 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.

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

Lines changed: 15 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ on:
9999
required: true
100100
type: string
101101

102+
# electron-builder leaves the default arch (x64) out of the unpacked app's
103+
# directory name.
104+
env:
105+
UNPACKED_DIR: ${{ inputs.platform }}-${{ inputs.arch != 'x64' && format('{0}-', inputs.arch) || '' }}unpacked
106+
102107
permissions:
103108
# Windows builds read this run's artifact list to wait for the Linux CLI archive.
104109
actions: read
@@ -136,17 +141,11 @@ jobs:
136141
git sparse-checkout set --no-cone '/*' '!/.repos/'
137142
git -c checkout.workers=0 checkout --detach FETCH_HEAD
138143
139-
# Windows installs straight from the registry. There, linking the packages
140-
# takes the time, not downloading them, so a ~700 MB package cache did not
141-
# pay for its own restore. Across recent nightlies, restore plus install
142-
# took 183-233s on arm64 and 116-172s on x64, while a plain install took
143-
# 142-210s and 84-160s. The arm64 entries also filled 4 GB of the
144-
# repository's 10 GB Actions cache.
145144
- name: Setup Vite+
146145
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
147146
with:
148147
node-version-file: package.json
149-
cache: ${{ runner.os != 'Windows' }}
148+
cache: true
150149
run-install: false
151150

152151
# pnpm checks the lockfile and policy before reusing this result. A missing
@@ -215,28 +214,8 @@ jobs:
215214
name: js-bundle
216215
path: apps
217216

218-
# Only the resource monitor build needs these libraries. With a cached
219-
# monitor, the desktop build's preflight skips its MSVC check, and node-pty
220-
# ships prebuilt Windows binaries, so the 30-60s install is skipped too.
221-
- name: Install Spectre-mitigated MSVC libs
222-
if: runner.os == 'Windows' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
223-
shell: pwsh
224-
run: |
225-
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
226-
$installPath = & $vswhere -products * -latest -property installationPath
227-
$setupExe = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
228-
$proc = Start-Process -FilePath $setupExe `
229-
-ArgumentList "modify", "--installPath", "`"$installPath`"", "--add", `
230-
"Microsoft.VisualStudio.Component.VC.Runtimes.${{ inputs.arch == 'arm64' && 'ARM64' || 'x86.x64' }}.Spectre", "--quiet", "--norestart" `
231-
-Wait -PassThru -NoNewWindow
232-
if ($null -eq $proc -or $proc.ExitCode -ne 0) {
233-
$code = if ($null -ne $proc) { $proc.ExitCode } else { 1 }
234-
Write-Error "Visual Studio Installer failed with exit code $code"
235-
exit $code
236-
}
237-
238217
- name: Install cargo-xwin
239-
if: runner.os != 'Windows' && inputs.platform == 'win' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
218+
if: inputs.platform == 'win' && steps.resource_monitor_cache.outputs.cache-hit != 'true'
240219
uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2
241220
with:
242221
@@ -246,74 +225,12 @@ jobs:
246225
- name: Build resource monitor
247226
if: steps.resource_monitor_cache.outputs.cache-hit != 'true'
248227
shell: bash
249-
run: cargo ${{ runner.os != 'Windows' && inputs.platform == 'win' && 'xwin build' || 'build' }} --locked --release --manifest-path native/resource-monitor/Cargo.toml --target "${{ inputs.rust_target }}"
250-
251-
- name: Prepare Azure Trusted Signing
252-
if: inputs.platform == 'win' && runner.os == 'Windows'
253-
shell: pwsh
254-
env:
255-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
256-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
257-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
258-
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
259-
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
260-
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
261-
AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
262-
run: |
263-
$ErrorActionPreference = "Stop"
264-
265-
$requiredSecrets = @(
266-
$env:AZURE_TENANT_ID,
267-
$env:AZURE_CLIENT_ID,
268-
$env:AZURE_CLIENT_SECRET,
269-
$env:AZURE_TRUSTED_SIGNING_ENDPOINT,
270-
$env:AZURE_TRUSTED_SIGNING_ACCOUNT_NAME,
271-
$env:AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME,
272-
$env:AZURE_TRUSTED_SIGNING_PUBLISHER_NAME
273-
)
274-
if ($requiredSecrets | Where-Object { [string]::IsNullOrWhiteSpace($_) }) {
275-
Write-Host "Azure Trusted Signing disabled; skipping TrustedSigning module preparation."
276-
exit 0
277-
}
278-
279-
try {
280-
Install-PackageProvider `
281-
-Name NuGet `
282-
-MinimumVersion 2.8.5.201 `
283-
-Force `
284-
-Scope CurrentUser `
285-
-ErrorAction Stop
286-
} catch {
287-
Write-Warning "Could not bootstrap NuGet package provider. Continuing because the runner may already have a usable provider. $($_.Exception.Message)"
288-
}
289-
290-
Install-Module `
291-
-Name TrustedSigning `
292-
-MinimumVersion 0.5.0 `
293-
-Force `
294-
-AllowClobber `
295-
-Repository PSGallery `
296-
-Scope CurrentUser `
297-
-ErrorAction Stop
298-
299-
Import-Module TrustedSigning -MinimumVersion 0.5.0 -Force
300-
Get-Command Invoke-TrustedSigning -ErrorAction Stop
301-
302-
$moduleRoots = @(
303-
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "PowerShell", "Modules"),
304-
[System.IO.Path]::Combine([Environment]::GetFolderPath("MyDocuments"), "WindowsPowerShell", "Modules"),
305-
[System.IO.Path]::Combine($env:ProgramFiles, "PowerShell", "Modules"),
306-
[System.IO.Path]::Combine($env:ProgramFiles, "WindowsPowerShell", "Modules")
307-
)
308-
$modulePathEntries = @($moduleRoots + ($env:PSModulePath -split ";")) |
309-
Where-Object { $_ -and (Test-Path $_) } |
310-
Select-Object -Unique
311-
"PSModulePath=$($modulePathEntries -join ';')" >> $env:GITHUB_ENV
228+
run: cargo ${{ inputs.platform == 'win' && 'xwin build' || 'build' }} --locked --release --manifest-path native/resource-monitor/Cargo.toml --target "${{ inputs.rust_target }}"
312229

313230
# Off Windows, scripts/lib/windows-jsign.ts signs through jsign instead of
314231
# the TrustedSigning PowerShell module.
315232
- name: Install jsign
316-
if: inputs.platform == 'win' && runner.os != 'Windows'
233+
if: inputs.platform == 'win'
317234
shell: bash
318235
run: |
319236
set -euo pipefail
@@ -338,9 +255,8 @@ jobs:
338255
339256
# The single-executable is built with a Node that supports --build-sea
340257
# (25.7+); the repo itself stays on the engines.node version. A native
341-
# build injects into the runner's own Node: tsdown's cross-target download
342-
# path runs `tar` on a drive-letter path on Windows, which GNU tar reads as
343-
# a remote host. Off Windows, a Windows target downloads its node.exe.
258+
# build injects into the runner's own Node; a Windows target downloads its
259+
# node.exe.
344260
- name: Build CLI single-executable
345261
if: inputs.cli_archive
346262
shell: bash
@@ -352,7 +268,7 @@ jobs:
352268
# The executable bundles the server again, so it needs the same stamp
353269
# as release.yml's JS bundle.
354270
T3CODE_TELEMETRY_CHANNEL: ${{ github.repository == 'pingdotgg/t3code' && inputs.release_channel || 'dev' }}
355-
run: node apps/server/scripts/cli.ts build-exe --verbose ${{ runner.os != 'Windows' && inputs.platform == 'win' && format('--target win-{0}', inputs.arch) || '' }}
271+
run: node apps/server/scripts/cli.ts build-exe --verbose ${{ inputs.platform == 'win' && format('--target win-{0}', inputs.arch) || '' }}
356272

357273
- name: Import macOS signing certificate for the CLI archive
358274
if: inputs.cli_archive && inputs.platform == 'mac'
@@ -614,7 +530,7 @@ jobs:
614530
run: |
615531
set -euo pipefail
616532
mkdir -p verify
617-
unpacked=$(ls -d "${TMPDIR:-/tmp}"/t3code-desktop-${{ inputs.platform }}-stage-*/app/dist/${{ inputs.platform }}-${{ inputs.arch }}-unpacked)
533+
unpacked=$(ls -d "${TMPDIR:-/tmp}"/t3code-desktop-${{ inputs.platform }}-stage-*/app/dist/"$UNPACKED_DIR")
618534
tar -C "$(dirname "$unpacked")" -cf verify/unpacked.tar "$(basename "$unpacked")"
619535
esbuild=scripts/node_modules/.bin/esbuild
620536
banner="import{createRequire as __cr}from'node:module';const require=__cr(import.meta.url);"
@@ -734,7 +650,7 @@ jobs:
734650
set -euo pipefail
735651
tar -C verify -xf verify/unpacked.tar
736652
node verify/verify-windows-desktop-artifact.mjs \
737-
--app-dir "$(cygpath -w "$PWD/verify/${{ inputs.platform }}-${{ inputs.arch }}-unpacked")" \
653+
--app-dir "$(cygpath -w "$PWD/verify/$UNPACKED_DIR")" \
738654
--arch "${{ inputs.arch }}" --build-version "${{ inputs.version }}" --verbose
739655
740656
- name: Smoke-test CLI archive
@@ -749,7 +665,7 @@ jobs:
749665
- name: Smoke-test resource monitor
750666
shell: bash
751667
env:
752-
MONITOR: verify/${{ inputs.platform }}-${{ inputs.arch }}-unpacked/resources/resource-monitor/t3-resource-monitor.exe
668+
MONITOR: verify/${{ env.UNPACKED_DIR }}/resources/resource-monitor/t3-resource-monitor.exe
753669
EXPECTED_ARCH: ${{ inputs.arch == 'arm64' && 'aarch64' || 'x86_64' }}
754670
run: |
755671
node --input-type=module <<'EOF'

‎.github/workflows/release.yml‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ jobs:
573573
if-no-files-found: error
574574
retention-days: 1
575575

576-
# One job per platform and architecture (see release-desktop.yml), each on
577-
# hardware of its own architecture, and each gated only on the JS bundle.
576+
# One job per platform and architecture (see release-desktop.yml), each
577+
# gated only on the JS bundle. Windows targets build on Linux and run their
578+
# native checks on a Windows runner of their own architecture.
578579
# The Windows jobs also embed the same-arch Linux CLI archive as the WSL
579580
# runtime; they wait for that artifact partway through instead of for the
580581
# whole Linux job. Every job builds the desktop app; all but macOS x64 also
@@ -677,9 +678,11 @@ jobs:
677678
resource_key: linux-arm64
678679
cli_archive: true
679680

680-
# The Windows jobs start with the other platforms. Their checkout, install,
681-
# and toolchain setup take longer than the same-arch Linux job needs to
682-
# upload its CLI archive, so the wait inside is usually instant.
681+
# The Windows jobs start with the other platforms and wait for the same-arch
682+
# Linux CLI archive after their other setup. Packaging is mostly CPU and
683+
# small-file work, which Linux runners do faster than Windows ones, so both
684+
# Windows targets build and sign on Linux and only the native checks run on
685+
# Windows.
683686
desktop_win_x64:
684687
name: Desktop Windows x64
685688
needs: [preflight, relay_public_config, build_bundle]
@@ -695,16 +698,15 @@ jobs:
695698
clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
696699
relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
697700
label: Windows x64
698-
runner: blacksmith-32vcpu-windows-2025
701+
runner: blacksmith-16vcpu-ubuntu-2404
702+
verify_runner: windows-2025
699703
platform: win
700704
target: nsis
701705
arch: x64
702706
rust_target: x86_64-pc-windows-msvc
703707
resource_key: win32-x64
704708
cli_archive: true
705709

706-
# Windows arm64 runners have 4 vCPUs, and the packaging is mostly CPU-bound,
707-
# so the build runs on Linux and only the native checks run on arm64.
708710
desktop_win_arm64:
709711
name: Desktop Windows arm64
710712
needs: [preflight, relay_public_config, build_bundle]

‎AGENTS.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
9999
- Test meaningful logic or observable behavior. Do not render components to static markup to assert props or attributes, or add tests that merely assert callback wiring or mirror the implementation.
100100
- **Do not run repo-wide checks.** No `vp check`, no `vp run -r test`, no `vp run -r typecheck` unless I ask. CI owns the full suite.
101101
- Backend behavior changes ship with focused tests for that behavior.
102-
- The server is event-sourced, and side effects run after the command commits. In tests, drain the effect worker (`OrchestrationEffectWorkerV2.drain`) or await the specific persisted event or `Deferred` that marks the milestone. Never wait on sleeps or polling. A test that needs a timeout to pass is wrong.
102+
- The server is event-sourced, and side effects run after the command commits. In tests, drain the effect worker (`OrchestrationEffectWorkerV2.drain`) or await the specific persisted event or `Deferred` that marks the milestone. Never wait on sleeps or polling. A test that needs a timeout to pass is wrong. Concretely:
103+
- `it.effect` runs on a `TestClock`; `Effect.sleep` only advances through `TestClock.adjust`. `it.live` is wall-clock and only for subprocess or network fixtures.
104+
- No `yieldNow` or `sleep` polling loops. Await the `Deferred`, take from the `Queue`, or drain the worker.
105+
- No per-test timeout argument or `retry`. The project timeout is the ceiling, and flaky tests are fixed, not retried.
106+
- No `performance.now()` or `Date.now()` deltas. Assert on events and counts, not elapsed time.
107+
- Browser tests assert through `expect.element` or `vi.waitFor`, never `requestAnimationFrame` or `transitionend`.
108+
- `vi.mock` factories must not spread a real module that pulls in Shiki or the diff workers.
109+
- `it.skip` and friends need a tracking issue on the line above: `// quarantine: #1234 <why>`.
110+
- Lint enforces this: `t3code/no-test-timeout-or-unreasoned-skip`, `t3code/no-frame-waits-in-browser-tests`, `t3code/no-wall-clock-in-tests`, `t3code/no-real-time-wait-in-tests`, `t3code/no-polling-loop-in-tests`.
103111
- Web browser tests are `*.browser.test.tsx` or `*.browser.test.ts` and render with `await using screen = await render(...)` from `apps/web/test/render.tsx`. `t3code/require-disposable-render` errors on the old patterns.
104112
- Acquire what the test drives after mounting (fake timers it advances, spies it sets up after mounting) after the render, so it disposes before the unmount. Anything the first render reads comes before it.
105113
- A helper that renders and then waits or clicks puts the screen in an `AsyncDisposableStack` and `move()`s it out only on success, so a failed wait still unmounts.

‎apps/desktop/gnome-extension/captureFeedback.test.js‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,6 @@ it("waits for T3 to remap and cancels that wait when disabled", async () => {
151151
expect(shell.mapped.size).toBe(0);
152152
});
153153

154-
it("does not animate under reduced motion but still activates T3", async () => {
155-
shell.animations = false;
156-
shell.windows = [target()];
157-
const { feedback, started } = begin();
158-
expect(started).toBe(false);
159-
expect(shell.actors).toHaveLength(0);
160-
await feedback.activate(":1.23", "T3");
161-
expect(shell.activate).toHaveBeenCalledOnce();
162-
feedback.dispose();
163-
});
164-
165154
it("rejects another sender and locked-session activation", async () => {
166155
shell.windows = [target()];
167156
const { feedback } = begin();

‎apps/desktop/gnome-extension/captureService.test.js‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ it("rejects other clients before looking at the active window", async () => {
2828
expect(await service.capture(":1.23")).toBe("pixels");
2929
});
3030

31-
it.each(CLIENT_NAMES)("accepts the current owner of %s", async (client) => {
32-
const { service } = fixture({ getNameOwner: async (name) => (name === client ? ":1.23" : null) });
33-
expect(await service.capture(":1.23")).toBe("pixels");
34-
});
35-
3631
it("rechecks the name owner on each capture", async () => {
3732
let owner = ":1.23";
3833
const { service } = fixture({ getNameOwner: async () => owner });

‎apps/desktop/scripts/electron-launcher.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function runChecked(command, args) {
9494
throw new Error(`Failed to run ${command} ${args.join(" ")}: ${details}`.trim());
9595
}
9696

97-
export function resolveMacCodeSignArguments(appBundlePath) {
97+
function resolveMacCodeSignArguments(appBundlePath) {
9898
return ["--force", "--deep", "--sign", "-", "--timestamp=none", appBundlePath];
9999
}
100100

@@ -201,7 +201,7 @@ function registerMacLauncherBundle(appBundlePath) {
201201
}
202202

203203
// Bundle-internal paths are macOS paths whatever host builds them.
204-
export function resolveMacLauncherIconPaths(runtimeDir, development = isDevelopment) {
204+
function resolveMacLauncherIconPaths(runtimeDir, development = isDevelopment) {
205205
return {
206206
sourceIconPath: development ? developmentMacIconPngPath : productionMacIconPngPath,
207207
generatedIconPath: NodePath.posix.join(
@@ -260,7 +260,7 @@ function ensureMacIconIcns(runtimeDir) {
260260
}
261261
}
262262

263-
export function resolveMacBundleInfoPlistStrings(executableName) {
263+
function resolveMacBundleInfoPlistStrings(executableName) {
264264
return {
265265
CFBundleDisplayName: APP_DISPLAY_NAME,
266266
CFBundleName: APP_DISPLAY_NAME,

‎apps/desktop/scripts/electron-launcher.test.mjs‎

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import {
1111
makeDevelopmentEnvironmentScript,
1212
makeDevelopmentLauncherScript,
1313
resolveElectronBinaryPath,
14-
resolveMacBundleInfoPlistStrings,
15-
resolveMacCodeSignArguments,
16-
resolveMacLauncherIconPaths,
1714
resolveMacLauncherPaths,
1815
writeDevelopmentLauncherScript,
1916
} from "./electron-launcher.mjs";
@@ -106,30 +103,6 @@ describe("electron development launcher", () => {
106103
assert.notInclude(script, "node_modules/electron");
107104
});
108105

109-
it("declares why the macOS app needs protected access", () => {
110-
const values = resolveMacBundleInfoPlistStrings("T3 Code (Dev) Launcher");
111-
112-
assert.equal(
113-
values.NSScreenCaptureUsageDescription,
114-
"T3 Code captures the active window when you use the snapshot shortcut.",
115-
);
116-
assert.equal(
117-
values.NSDocumentsFolderUsageDescription,
118-
"T3 Code reads project files you open in the desktop app.",
119-
);
120-
});
121-
122-
it("ad-hoc signs the complete development app bundle", () => {
123-
assert.deepEqual(resolveMacCodeSignArguments("/runtime/T3 Code (Dev).app"), [
124-
"--force",
125-
"--deep",
126-
"--sign",
127-
"-",
128-
"--timestamp=none",
129-
"/runtime/T3 Code (Dev).app",
130-
]);
131-
});
132-
133106
it("restores execute permissions on an unchanged launcher", () => {
134107
const directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-launcher-"));
135108
const launcherPath = NodePath.join(directory, "launcher");
@@ -143,16 +116,6 @@ describe("electron development launcher", () => {
143116
NodeFS.rmSync(directory, { recursive: true, force: true });
144117
}
145118
});
146-
147-
it("derives launcher icons from canonical development and production assets", () => {
148-
const development = resolveMacLauncherIconPaths("/runtime", true);
149-
const production = resolveMacLauncherIconPaths("/runtime", false);
150-
151-
assert.match(development.sourceIconPath, /assets[\\/]dev[\\/]blueprint-macos-1024\.png$/);
152-
assert.equal(development.generatedIconPath, "/runtime/icon-dev.icns");
153-
assert.match(production.sourceIconPath, /assets[\\/]prod[\\/]black-macos-1024\.png$/);
154-
assert.equal(production.generatedIconPath, "/runtime/icon-prod.icns");
155-
});
156119
});
157120

158121
async function startupCleanupPattern(desktopDir) {

‎apps/desktop/scripts/verify-preload-bundle.test.mjs‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,13 @@ describe("desktop preload bundle verifier", () => {
6060
);
6161
});
6262

63-
it("ignores import-like text in strings", () => {
64-
assert.doesNotThrow(() =>
65-
verifyPreloadBundle(`${validPreload}\nconst message = 'import /* comment */("module")';`),
66-
);
67-
});
68-
6963
it("rejects unsupported require calls with comments before the opening parenthesis", () => {
7064
assert.throws(
7165
() => verifyPreloadBundle(`${validPreload}\nrequire /* @__PURE__ */ ("node:fs");`),
7266
/unsupported sandbox imports: node:fs/,
7367
);
7468
});
7569

76-
it("rejects unsupported optional require calls", () => {
77-
assert.throws(
78-
() => verifyPreloadBundle(`${validPreload}\nrequire?.("node:fs");`),
79-
/unsupported sandbox imports: node:fs/,
80-
);
81-
});
82-
8370
it("accepts Electron sandbox module aliases", () => {
8471
assert.doesNotThrow(() =>
8572
verifyPreloadBundle(`

0 commit comments

Comments
 (0)