Skip to content

Commit 9ca5db6

Browse files
Merge remote-tracking branch 'origin/main' into v2/kiro-acp
# Conflicts: # apps/mobile/package.json # apps/mobile/src/lib/providerClients.ts # apps/web/package.json # apps/web/src/components/settings/providerDriverMeta.ts # pnpm-lock.yaml
2 parents 9386a44 + 3b22620 commit 9ca5db6

729 files changed

Lines changed: 42104 additions & 9360 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/deploy-relay.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ on:
55
branches:
66
- main
77
# Redeploys main after a variable or secret change. Alchemy redeploys the
8-
# Worker when a value it reads changes, so force is rarely needed, and it
9-
# replaces the Postgres runtime role (alchemy-run/alchemy#1832).
8+
# Worker when a value it reads changes, so force is rarely needed.
109
workflow_dispatch:
1110
inputs:
1211
force:
13-
description: Redeploy every resource, including ones with no detected changes. Replaces the Postgres runtime role.
12+
description: Redeploy every resource, including ones with no detected changes.
1413
type: boolean
1514
default: false
1615

‎.github/workflows/mobile-eas-production.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ jobs:
275275
--environment production \
276276
--platform ${{ inputs.platform }} \
277277
--message "$OTA_MESSAGE" \
278+
--emit-metadata \
278279
--non-interactive
279280
280281
# Reconcile each version separately because the major is in the fingerprint.
@@ -313,8 +314,11 @@ jobs:
313314
--environment production \
314315
--platform "$platform" \
315316
--message "$message" \
317+
--emit-metadata \
316318
--non-interactive; then
317319
echo ":white_check_mark: $platform/$profile: OTA published to production (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
320+
# The next target's export replaces dist; keep this one for the map upload.
321+
rm -rf "dist-$platform-$profile" && mv dist "dist-$platform-$profile"
318322
else
319323
failed=1
320324
echo ":x: $platform/$profile: OTA publish failed (fingerprint \`$hash\`)" >> "$GITHUB_STEP_SUMMARY"
@@ -354,3 +358,18 @@ jobs:
354358
fi
355359
done
356360
exit "$failed"
361+
362+
# Lets the relay symbolicate crash stacks from the updates published
363+
# above. A step of its own so the R2 credentials reach only this script,
364+
# not `eas update` and the dependencies it runs. Never fails the job.
365+
- name: Upload OTA source maps
366+
if: ${{ !cancelled() && steps.expo-token.outputs.present == 'true' }}
367+
working-directory: apps/mobile
368+
env:
369+
MOBILE_SOURCEMAPS_R2: ${{ secrets.MOBILE_SOURCEMAPS_R2 }}
370+
run: |
371+
for dir in dist dist-*; do
372+
if [ -f "$dir/eas-update-metadata.json" ]; then
373+
node scripts/upload-sourcemaps.mts ota "$dir"
374+
fi
375+
done

‎.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.

0 commit comments

Comments
 (0)