Skip to content

Commit 2b10657

Browse files
committed
merge main: preserve delegated approval priority over background reports
2 parents f592457 + 2b65ffb commit 2b10657

390 files changed

Lines changed: 14628 additions & 7551 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/actions/ci-changes/action.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ outputs:
55
value: ${{ steps.detect.outputs.typecheck }}
66
build:
77
value: ${{ steps.detect.outputs.build }}
8+
desktop_launch:
9+
value: ${{ steps.detect.outputs.desktop_launch }}
810
test:
911
value: ${{ steps.detect.outputs.test }}
1012
test_packages:

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ const BUILD_ONLY_DEPS = { t3: ["@t3tools/web"] };
5151
const MOBILE_NATIVE =
5252
/^apps\/mobile\/.*\.(swift|kt|kts)$|^apps\/mobile\/(\.swiftlint\.yml|detekt\.yml|\.editorconfig|Brewfile)$|^scripts\/mobile-native-static-check\.ts$|^package\.json$|^\.github\/workflows\/ci\.yml$|^\.github\/scripts\/ci-changes\.cjs$|^\.github\/actions\/ci-changes\//;
5353

54+
// Startup, migration, settlement, and sidebar paths that decide whether an upgraded user's
55+
// threads show after launch. Build runs scripts/smoke-desktop-app.ts for them, so they do not
56+
// first fail in the release launch check.
57+
const DESKTOP_LAUNCH = [
58+
/^apps\/desktop\/src\/((main|boot|compileCache|serverCompileCache)\.ts$|(app|backend|window)\/)/,
59+
/^apps\/desktop\/src\/electron\/(ElectronApp|ElectronProtocol|ElectronWindow)\.ts$/,
60+
/^apps\/web\/src\/((main|AppRoot|appInit)\.tsx|(bootstrap|router)\.ts)$/,
61+
/^apps\/web\/src\/.*sidebar/i,
62+
/^apps\/server\/src\/(bin|binMain|server|serverRuntimeStartup)\.ts$/,
63+
/^apps\/server\/src\/persistence\/Migrations/,
64+
/^apps\/server\/src\/orchestration-v2\/((ThreadSettlementService|ProjectionStore)\.ts$|legacy\/)/,
65+
/^packages\/contracts\/src\/settings\.ts$/,
66+
/^scripts\/(smoke-desktop-app\.ts|fixtures\/desktop-launch\/)/,
67+
];
68+
5469
const OWN_TEST_JOB = new Set(["t3", "@t3tools/web", "@t3tools/monorepo"]);
5570

