Skip to content

Commit c2a38a2

Browse files
committed
Merge branch 'feat/mobile-ios-action-button' into feat/mobile-ios-voice-task
# Conflicts: # apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
2 parents 28cddcd + 9742468 commit c2a38a2

435 files changed

Lines changed: 15505 additions & 5943 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.

‎.coderabbit.config.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ export default defineConfig((ctx) => ({
2626
path: "apps/web/src/**/*.{tsx,css}",
2727
instructions: "Hold changed code to the rules in docs/internals/web-ui.md.",
2828
},
29+
{
30+
path: "**/*.test.{ts,tsx}",
31+
instructions:
32+
"Hold changed tests to the rules in docs/internals/testing.md. Request tests only as those rules allow.",
33+
},
2934
],
3035
},
3136
knowledge_base: {
3237
code_guidelines: {
3338
filePatterns: [
3439
{ files: "docs/internals/effect-services.md", applyTo: "{apps,packages,infra}/**/*.ts" },
3540
{ files: "docs/internals/web-ui.md", applyTo: "apps/web/src/**/*.{tsx,css}" },
41+
{ files: "docs/internals/testing.md", applyTo: "{apps,packages,infra}/**/*.{ts,tsx}" },
3642
],
3743
},
3844
},
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Agent Context Budget
2+
3+
# Fails when a PR raises a value in agentContextBudget.json above main's. AgentContextBudget.test.ts
4+
# keeps that file equal to the measured context, so the context cannot grow by editing the file.
5+
# To accept growth on purpose, a maintainer adds the agent-context-increase label.
6+
on:
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled, unlabeled]
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: agent-context-budget-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
budget:
19+
name: Agent context budget
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 5
22+
env:
23+
BUDGET: apps/server/src/provider/agentContextBudget.json
24+
ALLOW_INCREASE: ${{ contains(github.event.pull_request.labels.*.name, 'agent-context-increase') }}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
with:
29+
sparse-checkout: apps/server/src/provider/agentContextBudget.json
30+
sparse-checkout-cone-mode: false
31+
32+
- name: Compare with main
33+
run: |
34+
git fetch --quiet --depth=1 origin main
35+
if ! git cat-file -e "FETCH_HEAD:$BUDGET" 2>/dev/null; then
36+
echo "main has no agent context budget yet."
37+
exit 0
38+
fi
39+
git show "FETCH_HEAD:$BUDGET" > "$RUNNER_TEMP/main.json"
40+
grown=$(jq -r --slurpfile main "$RUNNER_TEMP/main.json" '
41+
to_entries[]
42+
| select($main[0][.key] != null and .value > $main[0][.key])
43+
| "\(.key): \($main[0][.key]) -> \(.value) (+\(.value - $main[0][.key]))"
44+
' "$BUDGET")
45+
if [ -z "$grown" ]; then
46+
echo "Agent context is not larger than main."
47+
exit 0
48+
fi
49+
printf 'Agent context grew compared to main:\n%s\n' "$grown"
50+
if [ "$ALLOW_INCREASE" = "true" ]; then
51+
echo "Accepted by the agent-context-increase label."
52+
exit 0
53+
fi
54+
echo "::error file=$BUDGET::Agent context grew compared to main. Cut the added text, or ask a maintainer to add the agent-context-increase label."
55+
exit 1

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ jobs:
344344
- name: Test
345345
run: vp run --filter @t3tools/web test
346346

347+
# Browser tests run source modules; this boots the production chunk graph.
348+
- name: Boot the built web client
349+
run: |
350+
vp run --filter @t3tools/web build
351+
node apps/web/scripts/verify-built-boot.ts
352+
347353
# apps/server sets `fileParallelism: false`, so its test files run strictly
348354
# one at a time. Sharding spreads them over separate runners instead of
349355
# separate workers, so no two server test files ever share a machine and the

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ on:
6464
required: false
6565
default: false
6666
type: boolean
67+
# Whether the job opens the packaged app against a seeded database and
68+
# opens a thread before uploading it. Linux AppImage or macOS DMG.
69+
launch_check:
70+
required: false
71+
default: false
72+
type: boolean
6773
# A runner of the target's own platform and architecture, for a `runner`
6874
# that cannot execute the target. The build job skips everything that
6975
# runs the packaged binaries, and a second job runs it there.
@@ -517,6 +523,38 @@ jobs:
517523
518524
vp run dist:desktop:artifact "${args[@]}"
519525
526+
# A build can package fine and still not open (a missing module in the
527+
# backend or the bundle). This launches the app from the shipped
528+
# AppImage or DMG.
529+
- name: Launch check
530+
if: inputs.launch_check
531+
shell: bash
532+
run: |
533+
set -euo pipefail
534+
check=(node scripts/smoke-desktop-app.ts --artifacts-dir "$RUNNER_TEMP/desktop-launch-check")
535+
if [[ "${{ inputs.platform }}" == "mac" ]]; then
536+
mount="$RUNNER_TEMP/desktop-launch-dmg"
537+
hdiutil attach -nobrowse -readonly -mountpoint "$mount" "$(ls "$GITHUB_WORKSPACE"/release/*.dmg)"
538+
trap 'hdiutil detach "$mount" -force >/dev/null || true' EXIT
539+
app=$(ls -d "$mount"/*.app)
540+
executable=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "$app/Contents/Info.plist")
541+
"${check[@]}" --executable "$app/Contents/MacOS/$executable"
542+
else
543+
sudo apt-get install -y xvfb
544+
appimage=$(ls "$GITHUB_WORKSPACE"/release/*.AppImage)
545+
chmod +x "$appimage"
546+
(cd "$RUNNER_TEMP" && "$appimage" --appimage-extract >/dev/null)
547+
xvfb-run -a "${check[@]}" --executable "$RUNNER_TEMP/squashfs-root/t3code"
548+
fi
549+
550+
- name: Upload launch check output
551+
if: failure() && inputs.launch_check
552+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
553+
with:
554+
name: desktop-launch-check-${{ inputs.platform }}-${{ inputs.arch }}
555+
path: ${{ runner.temp }}/desktop-launch-check
556+
if-no-files-found: ignore
557+
520558
# The verify job runs what this host could not: the packaged natives and
521559
# the CLI. Its scripts are bundled so that job needs no install.
522560
- name: Stage verification inputs

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ jobs:
344344
- name: Test
345345
run: vp run --filter @t3tools/web test
346346

347+
# Browser tests run source modules; this boots the production chunk graph.
348+
- name: Boot the built web client
349+
run: |
350+
vp run --filter @t3tools/web build
351+
node apps/web/scripts/verify-built-boot.ts
352+
347353
# Server test files run one at a time, so more small runners beat fewer big ones.
348354
test_server:
349355
name: Release server tests ${{ matrix.shard }}
@@ -613,6 +619,7 @@ jobs:
613619
rust_target: aarch64-apple-darwin
614620
resource_key: darwin-arm64
615621
cli_archive: true
622+
launch_check: true
616623

617624
desktop_mac_x64:
618625
name: Desktop macOS x64
@@ -662,6 +669,7 @@ jobs:
662669
rust_target: x86_64-unknown-linux-gnu
663670
resource_key: linux-x64
664671
cli_archive: true
672+
launch_check: true
665673

666674
# node-pty has no Linux prebuild and compiles from source, so the arm64 app
667675
# and archive are built on arm64 hardware rather than cross-built.

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
103103
- Use `vp run typecheck`, not `npx tsc`; it caches per package. Both run tsc-rs (`typescript` is the `@tsc-rs/typescript` drop-in).
104104
- Run `node -e` snippets from `apps/server` or the owning package. `effect` does not resolve from the repo root.
105105
- 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.
106+
- [Testing](docs/internals/testing.md) carries these same test rules, plus review guidance, for review bots. Change both together.
106107
- **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.
107108
- Backend behavior changes ship with focused tests for that behavior.
108109
- Proof for a bug fix depends on the bug. Logic, data, state, and protocol bugs get a failing test first (the fewest that fail on `main` for that reason, in the module's existing test file), then the fix. Purely visual bugs (spacing, colour, alignment, a layout shift) get before/after captures as their proof and no test: do not add UI tests for nitpicks, and do not ask for one in review when a capture already shows it. A server-only fix with no visible surface ships the test plus a short runtime transcript.

‎apps/desktop/package.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",
77
"scripts": {
88
"ensure:electron": "node scripts/ensure-electron-runtime.mjs",
99
"start": "node scripts/start-electron.mjs",
10-
"test": "vp test run --passWithNoTests",
11-
"smoke-test": "node scripts/smoke-test.mjs"
10+
"test": "vp test run --passWithNoTests"
1211
},
1312
"dependencies": {
1413
"@clerk/electron": "catalog:",

‎apps/desktop/scripts/smoke-test.mjs‎

Lines changed: 0 additions & 58 deletions
This file was deleted.

‎apps/desktop/src/app/DesktopApp.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import * as DesktopShutdown from "./DesktopShutdown.ts";
2929
import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts";
3030
import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts";
3131
import * as DesktopShellEnvironment from "../shell/DesktopShellEnvironment.ts";
32+
import * as DesktopStartupRecovery from "./DesktopStartupRecovery.ts";
3233
import * as DesktopState from "./DesktopState.ts";
3334
import * as DesktopRemoteUpdates from "../updates/DesktopRemoteUpdates.ts";
3435
import * as DesktopUpdates from "../updates/DesktopUpdates.ts";
@@ -325,6 +326,7 @@ const startup = Effect.gen(function* () {
325326
yield* applicationMenu.configure;
326327
yield* updates.configure;
327328
yield* DesktopRemoteUpdates.listen;
329+
yield* DesktopStartupRecovery.listen;
328330
yield* linuxUrlHandler.register;
329331
yield* bootstrap.pipe(Effect.catchCause((cause) => fatalStartupCause("bootstrap", cause)));
330332
}).pipe(Effect.withSpan("desktop.startup"));
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import type { DesktopUpdateState } from "@t3tools/contracts";
2+
import { describe, expect, it } from "vite-plus/test";
3+
4+
import { createInitialDesktopUpdateState } from "../updates/updateMachine.ts";
5+
import { resolveStartupRecoveryOffer } from "./DesktopStartupRecovery.ts";
6+
7+
const updateState = (patch: Partial<DesktopUpdateState>): DesktopUpdateState => ({
8+
...createInitialDesktopUpdateState(
9+
"0.1.3",
10+
{ hostArch: "arm64", appArch: "arm64", runningUnderArm64Translation: false },
11+
"latest",
12+
),
13+
enabled: true,
14+
...patch,
15+
});
16+
17+
describe("resolveStartupRecoveryOffer", () => {
18+
it("offers a newer version before going back", () => {
19+
expect(
20+
resolveStartupRecoveryOffer(
21+
updateState({ status: "available", availableVersion: "0.1.4" }),
22+
"0.1.2",
23+
),
24+
).toEqual({ _tag: "Update", version: "0.1.4" });
25+
});
26+
27+
it("offers a retained download after a later check fails", () => {
28+
expect(
29+
resolveStartupRecoveryOffer(
30+
updateState({ status: "error", errorContext: "check", downloadedVersion: "0.1.4" }),
31+
null,
32+
),
33+
).toEqual({ _tag: "Update", version: "0.1.4" });
34+
});
35+
36+
it("waits for the update check before offering to go back", () => {
37+
expect(resolveStartupRecoveryOffer(updateState({ status: "checking" }), "0.1.2")).toEqual({
38+
_tag: "Checking",
39+
});
40+
});
41+
42+
it("offers the last version that started when no update exists", () => {
43+
expect(resolveStartupRecoveryOffer(updateState({ status: "up-to-date" }), "0.1.2")).toEqual({
44+
_tag: "Reinstall",
45+
version: "0.1.2",
46+
});
47+
});
48+
49+
it("does not offer an update that already failed to apply here", () => {
50+
expect(
51+
resolveStartupRecoveryOffer(
52+
updateState({
53+
status: "downloaded",
54+
downloadedVersion: "0.1.4",
55+
notAppliedVersion: "0.1.4",
56+
}),
57+
"0.1.2",
58+
),
59+
).toEqual({ _tag: "Reinstall", version: "0.1.2" });
60+
});
61+
62+
it("falls back to the releases page when this version never started", () => {
63+
expect(resolveStartupRecoveryOffer(updateState({ status: "disabled" }), "0.1.3")).toEqual({
64+
_tag: "Releases",
65+
});
66+
expect(resolveStartupRecoveryOffer(updateState({ status: "up-to-date" }), null)).toEqual({
67+
_tag: "Releases",
68+
});
69+
});
70+
});

0 commit comments

Comments
 (0)