From fc0ada5c5380334ed8965d51b0e0df82b09303dd Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:31:22 +0000 Subject: [PATCH 1/3] Report the build's source commit and qualify every release-branch head The environment descriptor gains an optional buildCommit, baked in at build time from T3CODE_BUILD_COMMIT (40-hex, validated), so a deployment check can read exactly which commit a server runs. Pushes to release/native-0.1.10 now run the ARC qualification job on their exact commit, and pull requests into that branch must declare a Deploy: line. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/closura-arc-ci.yml | 9 ++-- .github/workflows/closura-deploy-line.yml | 52 +++++++++++++++++++ apps/server/src/config.ts | 7 +++ .../src/environment/ServerEnvironment.ts | 1 + apps/server/vite.config.ts | 8 +++ packages/contracts/src/environment.test.ts | 6 +++ packages/contracts/src/environment.ts | 2 + 7 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/closura-deploy-line.yml diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index f1da93204077..71b9af9f3704 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -4,7 +4,9 @@ name: T3 fork ARC CI # macOS/Windows runners, new controller or deployment side effects. on: push: - branches: [feat/assemblyai-current] + # Every merged head of the native release branch gets a check run on its + # exact commit; the private fleet rollout builds only commits that passed. + branches: [feat/assemblyai-current, release/native-0.1.10] pull_request: branches: [feat/assemblyai-current, release/native-0.1.10] workflow_dispatch: @@ -20,7 +22,7 @@ jobs: voice-and-inbox: # 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 the exact native release branch. + # require an authorized actor and one of the two exact branches above. if: >- ${{ github.repository == 'nullStack65/t3code' && @@ -32,7 +34,8 @@ jobs: contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.triggering_actor)) || (github.event_name != 'pull_request' && - github.ref == 'refs/heads/feat/assemblyai-current' && + (github.ref == 'refs/heads/feat/assemblyai-current' || + github.ref == 'refs/heads/release/native-0.1.10') && contains(fromJSON('["nullStack65","jeffreysmithclosura"]'), github.actor)) ) }} diff --git a/.github/workflows/closura-deploy-line.yml b/.github/workflows/closura-deploy-line.yml new file mode 100644 index 000000000000..8177ca379d83 --- /dev/null +++ b/.github/workflows/closura-deploy-line.yml @@ -0,0 +1,52 @@ +name: Closura deploy line + +# Every pull request into the native release branch names where it must end up +# running, so "merged" is never mistaken for "live". The private fleet +# configuration holds the authoritative host list; this only checks the line's +# shape. Reads the body from the event payload; no token, checkout or code run. +on: + pull_request: + branches: [release/native-0.1.10] + types: [opened, reopened, synchronize, edited, ready_for_review] + +permissions: {} + +concurrency: + group: closura-deploy-line-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + deploy-line: + if: >- + ${{ + github.repository == 'nullStack65/t3code' && + 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) + }} + name: Deploy line declared + runs-on: t3code-ci-arc + timeout-minutes: 5 + steps: + - name: Require "Deploy: none" or "Deploy: , " + shell: bash + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + set -euo pipefail + lines="$(printf '%s\n' "${PR_BODY:-}" | tr -d '\r' | grep -E '^[[:space:]]*Deploy:' || true)" + count="$(printf '%s' "$lines" | grep -c . || true)" + if test "$count" -ne 1; then + echo "::error::Add exactly one 'Deploy:' line to the PR body: 'Deploy: none' or 'Deploy: , ' (found $count)." + exit 1 + fi + value="$(printf '%s' "$lines" | sed -E 's/^[[:space:]]*Deploy:[[:space:]]*//; s/[[:space:]]+$//')" + if test "$value" = none; then + echo "Deploy: none" + exit 0 + fi + if ! printf '%s' "$value" | grep -Eq '^[a-z0-9][a-z0-9-]*([[:space:]]*,[[:space:]]*[a-z0-9][a-z0-9-]*)*$'; then + echo "::error::'Deploy: $value' must be 'none' or comma-separated lowercase host ids." + exit 1 + fi + echo "Deploy targets: $value" diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts index c707c912d672..63936c572704 100644 --- a/apps/server/src/config.ts +++ b/apps/server/src/config.ts @@ -27,6 +27,13 @@ declare const __T3CODE_TELEMETRY_CHANNEL__: ReleaseChannel | undefined; export const telemetryChannel: ReleaseChannel = typeof __T3CODE_TELEMETRY_CHANNEL__ === "undefined" ? "dev" : __T3CODE_TELEMETRY_CHANNEL__; +// The source commit the build was made from, when the build stamped one (T3CODE_BUILD_COMMIT). +declare const __T3CODE_BUILD_COMMIT__: string | undefined; +export const buildCommit: string | undefined = + typeof __T3CODE_BUILD_COMMIT__ === "undefined" || __T3CODE_BUILD_COMMIT__ === "" + ? undefined + : __T3CODE_BUILD_COMMIT__; + export const DEFAULT_PORT = 3773; export const RuntimeMode = Schema.Literals(["web", "desktop"]); diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index 3b4dc9eb0768..813f1ed59d16 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -219,6 +219,7 @@ export const make = Effect.gen(function* () { serverVersion: packageJson.version, orchestrationProtocolVersion: ORCHESTRATION_PROTOCOL_VERSION, ...(databaseMigration === undefined ? {} : { databaseMigration }), + ...(ServerConfig.buildCommit === undefined ? {} : { buildCommit: ServerConfig.buildCommit }), capabilities: { repositoryIdentity: true, connectionProbe: true, diff --git a/apps/server/vite.config.ts b/apps/server/vite.config.ts index 0ec539e5ae16..5d0eaa508181 100644 --- a/apps/server/vite.config.ts +++ b/apps/server/vite.config.ts @@ -34,6 +34,13 @@ if (!TELEMETRY_CHANNELS.includes(telemetryChannel)) { ); } +// The exact source commit this build was made from (40-hex), for deployment receipts. +// Release builds set it; builds without it leave the descriptor's buildCommit absent. +const buildCommit = process.env.T3CODE_BUILD_COMMIT?.trim().toLowerCase() ?? ""; +if (buildCommit !== "" && !/^[0-9a-f]{40}$/.test(buildCommit)) { + throw new Error(`T3CODE_BUILD_COMMIT must be a 40-character hex commit, got "${buildCommit}".`); +} + // tsdown SEA needs one chunk (sourcemaps count) and Node >=25.7, so package separately. // "bundle" emits the embedded CLI. "1" builds dist-exe/t3 from the bootstrap. // TEMPORARY one-time Node fix. Remove when fixed: https://github.com/nodejs/node/issues/67048 @@ -147,6 +154,7 @@ export default mergeConfig( define: { __T3CODE_BUILD_CHANNEL__: JSON.stringify(cliBuildChannel), __T3CODE_TELEMETRY_CHANNEL__: JSON.stringify(telemetryChannel), + __T3CODE_BUILD_COMMIT__: JSON.stringify(buildCommit), __T3CODE_BUILD_RELAY_URL__: JSON.stringify(repoEnv.T3CODE_RELAY_URL?.trim() ?? ""), __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__: JSON.stringify( repoEnv.T3CODE_CLERK_PUBLISHABLE_KEY?.trim() ?? "", diff --git a/packages/contracts/src/environment.test.ts b/packages/contracts/src/environment.test.ts index 1646684f1da0..2e41b1b136d5 100644 --- a/packages/contracts/src/environment.test.ts +++ b/packages/contracts/src/environment.test.ts @@ -14,6 +14,12 @@ const descriptor = { } as const; describe("ExecutionEnvironmentDescriptor", () => { + it("keeps the optional build commit, absent on unstamped and older servers", () => { + expect(decodeDescriptor(descriptor).buildCommit).toBeUndefined(); + const buildCommit = "4f4c0fbb936f12b27d7d97f05dd9b2e0a9732cb1"; + expect(decodeDescriptor({ ...descriptor, buildCommit }).buildCommit).toBe(buildCommit); + }); + it("decodes old, recognized and future manual installation descriptors", () => { expect(decodeDescriptor(descriptor).capabilities.serverInstallation).toBeUndefined(); for (const installation of [ diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts index 474b8a515ec8..19cd8d427316 100644 --- a/packages/contracts/src/environment.ts +++ b/packages/contracts/src/environment.ts @@ -220,6 +220,8 @@ export const ExecutionEnvironmentDescriptor = Schema.Struct({ orchestrationProtocolVersion: Schema.optionalKey(Schema.Int), /** Highest migration this server's database holds; absent on older servers. */ databaseMigration: Schema.optionalKey(Schema.Int), + /** Full source commit the running build was made from; absent when the build had no stamp. */ + buildCommit: Schema.optionalKey(TrimmedNonEmptyString), capabilities: ExecutionEnvironmentCapabilities, }); export type ExecutionEnvironmentDescriptor = typeof ExecutionEnvironmentDescriptor.Type; From e270300ba3f12094e4b8aca951ee76b07667093a Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Thu, 19 Nov 2026 03:09:12 +0000 Subject: [PATCH 2/3] Quote the Deploy-line step name so the workflow parses The unquoted name contained ": ", which YAML read as a mapping, so GitHub rejected the workflow and the check never ran. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 1c8cada8fa96bbe8175fe73ca610d37b30d20f5c) --- .github/workflows/closura-deploy-line.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/closura-deploy-line.yml b/.github/workflows/closura-deploy-line.yml index 8177ca379d83..912b7000418e 100644 --- a/.github/workflows/closura-deploy-line.yml +++ b/.github/workflows/closura-deploy-line.yml @@ -28,7 +28,7 @@ jobs: runs-on: t3code-ci-arc timeout-minutes: 5 steps: - - name: Require "Deploy: none" or "Deploy: , " + - name: 'Require one Deploy line (none, or comma-separated targets)' shell: bash env: PR_BODY: ${{ github.event.pull_request.body }} From c73dbd351e9143a8ef91c6d79986dd102c00fb18 Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Thu, 19 Nov 2026 03:15:29 +0000 Subject: [PATCH 3/3] Keep fleet names out of the Deploy line and give every merged head its check Review round fixes: the public Deploy line now takes only 'none' or 'fleet' (the private deployment config resolves targets), ignores fenced code, and runs on a hosted runner because it reads only the event payload. Push runs group by commit so a burst of merges never cancels a queued head. CI runs the descriptor contract test. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/closura-arc-ci.yml | 7 +++- .github/workflows/closura-deploy-line.yml | 46 +++++++++++------------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/closura-arc-ci.yml b/.github/workflows/closura-arc-ci.yml index 71b9af9f3704..aadcd2c96321 100644 --- a/.github/workflows/closura-arc-ci.yml +++ b/.github/workflows/closura-arc-ci.yml @@ -15,7 +15,9 @@ permissions: contents: read concurrency: - group: t3-fork-arc-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + # Pushes group by exact commit, so a burst of merges never cancels a queued + # head: every merged head keeps its own check run. + group: t3-fork-arc-${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -168,7 +170,8 @@ jobs: 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 + apps/server/src/ws.test.ts \ + packages/contracts/src/environment.test.ts - name: Test mobile new-task placement, outbox and uploads shell: bash diff --git a/.github/workflows/closura-deploy-line.yml b/.github/workflows/closura-deploy-line.yml index 912b7000418e..e7bc8fdc3837 100644 --- a/.github/workflows/closura-deploy-line.yml +++ b/.github/workflows/closura-deploy-line.yml @@ -1,9 +1,11 @@ name: Closura deploy line -# Every pull request into the native release branch names where it must end up -# running, so "merged" is never mistaken for "live". The private fleet -# configuration holds the authoritative host list; this only checks the line's -# shape. Reads the body from the event payload; no token, checkout or code run. +# Every pull request into the native release branch says whether it changes +# what runs, so "merged" is never mistaken for "live". The value is opaque on +# purpose: "fleet" means the private deployment config decides where it runs, +# and no host names are published here. This job reads only the event payload: +# no checkout, no token and no repository code, so it runs on a hosted runner +# and needs no actor guard. on: pull_request: branches: [release/native-0.1.10] @@ -17,36 +19,30 @@ concurrency: jobs: deploy-line: - if: >- - ${{ - github.repository == 'nullStack65/t3code' && - 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) - }} + if: ${{ github.repository == 'nullStack65/t3code' }} name: Deploy line declared - runs-on: t3code-ci-arc + runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: 'Require one Deploy line (none, or comma-separated targets)' + - name: 'Require one Deploy line: none or fleet' shell: bash env: PR_BODY: ${{ github.event.pull_request.body }} run: | set -euo pipefail - lines="$(printf '%s\n' "${PR_BODY:-}" | tr -d '\r' | grep -E '^[[:space:]]*Deploy:' || true)" + # Count "Deploy:" lines at the start of a line, outside fenced code blocks. + lines="$(printf '%s\n' "${PR_BODY:-}" | tr -d '\r' \ + | awk '/^[[:space:]]*(```|~~~)/ { fenced = !fenced; next } !fenced && /^Deploy:/' || true)" count="$(printf '%s' "$lines" | grep -c . || true)" if test "$count" -ne 1; then - echo "::error::Add exactly one 'Deploy:' line to the PR body: 'Deploy: none' or 'Deploy: , ' (found $count)." + echo "::error::Add exactly one line 'Deploy: none' or 'Deploy: fleet' to the PR body (found $count)." exit 1 fi - value="$(printf '%s' "$lines" | sed -E 's/^[[:space:]]*Deploy:[[:space:]]*//; s/[[:space:]]+$//')" - if test "$value" = none; then - echo "Deploy: none" - exit 0 - fi - if ! printf '%s' "$value" | grep -Eq '^[a-z0-9][a-z0-9-]*([[:space:]]*,[[:space:]]*[a-z0-9][a-z0-9-]*)*$'; then - echo "::error::'Deploy: $value' must be 'none' or comma-separated lowercase host ids." - exit 1 - fi - echo "Deploy targets: $value" + value="$(printf '%s' "$lines" | sed -E 's/^Deploy:[[:space:]]*//; s/[[:space:]]+$//')" + case "$value" in + none | fleet) echo "Deploy: $value" ;; + *) + echo "::error::The Deploy line must be 'Deploy: none' or 'Deploy: fleet'." + exit 1 + ;; + esac