5671
function readWorkspace() {
@@ -151,12 +166,18 @@ function decide(files, packages, full) {
151166
(pkg) => pkg.hasTest && !OWN_TEST_JOB.has(pkg.name) && affected.has(pkg.name),
152167
);
153168
const has = (name) => affected.has(name);
169+
const desktopLaunch =
170+
everything ||
171+
files.some(
172+
(file) => !/\.test\.tsx?$/.test(file) && DESKTOP_LAUNCH.some((pattern) => pattern.test(file)),
173+
);
154174

155175
return {
156176
affected: [...affected].sort(),
157177
outputs: {
158178
typecheck: affected.size > 0,
159-
build: has("@t3tools/desktop") || has("t3") || has("@t3tools/web"),
179+
build: has("@t3tools/desktop") || has("t3") || has("@t3tools/web") || desktopLaunch,
180+
desktop_launch: desktopLaunch,
160181
test: tested.length > 0,
161182
// Empty means every package the Test job covers.
162183
test_packages: everything ? "" : tested.map((pkg) => pkg.name).join(" "),

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function decide(
1616
outputs: {
1717
typecheck: boolean;
1818
build: boolean;
19+
desktop_launch: boolean;
1920
test: boolean;
2021
test_packages: string;
2122
test_web: boolean;

‎.github/workflows/ci.yml‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
outputs:
2828
typecheck: ${{ steps.detect.outputs.typecheck }}
2929
build: ${{ steps.detect.outputs.build }}
30+
desktop_launch: ${{ steps.detect.outputs.desktop_launch }}
3031
test: ${{ steps.detect.outputs.test }}
3132
test_packages: ${{ steps.detect.outputs.test_packages }}
3233
test_web: ${{ steps.detect.outputs.test_web }}
@@ -135,13 +136,14 @@ jobs:
135136
if: needs.changes.outputs.build != 'false'
136137

137138
# Runs in the background while Vite+ installs; the step before the build waits for it.
139+
# Xvfb is for the desktop launch check below.
138140
- name: Start installing browser secret helper build libraries
139141
if: needs.changes.outputs.build != 'false'
140142
run: |
141143
sudo sed -i 's|http://|https://|g' /etc/apt/blacksmith-ubuntu-mirrors.txt /etc/apt/sources.list.d/ubuntu.sources
142144
(
143145
set +e
144-
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config
146+
sudo apt-get update && sudo apt-get install -y libsecret-1-dev pkg-config xvfb
145147
echo "$?" > "$RUNNER_TEMP/apt-status"
146148
) > "$RUNNER_TEMP/apt.log" 2>&1 < /dev/null &
147149
@@ -192,6 +194,25 @@ jobs:
192194
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
193195
run: node apps/desktop/scripts/verify-preload-bundle.mjs
194196

197+
# The release launch check, run unpackaged against the same old-state fixture, for
198+
# startup and sidebar changes. Packaging and signing stay release-only.
199+
- name: Open the seeded thread in the built desktop app
200+
id: desktop_launch
201+
if: ${{ !cancelled() && steps.build.outcome == 'success' && needs.changes.outputs.desktop_launch != 'false' }}
202+
timeout-minutes: 4
203+
run: |
204+
electron=$(node -p "require('./apps/desktop/node_modules/electron')")
205+
xvfb-run -a node scripts/smoke-desktop-app.ts --executable "$electron" --app apps/desktop \
206+
--artifacts-dir "$RUNNER_TEMP/desktop-launch-check"
207+
208+
- name: Upload desktop launch check
209+
if: ${{ failure() && steps.desktop_launch.outcome == 'failure' }}
210+
uses: actions/upload-artifact@v7
211+
with:
212+
name: desktop-launch-check
213+
path: ${{ runner.temp }}/desktop-launch-check
214+
if-no-files-found: ignore
215+
195216
# Browser tests run source modules; this boots the production chunk graph. The
196217
# desktop build above already produced apps/web/dist, and the client waits about
197218
# 15s for a session that never comes, so this runs here instead of in Test Web,
@@ -622,7 +643,7 @@ jobs:
622643
# not needed. Gates are keyed by job name, except merged Build and the
623644
# macOS lint.
624645
echo "$RESULTS" | jq -e '.changes.outputs as $gates
625-
| {build: ["build", "typecheck"], mobile_native_static_analysis: ["mobile_native"]} as $renamed
646+
| {build: ["build", "typecheck", "desktop_launch"], mobile_native_static_analysis: ["mobile_native"]} as $renamed
626647
| all(to_entries[];
627648
.value.result == "success"
628649
or (.value.result == "skipped"

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ jobs:
210210
native/hyprland-snap-shot/target/${{ inputs.rust_target }}/release/t3-hyprland-snap-shot
211211
key: linux-capture-helpers-${{ inputs.rust_target }}-${{ hashFiles('native/kde-snap-shot/Cargo.lock', 'native/kde-snap-shot/Cargo.toml', 'native/kde-snap-shot/src/**', 'native/hyprland-snap-shot/Cargo.lock', 'native/hyprland-snap-shot/Cargo.toml', 'native/hyprland-snap-shot/src/**', 'native/hyprland-snap-shot/protocols/**') }}
212212

213+
# Every Linux build makes electron-builder fetch the AppImage runtime, FPM
214+
# for the deb, and the 7-Zip that unpacks FPM from GitHub releases. It
215+
# checks an archive found here against the SHA-256 pinned in those toolset
216+
# files and downloads again on a mismatch, so only raw archives are cached.
217+
- name: Cache Linux packaging tool archives
218+
if: inputs.platform == 'linux'
219+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
220+
with:
221+
path: |
222+
~/.cache/electron-builder/appimage@*/appimage-tools-runtime-*.tar.gz
223+
~/.cache/electron-builder/fpm@*/fpm-*.7z
224+
~/.cache/electron-builder/7zip@*/7zip-linux-*.tar.gz
225+
key: electron-builder-linux-tools-${{ inputs.arch }}-${{ hashFiles('node_modules/.pnpm/app-builder-lib@*/node_modules/app-builder-lib/out/toolsets/linux.js', 'node_modules/.pnpm/app-builder-lib@*/node_modules/app-builder-lib/out/toolsets/7zip.js') }}
226+
213227
- name: Ensure Rosetta for macOS x64 bytecode generation
214228
if: inputs.platform == 'mac' && inputs.arch == 'x64'
215229
shell: bash

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,13 +1241,16 @@ jobs:
12411241
T3CODE_WEB_NIGHTLY_DOMAIN: ${{ vars.T3CODE_WEB_NIGHTLY_DOMAIN }}
12421242
VERCEL_TEAM_SLUG: ${{ vars.VERCEL_TEAM_SLUG }}
12431243
steps:
1244+
# Only what setup-ci-deps reads to install vp and Node. The alias call
1245+
# names its deployment and scope, so it reads nothing else from the repo.
12441246
- name: Checkout
12451247
uses: actions/checkout@v6
12461248
with:
12471249
ref: ${{ needs.preflight.outputs.ref }}
12481250
sparse-checkout: |
1249-
/*
1250-
!/.repos/
1251+
/.github/actions/setup-ci-deps/
1252+
/package.json
1253+
/pnpm-workspace.yaml
12511254
sparse-checkout-cone-mode: false
12521255

12531256
- name: Setup Vite+

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"@clerk/electron": "catalog:",
1414
"@clerk/electron-passkeys": "catalog:",
15-
"@crowecawcaw/xa11y": "0.13.0",
15+
"@crowecawcaw/xa11y": "0.15.4",
1616
"@effect/platform-node": "catalog:",
1717
"@napi-rs/keyring": "^1.3.0",
1818
"@t3tools/client-runtime": "workspace:*",

‎apps/desktop/src/electron/ElectronWindow.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ vi.mock("electron", () => ({
5353
getAllWindows: getAllWindowsMock,
5454
getFocusedWindow: getFocusedWindowMock,
5555
}),
56+
screen: {
57+
// A 200% display, so the focus target must carry converted bounds.
58+
dipToScreenRect: (_window: unknown, rect: Electron.Rectangle) => ({
59+
x: rect.x * 2,
60+
y: rect.y * 2,
61+
width: rect.width * 2,
62+
height: rect.height * 2,
63+
}),
64+
},
5665
}));
5766

5867
import * as ElectronWindow from "./ElectronWindow.ts";
@@ -116,6 +125,13 @@ describe("ElectronWindow", () => {
116125
});
117126
const electronWindow = yield* ElectronWindow.ElectronWindow;
118127
yield* electronWindow.prepareReveal(window as unknown as Electron.BrowserWindow);
128+
assert.deepEqual(windowsForegroundPrepareMock.mock.calls[0]?.[0], {
129+
windowId: 41,
130+
processId: process.pid,
131+
title: "T3 Code (Dev)",
132+
bounds: { x: 200, y: 100, width: 2_400, height: 1_600 },
133+
contentBounds: { x: 216, y: 100, width: 2_368, height: 1_584 },
134+
});
119135
window.getTitle.mockClear();
120136

121137
const revealFiber = yield* electronWindow

‎apps/desktop/src/electron/ElectronWindow.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ function windowsForegroundFocusTarget(window: Electron.BrowserWindow) {
2626
windowId: window.id,
2727
processId: process.pid,
2828
title: window.getTitle(),
29-
bounds: window.getBounds(),
30-
contentBounds: window.getContentBounds(),
29+
// xa11y reports physical desktop pixels on Windows; Electron bounds are DIPs.
30+
bounds: Electron.screen.dipToScreenRect(window, window.getBounds()),
31+
contentBounds: Electron.screen.dipToScreenRect(window, window.getContentBounds()),
3132
};
3233
}
3334

‎apps/desktop/src/electron/WindowsForegroundFocusWorker.ts‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ async function findTarget(
3232
const children = await App.byPid(target.processId, { timeout: 0 })
3333
.then((app) => app.children())
3434
.catch(() => []);
35-
return (
36-
children.find((candidate) => matchesTarget(candidate, target)) ??
37-
(await App.list())
38-
.filter((candidate) => candidate.pid === target.processId)
39-
.map((candidate) => candidate.asElement())
40-
.find((candidate) => matchesTarget(candidate, target))
41-
);
35+
return children.find((candidate) => matchesTarget(candidate, target));
4236
}
4337

4438
const cachedElements = new Map<number, Element>();

0 commit comments

Comments
 (0)