diff --git a/.github/actions/provide-chromium-libs/action.yml b/.github/actions/provide-chromium-libs/action.yml new file mode 100644 index 0000000000000..b9fef1c3ce27f --- /dev/null +++ b/.github/actions/provide-chromium-libs/action.yml @@ -0,0 +1,26 @@ +name: Provide Chromium libraries +description: Make the shared libraries Playwright's Chromium shell needs available without root. +runs: + using: composite + steps: + - name: Provide Chromium libraries for the voice latency browser test + shell: bash + run: | + set -euo pipefail + if test -e /usr/lib/x86_64-linux-gnu/libnspr4.so; then + printf 'Chromium libraries present\n' + exit 0 + fi + dir="$RUNNER_TEMP/chromium-libs" + mkdir -p "$dir/lists/partial" "$dir/cache/archives/partial" "$dir/root" + apt_opts=(-o Debug::NoLocking=1 -o Dir::State::Lists="$dir/lists" -o Dir::Cache="$dir/cache") + apt-get "${apt_opts[@]}" -qq update + apt-get "${apt_opts[@]}" -qq install --download-only --no-install-recommends -y \ + libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 libcairo2 \ + libcups2t64 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0t64 libnspr4 libnss3 \ + libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 \ + libxkbcommon0 libxrandr2 + for deb in "$dir"/cache/archives/*.deb; do dpkg-deb -x "$deb" "$dir/root"; done + lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" + test -f "$lib_dir/libnspr4.so" + printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" diff --git a/.github/actions/provide-libatomic/action.yml b/.github/actions/provide-libatomic/action.yml new file mode 100644 index 0000000000000..196e7e019e8d4 --- /dev/null +++ b/.github/actions/provide-libatomic/action.yml @@ -0,0 +1,30 @@ +name: Provide libatomic +description: Make libatomic.so.1 available to official Node binaries without root. +runs: + using: composite + steps: + - name: Provide libatomic for official Node binaries + shell: bash + run: | + set -euo pipefail + # Official Node 26 linux-x64 binaries link libatomic.so.1. The pinned + # actions-runner image (dotnet runtime-deps:8.0-noble) lacks it, and + # the ARC pod cannot use sudo/apt (no privilege escalation). Without + # it, Vite+ self-setup fails with exit 127. Use Ubuntu noble's + # immutable release-pocket package, pinned by SHA-256. + lib_system=/usr/lib/x86_64-linux-gnu/libatomic.so.1 + if test -e "$lib_system"; then + printf 'libatomic present at %s\n' "$lib_system" + exit 0 + fi + test "$(uname -m)" = x86_64 + deb_url='https://archive.ubuntu.com/ubuntu/pool/main/g/gcc-14/libatomic1_14-20240412-0ubuntu1_amd64.deb' + deb_sha256='f496d80626e1512456273965d44f47b281edf53fa26d0d8bd0defc5be7e4601c' + dir="$RUNNER_TEMP/libatomic" + mkdir -p "$dir" + curl -fsSL --connect-timeout 10 --max-time 120 -o "$dir/libatomic1.deb" "$deb_url" + printf '%s %s\n' "$deb_sha256" "$dir/libatomic1.deb" | sha256sum -c - + dpkg-deb -x "$dir/libatomic1.deb" "$dir/root" + lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" + test -f "$lib_dir/libatomic.so.1" + printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" diff --git a/.github/actions/setup-ci-deps/action.yml b/.github/actions/setup-ci-deps/action.yml index cc6dc80511aca..d89088678ec02 100644 --- a/.github/actions/setup-ci-deps/action.yml +++ b/.github/actions/setup-ci-deps/action.yml @@ -131,10 +131,18 @@ runs: # default, saves a ~1 GB store only its own reruns can read, so it only restores. # Concurrent jobs with the same install args reserve one key, so the losers # compress the store for nothing; all but one pass save-pnpm-store: false. + # + # A pull_request cache is scoped to that PR, so only the push to the default + # branch writes the store later runs share. This fork's default branch is + # `release/native-0.1.10`, so that push writes it and a PR into it reads it. + # A push to `feat/assemblyai-current` writes a store only that branch's own + # runs can read, which is the same scoping the action already gives any + # non-default branch. - name: Save pnpm store if: >- inputs.install == 'true' && inputs.save-pnpm-store == 'true' && - (github.event_name != 'pull_request' || github.base_ref == github.event.repository.default_branch) && + (github.event_name != 'pull_request' || + github.base_ref == github.event.repository.default_branch) && steps.pnpm_cache.outputs.cache-hit != 'true' && (steps.pnpm_store.outputs.namespace == 'full' || steps.pnpm_cache.outputs.cache-matched-key != format('pnpm-full-v1-{0}-{1}-{2}', runner.os, runner.arch, hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', 'package.json'))) diff --git a/.github/scripts/arc-ci-coverage.cjs b/.github/scripts/arc-ci-coverage.cjs new file mode 100644 index 0000000000000..52eb59d103191 --- /dev/null +++ b/.github/scripts/arc-ci-coverage.cjs @@ -0,0 +1,229 @@ +const fs = require("node:fs"); +const path = require("node:path"); + +const WORKFLOW = ".github/workflows/closura-arc-ci.yml"; +const REQUIRED_CHECK = "Voice + founder inbox (Linux ARC)"; +const WORKERS = ["voice-and-inbox-core", "voice-and-inbox-web", "voice-and-inbox-mobile"]; + +// Every test the single serial job ran before the split. A parallel job that +// drops one of these makes the required check pass without running it. +const REQUIRED_TESTS = [ + "apps/server/src/speech/CloudSpeech.test.ts", + "apps/server/src/speech/GroqSpeechStream.test.ts", + "apps/server/src/speech/stream.test.ts", + "packages/contracts/src/threadInbox.test.ts", + "packages/contracts/src/threadInbox.invariants.test.ts", + "packages/contracts/src/threadInbox.upgrade.test.ts", + "packages/contracts/src/threadMetadataMcp.test.ts", + "apps/web/src/components/threadActionMenu.logic.test.ts", + "apps/web/src/components/sidebar/threadListFilter.logic.test.ts", + "packages/client-runtime/src/state/threadAttribution.test.ts", + "apps/server/src/orchestration-v2/ThreadLaunchService.test.ts", + "apps/server/src/orchestration-v2/SubagentProjection.test.ts", + "apps/server/src/orchestration-v2/ModelAlertReactor.test.ts", + "apps/server/src/orchestration-v2/ThreadEventAlerts.test.ts", + "apps/server/src/orchestration-v2/DelegatedCompletionDelivery.test.ts", + "packages/shared/src/threadPlacement.test.ts", + "apps/server/src/peer/RemoteDelegation.test.ts", + "apps/server/src/mcp/OrchestratorMcpService.test.ts", + "apps/server/src/cli/thread.test.ts", + "apps/web/src/composerDraftStore.test.ts", + "packages/client-runtime/src/voice-input/controller.test.ts", + "apps/web/src/components/chat/composerSend.logic.test.ts", + "apps/web/src/components/chat/chatViewSend.test.ts", + "apps/web/src/components/chat/composerImagePersistence.test.ts", + "apps/web/src/components/chat/draftPlacement.test.ts", + "apps/web/src/components/chat/draftAttachmentUploads.test.ts", + "apps/web/src/components/chat/draftUploadReconcile.test.ts", + "apps/web/src/lib/attachmentUploadQueue.test.ts", + "apps/server/src/ws.test.ts", + "packages/contracts/src/environment.test.ts", + "scripts/feature-map.test.ts", + "apps/mobile/src/state/thread-placement.model.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.placement.test.ts", + "apps/mobile/src/state/composer-attachment-uploads.test.ts", + "apps/mobile/src/lib/composerAttachmentUploadQueue.test.ts", + "apps/mobile/src/lib/attachmentUpload.test.ts", + "apps/mobile/src/state/use-composer-drafts.test.ts", + "apps/mobile/src/state/thread-outbox.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.permissions.test.ts", + "apps/mobile/src/state/threadOutboxDelivery.test.ts", + "apps/mobile/src/state/pending-thread-creation.test.ts", + "apps/mobile/src/lib/projectThreadStartTurn.test.ts", + "apps/mobile/src/features/threads/thread-route-state.test.ts", + "apps/mobile/src/features/threads/new-task-flow-provider.test.tsx", + "apps/mobile/src/features/home/pendingTaskRoute.test.tsx", + "apps/mobile/src/features/threads/NewTaskDraftRouteScreen.test.tsx", + "apps/web/src/speech/voiceInputLatency.browser.test.ts", + "apps/web/src/speech/useEnvironmentSpeechInput.browser.test.tsx", +]; + +function unquote(value) { + const trimmed = value.trim(); + if ( + (trimmed.startsWith('"') && trimmed.endsWith('"')) || + (trimmed.startsWith("'") && trimmed.endsWith("'")) + ) { + return trimmed.slice(1, -1); + } + return trimmed; +} + +// Workflow files are small and this only needs the step structure, so a flat +// scan beats pulling in a YAML parser. It tracks job ids, job names, `needs`, +// and the `run` / `working-directory` pairs inside each job's steps. +function parseWorkflow(source) { + const jobs = {}; + let current = null; + let inRun = false; + let runIndent = 0; + let inTriggers = true; + const lines = source.split("\n"); + for (const line of lines) { + if (inRun) { + const indent = line.match(/^\s*/)[0].length; + if (line.trim() !== "" && indent <= runIndent) inRun = false; + else { + current.run.push(line.trim().replace(/\\$/, "").trim()); + continue; + } + } + if (inTriggers) { + if (line === "jobs:") inTriggers = false; + continue; + } + const job = line.match(/^ {2}([\w-]+):\s*$/); + if (job) { + current = { id: job[1], name: null, needs: [], condition: null, steps: [] }; + jobs[current.id] = current; + continue; + } + if (!current) continue; + const condition = line.match(/^ {4}if:\s*(.+)$/); + if (condition && current.condition === null && current.steps.length === 0) { + current.condition = unquote(condition[1]); + continue; + } + if (!current) continue; + const name = line.match(/^ {4}name:\s*(.+)$/); + if (name) { + current.name = unquote(name[1]); + continue; + } + const needs = line.match(/^ {4}needs:\s*\[([^\]]*)\]/); + if (needs) { + current.needs = needs[1] + .split(",") + .map((item) => unquote(item)) + .filter(Boolean); + continue; + } + const directory = line.match(/^ {8}working-directory:\s*(.+)$/); + if (directory) { + current.directory = unquote(directory[1]); + continue; + } + const run = line.match(/^ {8}run:\s*(\||>)?\s*$/); + if (run) { + const step = { directory: current.directory ?? "", run: [] }; + current.steps.push(step); + current.run = step.run; + current.directory = ""; + inRun = true; + runIndent = 8; + } + } + return jobs; +} + +// A test path only counts when a worker actually invokes it. A path that only +// appears inside a comment or a branch that never runs would otherwise let the +// guard pass while the required check runs nothing. +function testsIn(job) { + const found = []; + for (const step of job.steps) { + const prefix = step.directory ? `${step.directory}/` : ""; + let skipping = false; + for (const line of step.run) { + if (/^(?:if\s+false\b|exit\b)/.test(line)) skipping = true; + else if (skipping && /^(?:fi|else|elif)\b/.test(line)) skipping = false; + if (skipping || line.startsWith("#")) continue; + if (/^[\w./-]+\.(ts|tsx)$/.test(line)) found.push(prefix + line); + } + } + return found; +} + +function jobBody(source, id) { + const marker = `\n ${id}:`; + const start = source.indexOf(marker); + if (start < 0) return ""; + const rest = source.slice(start + marker.length); + const next = rest.search(/\n {2}[\w-]+:\s*\n/); + return next < 0 ? rest : rest.slice(0, next); +} + +function checkCoverage(source) { + const jobs = parseWorkflow(source); + const problems = []; + const aggregator = jobs["voice-and-inbox"]; + if (!aggregator) problems.push("missing voice-and-inbox job"); + else { + if (aggregator.name !== REQUIRED_CHECK) { + problems.push(`required check is named ${JSON.stringify(aggregator.name)}`); + } + const needs = [...aggregator.needs].sort(); + if (needs.join() !== [...WORKERS].sort().join()) { + problems.push(`aggregator needs ${needs.join(", ") || "nothing"}`); + } + // `always()` is true for a cancelled run, and a worker that never started + // reports success, so the required check would pass with nothing tested. + if (!aggregator.condition || !aggregator.condition.includes("!cancelled()")) { + problems.push("aggregator runs when the workflow is cancelled"); + } + // The ARC image has no node on PATH. setup-node downloads an official + // Node 26 binary that needs libatomic, so both have to run first. + const body = jobBody(source, "voice-and-inbox"); + const libatomic = body.indexOf("uses: ./.github/actions/provide-libatomic"); + const setupNode = body.indexOf("uses: actions/setup-node@"); + const guard = body.indexOf("run: node .github/scripts/arc-ci-coverage.cjs"); + if ( + libatomic < 0 || + setupNode < 0 || + guard < 0 || + !(libatomic < setupNode && setupNode < guard) + ) { + problems.push("coverage guard runs before Node is on PATH"); + } + } + const ran = []; + for (const id of WORKERS) { + if (!jobs[id]) { + problems.push(`missing worker ${id}`); + continue; + } + ran.push(...testsIn(jobs[id])); + } + const ranSet = new Set(ran); + for (const test of REQUIRED_TESTS) { + if (!ranSet.has(test)) problems.push(`no worker runs ${test}`); + } + const duplicates = ran.filter((test, index) => ran.indexOf(test) !== index); + for (const test of new Set(duplicates)) problems.push(`run twice: ${test}`); + return problems; +} + +module.exports = { REQUIRED_CHECK, REQUIRED_TESTS, WORKERS, checkCoverage, parseWorkflow }; + +if (require.main === module) { + const root = process.argv[2] ?? process.cwd(); + const source = fs.readFileSync(path.join(root, WORKFLOW), "utf8"); + const problems = checkCoverage(source); + if (problems.length > 0) { + for (const problem of problems) process.stderr.write(`${problem}\n`); + process.exit(1); + } + process.stdout.write( + `${REQUIRED_CHECK} covers ${REQUIRED_TESTS.length} tests across ${WORKERS.length} workers\n`, + ); +} diff --git a/.github/scripts/arc-ci-coverage.test.cjs b/.github/scripts/arc-ci-coverage.test.cjs new file mode 100644 index 0000000000000..4607a0e53c650 --- /dev/null +++ b/.github/scripts/arc-ci-coverage.test.cjs @@ -0,0 +1,52 @@ +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const path = require("node:path"); +const test = require("node:test"); +const { REQUIRED_TESTS, checkCoverage } = require("./arc-ci-coverage.cjs"); + +const root = path.resolve(__dirname, "../.."); +const workflow = fs.readFileSync( + path.join(root, ".github/workflows/closura-arc-ci.yml"), + "utf8", +); + +test("the parallel workers cover every test the serial job ran", () => { + assert.deepEqual(checkCoverage(workflow), []); +}); + +test("renaming the aggregator or dropping a test fails the check", () => { + const renamed = workflow.replace( + "name: Voice + founder inbox (Linux ARC)", + "name: Voice and inbox", + ); + assert.ok(checkCoverage(renamed).some((problem) => problem.startsWith("required check"))); + + const dropped = workflow.replace(` ${REQUIRED_TESTS[0]} \\\n`, ""); + assert.ok(checkCoverage(dropped).some((problem) => problem.includes(REQUIRED_TESTS[0]))); +}); + +test("a test that only appears in dead code does not count as run", () => { + const buried = workflow.replace( + ` ${REQUIRED_TESTS[0]} \\\n`, + ` if false; then echo ${REQUIRED_TESTS[0]}; fi\n`, + ); + assert.ok(checkCoverage(buried).some((problem) => problem.includes(REQUIRED_TESTS[0]))); +}); + +test("the coverage guard refuses to run before Node is on PATH", () => { + const withoutNode = workflow.replace( + / {6}- name: Provide libatomic for official Node binaries\n {8}uses: \.\/\.github\/actions\/provide-libatomic\n\n {6}- name: Setup Node\n {8}uses: actions\/setup-node@\S+ # v6\.5\.0\n {8}with:\n {10}node-version-file: package\.json\n\n/, + "", + ); + assert.notEqual(withoutNode, workflow); + assert.ok( + checkCoverage(withoutNode).some((problem) => problem.includes("Node is on PATH")), + ); +}); + +test("an aggregator that runs on cancellation fails the check", () => { + const always = workflow.replace("if: ${{ !cancelled() }}", "if: always()"); + assert.ok( + checkCoverage(always).some((problem) => problem.includes("cancelled")), + ); +}); diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index 9c890246e637d..507ab3a238695 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -29,7 +29,12 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - voice-and-inbox: + # The former single job ran every step in series, so one runner held the + # whole 8-15 minute critical path. The work splits into independent workers + # that share nothing but the source tree. The ruleset `release-native-protection` + # requires the check name "Voice + founder inbox (Linux ARC)" exactly, so the + # tiny aggregator job below keeps that name and the workers do the work. + voice-and-inbox-core: # This is a public fork. Never run untrusted PR code on the private ARC LAN. # Same-repo PR + trusted human author/actor only; push and manual runs # require an authorized actor and one of the two exact branches above. @@ -49,9 +54,9 @@ jobs: contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor)) ) }} - name: Voice + founder inbox (Linux ARC) + name: Voice + inbox core (Linux ARC) runs-on: t3code-ci-arc - timeout-minutes: 90 + timeout-minutes: 45 env: CI: "true" GIT_CONFIG_NOSYSTEM: "1" @@ -80,42 +85,18 @@ jobs: "$GITHUB_REPOSITORY" "$RUNNER_NAME" "$GITHUB_REF" "$(git rev-parse HEAD)" - name: Provide libatomic for official Node binaries - shell: bash - run: | - set -euo pipefail - # Official Node 26 linux-x64 binaries link libatomic.so.1. The pinned - # actions-runner image (dotnet runtime-deps:8.0-noble) lacks it, and - # the ARC pod cannot use sudo/apt (no privilege escalation). Without - # it, Vite+ self-setup fails with exit 127. Use Ubuntu noble's - # immutable release-pocket package, pinned by SHA-256. - lib_system=/usr/lib/x86_64-linux-gnu/libatomic.so.1 - if test -e "$lib_system"; then - printf 'libatomic present at %s\n' "$lib_system" - exit 0 - fi - test "$(uname -m)" = x86_64 - deb_url='https://archive.ubuntu.com/ubuntu/pool/main/g/gcc-14/libatomic1_14-20240412-0ubuntu1_amd64.deb' - deb_sha256='f496d80626e1512456273965d44f47b281edf53fa26d0d8bd0defc5be7e4601c' - dir="$RUNNER_TEMP/libatomic" - mkdir -p "$dir" - curl -fsSL --connect-timeout 10 --max-time 120 -o "$dir/libatomic1.deb" "$deb_url" - printf '%s %s\n' "$deb_sha256" "$dir/libatomic1.deb" | sha256sum -c - - dpkg-deb -x "$dir/libatomic1.deb" "$dir/root" - lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" - test -f "$lib_dir/libatomic.so.1" - printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" - - - name: Set up pinned Node, pnpm and Vite+ - uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0 - env: - VP_DOWNLOAD_TIMEOUT: "120" - with: - node-version-file: package.json - cache: false - run-install: false + uses: ./.github/actions/provide-libatomic - # After Node. The ARC image has no `node` until setup-vp, so running this - # earlier exits 127 before the receipt can measure anything. + # setup-vp's own cache cannot see the pnpm store on a self-hosted runner + # that starts from a clean workspace, so caching goes through the shared + # action: the Vite+ home, the pnpm store and the lockfile verification + # record, keyed on the lockfile. This job installs the whole workspace and + # is the one that saves the store; the other two restore it. + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps + + # After Node. The ARC image has no `node` until setup-ci-deps, so running + # this earlier exits 127 before the receipt can measure anything. - name: Fork drift receipt run: | # The checkout is shallow (`fetch-depth: 2`) and only has the @@ -137,10 +118,6 @@ jobs: if [ "${rc:-0}" -eq 2 ]; then exit 2; fi shell: bash - - name: Install locked dependencies - shell: bash - run: vp install - - name: Guard indispensable AssemblyAI voice implementation shell: bash run: | @@ -176,7 +153,7 @@ jobs: vp run --filter t3 typecheck vp run --filter @t3tools/mobile typecheck - - name: Test AssemblyAI dictation, native inbox and thread placement behavior + - name: Test server voice, inbox and placement behavior shell: bash run: | set -euo pipefail @@ -188,9 +165,6 @@ jobs: packages/contracts/src/threadInbox.invariants.test.ts \ packages/contracts/src/threadInbox.upgrade.test.ts \ packages/contracts/src/threadMetadataMcp.test.ts \ - apps/web/src/components/threadActionMenu.logic.test.ts \ - apps/web/src/components/sidebar/threadListFilter.logic.test.ts \ - packages/client-runtime/src/state/threadAttribution.test.ts \ apps/server/src/orchestration-v2/ThreadLaunchService.test.ts \ apps/server/src/orchestration-v2/SubagentProjection.test.ts \ apps/server/src/orchestration-v2/ModelAlertReactor.test.ts \ @@ -200,6 +174,77 @@ jobs: apps/server/src/peer/RemoteDelegation.test.ts \ apps/server/src/mcp/OrchestratorMcpService.test.ts \ apps/server/src/cli/thread.test.ts \ + apps/server/src/ws.test.ts \ + packages/contracts/src/environment.test.ts \ + scripts/feature-map.test.ts + + - name: Build native T3 server + shell: bash + run: vp run --filter t3 build:bundle + + - name: Verify compiled server output + shell: bash + run: | + set -euo pipefail + test -f apps/server/dist/bin.mjs + printf 'Exact T3 source %s, server build successful on %s\n' \ + "$(git rev-parse HEAD)" "$RUNNER_NAME" + + voice-and-inbox-web: + if: >- + ${{ + github.repository == 'nullStack65/t3code' && + ( + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)) + || + (github.event_name != 'pull_request' && + (github.ref == 'refs/heads/feat/assemblyai-current' || + github.ref == 'refs/heads/release/native-0.1.10') && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor)) + ) + }} + name: Voice + inbox web (Linux ARC) + runs-on: t3code-ci-arc + timeout-minutes: 45 + env: + CI: "true" + GIT_CONFIG_NOSYSTEM: "1" + NODE_OPTIONS: "--max-old-space-size=3072" + GOMAXPROCS: "2" + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + sparse-checkout: | + /* + !/.repos/ + !/apps/mobile/modules/t3-terminal/Vendor/**/*.a + sparse-checkout-cone-mode: false + + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + # Restores the store the core job saves. save-pnpm-store stays off so two + # jobs never race to reserve the same cache key. + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps + with: + save-pnpm-store: "false" + + - name: Test web inbox, composer and voice behavior + shell: bash + run: | + set -euo pipefail + vp test run \ + apps/web/src/components/threadActionMenu.logic.test.ts \ + apps/web/src/components/sidebar/threadListFilter.logic.test.ts \ + packages/client-runtime/src/state/threadAttribution.test.ts \ apps/web/src/composerDraftStore.test.ts \ packages/client-runtime/src/voice-input/controller.test.ts \ apps/web/src/components/chat/composerSend.logic.test.ts \ @@ -208,10 +253,66 @@ jobs: apps/web/src/components/chat/draftPlacement.test.ts \ apps/web/src/components/chat/draftAttachmentUploads.test.ts \ apps/web/src/components/chat/draftUploadReconcile.test.ts \ - apps/web/src/lib/attachmentUploadQueue.test.ts \ - apps/server/src/ws.test.ts \ - packages/contracts/src/environment.test.ts \ - scripts/feature-map.test.ts + apps/web/src/lib/attachmentUploadQueue.test.ts + + - name: Build founder inbox and voice settings web client + shell: bash + run: vp run --filter @t3tools/web build + + - name: Verify compiled web output + shell: bash + run: | + set -euo pipefail + test -d apps/web/dist + printf 'Exact T3 source %s, web build successful on %s\n' \ + "$(git rev-parse HEAD)" "$RUNNER_NAME" + + voice-and-inbox-mobile: + if: >- + ${{ + github.repository == 'nullStack65/t3code' && + ( + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.event.pull_request.user.login) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)) + ) + || + ( + github.event_name != 'pull_request' && + (github.ref == 'refs/heads/feat/assemblyai-current' || + github.ref == 'refs/heads/release/native-0.1.10') && + contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor) + ) + }} + name: Voice + inbox mobile (Linux ARC) + runs-on: t3code-ci-arc + timeout-minutes: 45 + env: + CI: "true" + GIT_CONFIG_NOSYSTEM: "1" + NODE_OPTIONS: "--max-old-space-size=3072" + GOMAXPROCS: "2" + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + sparse-checkout: | + /* + !/.repos/ + !/apps/mobile/modules/t3-terminal/Vendor/**/*.a + sparse-checkout-cone-mode: false + + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + - name: Install locked dependencies from cache + uses: ./.github/actions/setup-ci-deps + with: + save-pnpm-store: "false" - name: Test mobile new-task placement, outbox and uploads shell: bash @@ -236,26 +337,18 @@ jobs: src/features/threads/NewTaskDraftRouteScreen.test.tsx - name: Provide Chromium libraries for the voice latency browser test - shell: bash - run: | - set -euo pipefail - if test -e /usr/lib/x86_64-linux-gnu/libnspr4.so; then - printf 'Chromium libraries present\n' - exit 0 - fi - dir="$RUNNER_TEMP/chromium-libs" - mkdir -p "$dir/lists/partial" "$dir/cache/archives/partial" "$dir/root" - apt_opts=(-o Debug::NoLocking=1 -o Dir::State::Lists="$dir/lists" -o Dir::Cache="$dir/cache") - apt-get "${apt_opts[@]}" -qq update - apt-get "${apt_opts[@]}" -qq install --download-only --no-install-recommends -y \ - libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 libcairo2 \ - libcups2t64 libdbus-1-3 libdrm2 libgbm1 libglib2.0-0t64 libnspr4 libnss3 \ - libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 \ - libxkbcommon0 libxrandr2 - for deb in "$dir"/cache/archives/*.deb; do dpkg-deb -x "$deb" "$dir/root"; done - lib_dir="$dir/root/usr/lib/x86_64-linux-gnu" - test -f "$lib_dir/libnspr4.so" - printf 'LD_LIBRARY_PATH=%s\n' "$lib_dir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" >> "$GITHUB_ENV" + uses: ./.github/actions/provide-chromium-libs + + # The browser binary is the slow download. It is keyed on the Playwright + # version this lockfile resolves, so a bump refetches and everything else + # restores. The path is the runner temp dir, which is wiped between jobs, + # so nothing stale survives a version change. + - name: Restore Playwright Chromium + id: playwright_cache + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ runner.temp }}/playwright-browsers + key: playwright-chromium-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }} - name: Test voice press-to-recording and release-to-text stay under 400 ms shell: bash @@ -269,19 +362,68 @@ jobs: src/speech/voiceInputLatency.browser.test.ts \ src/speech/useEnvironmentSpeechInput.browser.test.tsx - - name: Build native T3 server - shell: bash - run: vp run --filter t3 build:bundle + - name: Save Playwright Chromium + if: steps.playwright_cache.outputs.cache-hit != 'true' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ runner.temp }}/playwright-browsers + key: ${{ steps.playwright_cache.outputs.cache-primary-key }} - - name: Build founder inbox and voice settings web client + # Reports the exact check name the release-native-protection ruleset requires. + # It runs no build and installs no workspace dependencies. The ARC image has + # no `node` on PATH, so this job sets up the repo's Node before the coverage + # guard. It fails when any worker failed, was cancelled, or was skipped. A + # skipped worker means the trust gate refused the run, and a required check + # must not turn green for a run that did no work. + # + # `if: always()` would also start this job when the workflow is cancelled, and + # a worker that never started reports `success`. The concurrency group cancels + # the previous in-progress run on every new push, so that would mark the + # required check green for a run whose tests never ran. `!cancelled()` still + # runs when a worker failed or was skipped. + voice-and-inbox: + name: Voice + founder inbox (Linux ARC) + needs: [voice-and-inbox-core, voice-and-inbox-web, voice-and-inbox-mobile] + if: ${{ !cancelled() }} + runs-on: t3code-ci-arc + timeout-minutes: 5 + steps: + - name: Checkout trusted source (no persistent credentials) + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + fetch-depth: 2 + # package.json is the Node version file. Cone mode on Git 2.43 accepts + # that root file alongside the .github directory. + sparse-checkout: | + .github + package.json + + # Official Node 26 links libatomic.so.1, which this image does not ship. + # The library path has to be set before setup-node runs that binary. + - name: Provide libatomic for official Node binaries + uses: ./.github/actions/provide-libatomic + + - name: Setup Node + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: package.json + + # Fails the required check when a worker no longer runs one of the 48 + # tests the serial job ran, so coverage cannot shrink without this going red. + - name: Guard the parallel coverage shell: bash - run: vp run --filter @t3tools/web build + run: node .github/scripts/arc-ci-coverage.cjs - - name: Verify compiled release outputs + - name: Report the three workers shell: bash + env: + CORE: ${{ needs.voice-and-inbox-core.result }} + WEB: ${{ needs.voice-and-inbox-web.result }} + MOBILE: ${{ needs.voice-and-inbox-mobile.result }} run: | set -euo pipefail - test -f apps/server/dist/bin.mjs - test -d apps/web/dist - printf 'Exact T3 source %s, voice and inbox builds successful on %s\n' \ - "$(git rev-parse HEAD)" "$RUNNER_NAME" + printf 'core=%s web=%s mobile=%s\n' "$CORE" "$WEB" "$MOBILE" + for result in "$CORE" "$WEB" "$MOBILE"; do + test "$result" = success + done