Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/closura-arc-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -13,14 +15,16 @@ 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:
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' &&
Expand All @@ -32,7 +36,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))
)
}}
Expand Down Expand Up @@ -165,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
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/closura-deploy-line.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Closura deploy line

# 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]
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' }}
name: Deploy line declared
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: 'Require one Deploy line: none or fleet'
shell: bash
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
set -euo pipefail
# 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 line 'Deploy: none' or 'Deploy: fleet' to the PR body (found $count)."
exit 1
fi
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
7 changes: 7 additions & 0 deletions apps/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/environment/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions apps/server/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() ?? "",
Expand Down
6 changes: 6 additions & 0 deletions packages/contracts/src/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading