diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4c45728c234..59683bef2d2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: # open: if the diff cannot be resolved, everything runs. changes: name: Changes - runs-on: blacksmith-2vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 5 outputs: typecheck: ${{ steps.detect.outputs.typecheck }} @@ -63,7 +63,7 @@ jobs: contents: read id-token: write name: Lint - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -119,7 +119,7 @@ jobs: name: Build and Typecheck needs: changes if: ${{ !cancelled() && (needs.changes.outputs.build != 'false' || needs.changes.outputs.typecheck != 'false') }} - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -213,7 +213,7 @@ jobs: name: Test needs: changes if: ${{ !cancelled() && needs.changes.outputs.test != 'false' }} - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -289,7 +289,7 @@ jobs: name: Test Web needs: changes if: ${{ !cancelled() && needs.changes.outputs.test_web != 'false' }} - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -353,7 +353,7 @@ jobs: contents: read id-token: write name: Test Server ${{ matrix.shard }} - runs-on: blacksmith-4vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }} # Shards take 2-5 minutes. When the shared task cache throttles reads, each # failed fetch stalls vp for 15-90s, which pushed shards past 10 minutes. timeout-minutes: 20 @@ -469,7 +469,7 @@ jobs: name: Rust needs: changes if: ${{ !cancelled() && needs.changes.outputs.rust != 'false' }} - runs-on: blacksmith-4vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -502,7 +502,7 @@ jobs: name: Mobile Native Static Analysis needs: changes if: ${{ !cancelled() && needs.changes.outputs.mobile_native != 'false' }} - runs-on: blacksmith-6vcpu-macos-26 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-6vcpu-macos-26' || 'macos-latest' }} timeout-minutes: 10 steps: - name: Checkout @@ -535,7 +535,7 @@ jobs: name: Release Smoke needs: changes if: ${{ !cancelled() && needs.changes.outputs.release_smoke != 'false' }} - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 10 steps: - name: Checkout @@ -575,7 +575,7 @@ jobs: mobile_native_static_analysis, release_smoke, ] - runs-on: blacksmith-2vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 5 steps: - name: Require every job to pass diff --git a/.github/workflows/mobile-fingerprint-check.yml b/.github/workflows/mobile-fingerprint-check.yml index 9fabb3a5f2ad..3ba993344d6a 100644 --- a/.github/workflows/mobile-fingerprint-check.yml +++ b/.github/workflows/mobile-fingerprint-check.yml @@ -25,7 +25,7 @@ concurrency: jobs: fingerprint: name: Native fingerprint diff - runs-on: blacksmith-8vcpu-ubuntu-2404 + runs-on: ${{ github.repository_owner == 'pingdotgg' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} permissions: contents: read env: diff --git a/FORK.md b/FORK.md new file mode 100644 index 000000000000..23f7f39d23ae --- /dev/null +++ b/FORK.md @@ -0,0 +1,32 @@ +# Amartya's T3 Code fork + +This repository tracks [pingdotgg/t3code](https://github.com/pingdotgg/t3code). `main` is a 1:1 mirror. Fork behavior lives on `patches` and is cherry-picked onto each upstream **stable** tag by `.github/workflows/fork-stable-release.yml`. + +The contract for those patches is [PATCH.md](PATCH.md). + +## First install + +1. Wait for a GitHub Release on [amartya18/t3code](https://github.com/amartya18/t3code/releases) with a macOS zip or dmg and `latest-mac.yml`. +2. Download the arm64 zip or dmg. This is a self-signed build, not a Developer ID build. +3. Open it. Gatekeeper will warn. Open anyway from System Settings → Privacy & Security, or right-click Open. +4. Keychain may ask to trust the signing identity. Allow it. Later updates from this fork use the same identity, so Squirrel.Mac accepts them. +5. Do not replace an official T3 Code install in place and expect the official updater to switch feeds. Official builds look at pingdotgg/t3code. This fork's `app-update.yml` looks at amartya18/t3code. Install this build as your daily app if you want fork updates. Bundle id and user-data dir match upstream (`com.t3tools.t3code`, `~/Library/Application Support/t3code` with legacy `T3 Code (Alpha)`), so existing threads stay. + +## Add or change a patch + +1. Branch from `patches`. +2. Make one concern. Keep it rebase-friendly. +3. Update [PATCH.md](PATCH.md) in the same change. +4. Open a PR that targets `patches`, not `main`. Do not merge into `main`. + +## Conflicts + +The daily workflow cherry-picks `patches` onto the newest upstream stable tag. If git cannot apply a patch, it opens a GitHub issue and publishes nothing. Rebase `patches` onto the new tag, restore the PATCH.md invariants, and re-run the workflow. + +Prefer upstream on conflicted hunks, then re-apply only the contract in PATCH.md. If the invariant cannot be re-expressed without changing behavior, leave the conflict and say which invariant is at risk. + +## Rollback + +- App: download an older fork release zip and replace the `.app`. Same signing identity, so this is a downgrade the updater will try to replace on the next check. +- Patches: reset `patches` to the last known-good commit. `main` stays a mirror; do not rewind it with fork commits. +- Stop taking updates: quit the app, or switch back to an official pingdotgg build (that is a different signing identity; it will not consume this feed). diff --git a/PATCH.md b/PATCH.md new file mode 100644 index 000000000000..6bc3a3cb3495 --- /dev/null +++ b/PATCH.md @@ -0,0 +1,35 @@ +# Fork patches + +This branch (`patches`) is the personal [amartya18/t3code](https://github.com/amartya18/t3code) stack. Cherry-pick it onto any upstream **stable** tag. `main` is a 1:1 mirror of [pingdotgg/t3code](https://github.com/pingdotgg/t3code) and must not receive these commits. + +See [FORK.md](FORK.md) for install, adding patches, conflicts, and rollback. + +## Behavioral contract + +### Signed macOS builds without Apple Developer ID + +1. `--signed` on macOS still codesigns via `scripts/sign-macos.ts` and `CSC_LINK`. +2. If `T3CODE_APPLE_TEAM_ID` and `T3CODE_MACOS_PROVISIONING_PROFILE` are both unset or empty, the build does **not** resolve passkey signing, does **not** embed a provisioning profile, sets `mac.notarize: false` and `mac.forceCodeSigning: true`, and signs with hardened-runtime entitlements (JIT, disable-library-validation, camera, microphone) that do **not** include associated-domains or a team identifier. +3. If either Apple variable is set, the upstream passkey path still runs and still fails closed on a missing profile, bad team id, or bad RP domain. +4. Bundle id stays `com.t3tools.t3code`. User-data directory stays `t3code` (legacy `T3 Code (Alpha)`). + +### GitHub-hosted CI on this fork + +5. `ci.yml` and `mobile-fingerprint-check.yml` use GitHub-hosted `ubuntu-24.04` / `macos-latest` when `github.repository_owner != pingdotgg`. pingdotgg keeps Blacksmith. `ubuntu-latest` is Ubuntu 26, which Playwright 1.60 cannot install Chromium on. +6. Two v0.1.6 tests are adjusted so GitHub-hosted CI can go green: storage cleanup accepts Git 2.56's gitfile fatal instead of treating a missing gitdir as a branch change, and the usage "windows it reaches" fixture stays inside the 92-day cache retention window via `Clock.currentTimeMillis` (not `Date.now()`, which lint forbids in tests). +7. The workspace PDF scroll/zoom browser test waits up to 30s for `1 / 3 pages` and has a 60s test budget. GitHub-hosted `ubuntu-24.04` (4 vCPU) is slower than Blacksmith 8vcpu; the 15s default cuts off first paint. + +## Maintained files + +- `scripts/build-desktop-artifact.ts` (+ `.test.ts`) +- `.github/workflows/ci.yml` +- `.github/workflows/mobile-fingerprint-check.yml` +- `apps/server/src/storageCleanup.test.ts` +- `apps/server/src/usage/UsageService.test.ts` +- `apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx` + +## Dropped from upstream signing + +- Notarization (no Apple notary credentials) +- Associated-domain / passkey entitlements (no Apple team provisioning profile) +- Clerk desktop passkeys on this fork diff --git a/apps/server/src/storageCleanup.test.ts b/apps/server/src/storageCleanup.test.ts index 9604e67cfcf6..007c62cf3365 100644 --- a/apps/server/src/storageCleanup.test.ts +++ b/apps/server/src/storageCleanup.test.ts @@ -2050,7 +2050,16 @@ describe("storage cleanup reports and local file policies", () => { yield* fs.remove(`${index.trim()}.lock`); const gitFile = yield* fs.readFileString(`${worktree}/.git`); yield* fs.writeFileString(`${worktree}/.git`, "gitdir: /missing-git-directory\n"); - expect((yield* service.runNow).entries[0]).toMatchObject(changed); + // Git 2.43 treats a missing gitdir as a branch change (kept). Git 2.56 + // on GitHub-hosted runners fatals ("gitfile does not point to a valid + // repository"). Either way the worktree must not be removed. + const missingGit = (yield* service.runNow).entries[0]; + expect(missingGit?.outcome).not.toBe("removed"); + if (missingGit?.outcome === "failed") { + expect(missingGit.reason).toContain("gitfile"); + } else { + expect(missingGit).toMatchObject(changed); + } yield* fs.writeFileString(`${worktree}/.git`, gitFile); expect((yield* service.runNow).entries[0]).toMatchObject({ outcome: "removed" }); expect(fullStatusCalls()).toBe(0); diff --git a/apps/server/src/usage/UsageService.test.ts b/apps/server/src/usage/UsageService.test.ts index 9600f0a45adf..429c10e4c331 100644 --- a/apps/server/src/usage/UsageService.test.ts +++ b/apps/server/src/usage/UsageService.test.ts @@ -22,6 +22,7 @@ import { type UsageSummaryInput, } from "@t3tools/contracts"; import * as Duration from "effect/Duration"; +import * as DateTime from "effect/DateTime"; import * as Clock from "effect/Clock"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; @@ -2609,27 +2610,44 @@ describe("UsageService", () => { it.live("reports saved usage of a removed directory only for windows it reaches", () => Effect.gen(function* () { const { transcript, settings, home } = yield* setup; + // Cache retention is 92 days. Hard-coded 2026-08-01 dates fall out of + // that window once "now" is early November 2026, so the file mtime and + // the windows under test stay 10 days behind the live clock. + const fileMs = (yield* Clock.currentTimeMillis) - 10 * 24 * 60 * 60 * 1000; + const utcDay = (ms: number) => DateTime.formatIso(DateTime.makeUnsafe(ms)).slice(0, 10); + const fileDay = utcDay(fileMs); + const window = { + timeZone: "UTC" as const, + sinceDay: UsageDay.make(utcDay(fileMs - 24 * 60 * 60 * 1000)), + untilDay: UsageDay.make(utcDay(fileMs + 24 * 60 * 60 * 1000)), + }; yield* Effect.promise(async () => { - await NodeFSP.writeFile(transcript, claudeLine(1, 5)); - const lastWrite = Date.parse("2026-08-01T10:00:00Z") / 1000; - await NodeFSP.utimes(transcript, lastWrite, lastWrite); + await NodeFSP.writeFile( + transcript, + claudeLine(1, 5).replace( + "2026-08-01T10:00:00Z", + DateTime.formatIso(DateTime.makeUnsafe(fileMs)), + ), + ); + await NodeFSP.utimes(transcript, fileMs / 1000, fileMs / 1000); }); const service = yield* UsageService.make.pipe( Effect.provide(layerService({ prefix: "usage-service-saved-window-test", home, settings })), ); - const first = yield* service.readSummary(WINDOW); + const first = yield* service.readSummary(window); + assert.strictEqual(first.buckets[0]?.day, fileDay); yield* Effect.promise(() => NodeFSP.rm(NodePath.join(home, "claude", "projects"), { recursive: true }), ); - const reached = yield* service.readSummary(WINDOW); + const reached = yield* service.readSummary(window); assert.deepStrictEqual(reached.buckets, first.buckets); assert.strictEqual(reached.sources[0]?.status, "ok"); const later = yield* service.readSummary({ timeZone: "UTC", - sinceDay: UsageDay.make("2026-08-10"), - untilDay: UsageDay.make("2026-08-12"), + sinceDay: UsageDay.make(utcDay(fileMs + 9 * 24 * 60 * 60 * 1000)), + untilDay: UsageDay.make(utcDay(fileMs + 11 * 24 * 60 * 60 * 1000)), }); assert.deepStrictEqual(later.buckets, []); assert.strictEqual(later.sources[0]?.status, "missing"); diff --git a/apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx b/apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx index fc5a1aa7b91f..bec91a295953 100644 --- a/apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx +++ b/apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx @@ -2516,11 +2516,15 @@ function pdfScroll(screen: Screen) { return { region, canvas, offset, scrollTo }; } +// oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- PDF first paint on GitHub-hosted 4vcpu, not a hidden wait. it("keeps workspace PDF scroll and zoom after reloads", async () => { using fixture = await workspacePdfPreview(); const { preview, urls } = fixture; await using screen = await render(preview(urls.original, "one")); - await expect.element(screen.getByText("1 / 3 pages", { exact: true })).toBeVisible(); + await expect + .element(screen.getByText("1 / 3 pages", { exact: true }), { timeout: 30_000 }) + .toBeVisible(); + await screen.getByRole("button", { name: "Next page", exact: true }).click(); await vi.waitFor(() => expect(screen.container.textContent).toContain("2 / 3 pages")); await screen.getByRole("button", { name: "Next page", exact: true }).click(); @@ -2575,7 +2579,7 @@ it("keeps workspace PDF scroll and zoom after reloads", async () => { expect(region().scrollTop).toBe(0); expect(region().scrollLeft).toBe(0); }); -}); +}, 60_000); it("clamps workspace PDF scroll when pages shrink or disappear", async () => { using fixture = await workspacePdfPreview(); diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts index 165ca80cb30a..b9952a155ed9 100644 --- a/scripts/build-desktop-artifact.test.ts +++ b/scripts/build-desktop-artifact.test.ts @@ -38,8 +38,10 @@ import { packWindowsServerAsar, preflightWindowsDesktopBuild, renderMacPasskeyEntitlements, + renderMacSelfSignedEntitlements, resolveMacWebAuthnEntitlements, resolveMacPasskeySigningConfiguration, + shouldResolveMacPasskeySigning, resolveMergedStageDependencies, resolveBuildOptions, stageWslRuntimeArchive, @@ -546,6 +548,76 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { ), ); + it.effect( + "signed macOS builds without a passkey profile skip notarization and provisioning", + () => + Effect.gen(function* () { + const signedSelf = yield* createBuildConfig("mac", "dmg", "0.1.6", true, false, undefined, { + entitlementsPath: "/tmp/entitlements.mac.plist", + }); + const mac = signedSelf.mac as Record; + assert.equal(mac.notarize, false); + assert.equal(mac.forceCodeSigning, true); + assert.match(String(mac.sign), /scripts[\\/]sign-macos\.ts$/); + assert.notProperty(mac, "provisioningProfile"); + assert.equal(mac.entitlements, "/tmp/entitlements.mac.plist"); + + const signedPasskeys = yield* createBuildConfig( + "mac", + "dmg", + "0.1.6", + true, + false, + undefined, + { + entitlementsPath: "/tmp/entitlements.mac.plist", + provisioningProfilePath: "/tmp/t3code.provisionprofile", + }, + ); + const passkeyMac = signedPasskeys.mac as Record; + assert.notProperty(passkeyMac, "notarize"); + assert.equal(passkeyMac.forceCodeSigning, true); + assert.equal(passkeyMac.provisioningProfile, "/tmp/t3code.provisionprofile"); + assert.equal(passkeyMac.entitlements, "/tmp/entitlements.mac.plist"); + }).pipe( + Effect.provide( + ConfigProvider.layer( + ConfigProvider.fromEnv({ env: { GITHUB_REPOSITORY: "amartya18/t3code" } }), + ), + ), + ), + ); + + it.effect("resolves the GitHub update feed from T3CODE_DESKTOP_UPDATE_REPOSITORY", () => + Effect.gen(function* () { + const config = yield* createBuildConfig( + "mac", + "dmg", + "0.1.6", + false, + false, + undefined, + undefined, + ); + assert.deepStrictEqual(config.publish, [ + { + provider: "github", + owner: "amartya18", + repo: "t3code", + releaseType: "release", + }, + ]); + }).pipe( + Effect.provide( + ConfigProvider.layer( + ConfigProvider.fromEnv({ + env: { T3CODE_DESKTOP_UPDATE_REPOSITORY: "amartya18/t3code" }, + }), + ), + ), + ), + ); + // pnpm writes "set this to true or false" placeholders into allowBuilds when a // tarball changes. pnpm ignores them, but the release build decode rejects them. it.effect("decodes the repo allowBuilds and every file: tarball it names exists", () => @@ -1490,6 +1562,39 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => { ); }); + it("self-signed mac entitlements keep camera, mic, and JIT without Apple team claims", () => { + const entitlements = renderMacSelfSignedEntitlements(); + assert.match(entitlements, /com\.apple\.security\.cs\.allow-jit<\/key>\s*/u); + assert.match( + entitlements, + /com\.apple\.security\.cs\.disable-library-validation<\/key>\s*/u, + ); + assert.match(entitlements, /com\.apple\.security\.device\.camera<\/key>\s*/u); + assert.match(entitlements, /com\.apple\.security\.device\.audio-input<\/key>\s*/u); + assert.notInclude(entitlements, "com.apple.application-identifier"); + assert.notInclude(entitlements, "com.apple.developer.team-identifier"); + assert.notInclude(entitlements, "com.apple.developer.associated-domains"); + assert.notInclude(entitlements, "webcredentials:"); + }); + + it("skips passkey resolution when Apple team id and provisioning profile are both absent", () => { + assert.equal(shouldResolveMacPasskeySigning({}), false); + assert.equal( + shouldResolveMacPasskeySigning({ + T3CODE_APPLE_TEAM_ID: " ", + T3CODE_MACOS_PROVISIONING_PROFILE: "", + }), + false, + ); + assert.equal(shouldResolveMacPasskeySigning({ T3CODE_APPLE_TEAM_ID: "ABC1234567" }), true); + assert.equal( + shouldResolveMacPasskeySigning({ + T3CODE_MACOS_PROVISIONING_PROFILE: "/tmp/t3code.provisionprofile", + }), + true, + ); + }); + it("rejects incomplete macOS passkey signing configuration", () => { const captureError = (env: Readonly>) => { try { diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 8ba7f1adcbbd..c1b5869e6be4 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -1243,6 +1243,15 @@ function normalizePasskeyRpDomain(value: string): string { return parsed.hostname; } +/** True when the env asks for Developer ID passkey signing. Empty means self-signed, no passkeys. */ +export function shouldResolveMacPasskeySigning( + env: Readonly>, +): boolean { + const teamId = env.T3CODE_APPLE_TEAM_ID?.trim() ?? ""; + const provisioningProfilePath = env.T3CODE_MACOS_PROVISIONING_PROFILE?.trim() ?? ""; + return teamId.length > 0 || provisioningProfilePath.length > 0; +} + export function resolveMacPasskeySigningConfiguration( env: Readonly>, ): MacPasskeySigningConfiguration { @@ -1392,6 +1401,31 @@ ${associatedDomains} `; } +/** Hardened-runtime claims a self-signed build can make without a provisioning profile. */ +export function renderMacSelfSignedEntitlements(): string { + return ` + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + + com.apple.security.device.camera + + com.apple.security.device.audio-input + + + +`; +} + export function resolveFffNativeDependencies( platform: typeof BuildPlatform.Type, arch: typeof BuildArch.Type, @@ -2764,7 +2798,7 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( macPasskeySigning: | { readonly entitlementsPath: string; - readonly provisioningProfilePath: string; + readonly provisioningProfilePath?: string; } | undefined, wslRuntimeBundled = false, @@ -2855,12 +2889,15 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( role: "Viewer", }, ], - ...(signed ? { sign: path.join(repoRoot, "scripts/sign-macos.ts") } : {}), - ...(macPasskeySigning - ? { - entitlements: macPasskeySigning.entitlementsPath, - provisioningProfile: macPasskeySigning.provisioningProfilePath, - } + ...(signed + ? { sign: path.join(repoRoot, "scripts/sign-macos.ts"), forceCodeSigning: true } + : {}), + ...(signed && macPasskeySigning?.provisioningProfilePath === undefined + ? { notarize: false } + : {}), + ...(macPasskeySigning ? { entitlements: macPasskeySigning.entitlementsPath } : {}), + ...(macPasskeySigning?.provisioningProfilePath !== undefined + ? { provisioningProfile: macPasskeySigning.provisioningProfilePath } : {}), }; } @@ -3794,10 +3831,11 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f const stageProdResourcesDir = path.join(stageAppDir, "apps/desktop/prod-resources"); yield* fs.copy(stageResourcesDir, stageProdResourcesDir); + const repoEnv = loadRepoEnv({ repoRoot }); const configuredMacPasskeySigning = - options.platform === "mac" && options.signed + options.platform === "mac" && options.signed && shouldResolveMacPasskeySigning(repoEnv) ? yield* Effect.try({ - try: () => resolveMacPasskeySigningConfiguration(loadRepoEnv({ repoRoot })), + try: () => resolveMacPasskeySigningConfiguration(repoEnv), catch: MacPasskeySigningConfigurationResolutionError.fromCause, }) : undefined; @@ -3810,9 +3848,15 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f ), } : undefined; - const macEntitlementsPath = macPasskeySigning - ? path.join(stageAppDir, "entitlements.mac.plist") - : undefined; + if (options.platform === "mac" && options.signed && macPasskeySigning === undefined) { + yield* Effect.log( + "[desktop-artifact] macOS signing without passkey entitlements or notarization (no Apple team id / provisioning profile).", + ); + } + const macEntitlementsPath = + options.platform === "mac" && options.signed + ? path.join(stageAppDir, "entitlements.mac.plist") + : undefined; let macWebAuthn: MacWebAuthnEntitlements | undefined; if (macPasskeySigning && macEntitlementsPath) { if (!(yield* fs.exists(macPasskeySigning.provisioningProfilePath))) { @@ -3831,6 +3875,8 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f macEntitlementsPath, renderMacPasskeyEntitlements(macPasskeySigning, macWebAuthn), ); + } else if (macEntitlementsPath !== undefined) { + yield* fs.writeFileString(macEntitlementsPath, renderMacSelfSignedEntitlements()); } const stageDependencies = @@ -3873,10 +3919,12 @@ const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(f options.signed, options.mockUpdates, options.mockUpdateServerPort, - macPasskeySigning && macEntitlementsPath + macEntitlementsPath !== undefined ? { entitlementsPath: macEntitlementsPath, - provisioningProfilePath: macPasskeySigning.provisioningProfilePath, + ...(macPasskeySigning !== undefined + ? { provisioningProfilePath: macPasskeySigning.provisioningProfilePath } + : {}), } : undefined, bundlesWslRuntime({ platform: options.platform, runtimeArchivePath: options.wslRuntime }),