Skip to content

Commit a4b43a3

Browse files
radroidclaude
authored andcommitted
fix(t3x): give the fork its own bundle id, so it stops sharing TCC rows with upstream (#70)
Stable signing was necessary but not sufficient. macOS stores one TCC permission row per (service, bundle id), and both apps report the same id: $ mdls -name kMDItemCFBundleIdentifier "/Applications/T3 Code (Alpha).app" \ "/Applications/T3 Code (Nightly).app" com.t3tools.t3code com.t3tools.t3code So the fork's build and upstream's nightly shared one row per permission, and whichever launched last owned it — the other was re-prompted no matter how well either was signed. Anyone running both was getting dialogs from this on top of the cdhash problem. The fork now uses dev.curlycloud.coil, after coil (coil.curlycloud.dev). DESKTOP_APP_ID becomes an env escape hatch rather than a changed literal: `process.env.T3X_DESKTOP_APP_ID?.trim() || "com.t3tools.t3code"`. That keeps upstream's default, upstream's three assertions on the value, and upstream's behaviour on an unset environment — a changed literal would have cost a second seam row on build-desktop-artifact.test.ts as well. One line, ten of comment, recorded in SEAMS.md as the ledger's 38th row and its first deletion. Two deliberate non-changes: - productName stays "T3 Code (Alpha)". The updater refuses an install when the .app name inside the dmg differs from the installed one, so renaming the app would break the update path this is meant to make quiet (#71). - User data does not move: ~/Library/Application Support/t3code comes from a hardcoded userDataDirName, not from the bundle id. Landing in the same release as the signing change costs ONE round of permission prompts between them rather than two. Guarded from the fork side, because a silent revert here is invisible until the dialogs come back days later on someone's machine: mac-signature.test.ts asserts the hook still exists and that the release workflow, the local autobuild and the certificate setup all set it to the same value, and verify-mac-signature.ts fails any artifact whose signing identifier is not that value. The one remaining failing test is the pinned designated requirement, which does not exist yet — it lands with the certificate's trust step. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent 6a380d0 commit a4b43a3

9 files changed

Lines changed: 894 additions & 46 deletions

File tree

‎.github/workflows/t3x-release.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ jobs:
421421
# "not specified" and falls back to the ad-hoc path. The verify step below is what turns
422422
# that silent fallback into a visible one.
423423
CSC_NAME: ${{ steps.signing.outputs.identity }}
424+
# The other half of #70. macOS stores one permission row per (service, bundle id), and this
425+
# fork's app shared `com.t3tools.t3code` with upstream's nightly — so whichever was launched
426+
# last owned the grants and the other got re-prompted, however well either was signed.
427+
# Keep this in step with DESKTOP_BUNDLE_IDENTIFIER in scripts/t3x/mac-signature.ts; a test
428+
# asserts the two agree, and the verify step below fails an artifact carrying the wrong id.
429+
T3X_DESKTOP_APP_ID: dev.curlycloud.coil
424430
run: |
425431
set -euo pipefail
426432
node scripts/build-desktop-artifact.ts \

‎docs/superpowers/plans/2026-08-10-t3x-homepage-cloudflare.md‎

Lines changed: 700 additions & 0 deletions
Large diffs are not rendered by default.

‎docs/t3x/SEAMS.md‎

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
**The authoritative list of every upstream-owned file this fork edits.**
44

5-
Measured, not asserted: **37 upstream-owned files, +1957 / -912 lines**, against merge-base
6-
`78f462c4e` (upstream v0.0.33, the 2026-08-10 sync). Everything else the fork adds lives in new
5+
Measured, not asserted: **38 upstream-owned files, +1968 / -913 lines**, against merge-base
6+
`78f462c4e` (upstream v0.0.33, the 2026-08-10 sync). The 38th, and the only deletion added since the
7+
2026-08-10 baseline, is `scripts/build-desktop-artifact.ts` — one line for #70, deliberately shaped as
8+
an env escape hatch so upstream's default and its tests survive it. Everything else the fork adds lives in new
79
files upstream has never seen and cannot conflict.
810

911
> **The file-list half has now survived two consecutive rebases unchanged** — same 37 files, same
@@ -12,6 +14,12 @@ files upstream has never seen and cannot conflict.
1214
> `__root.tsx` +9/-0), so anything that displaced upstream content would move a deletion count. When
1315
> #5624 removed a line from `channels.ts` and `preload.ts`, the removal survived precisely because
1416
> the fork never re-adds — it only appends.
17+
>
18+
> **2026-08-11: the first exception, and it is a small one.** `scripts/build-desktop-artifact.ts` (#70)
19+
> replaces one line — a constant's initialiser — so the fork's total is no longer +N/-0 on every shared
20+
> file, and the invariant above weakens from "no deletions anywhere" to "one known deletion, at a known
21+
> line". Keep it that way. The additive rule is what makes a clean rebase evidence of anything, so a
22+
> second displacement should have to argue for itself in this file the way that one did.
1523
1624
> **Read the two dependency rows with their note, not their number.** `pnpm-lock.yaml` sits at
1725
> +317 / -737 and so at risk **60078**, still the top row by a wide margin. That figure is the
@@ -44,6 +52,7 @@ files upstream has never seen and cannot conflict.
4452
> silencing upstream's updater is done by building with `GITHUB_REPOSITORY: ""` rather than editing
4553
> `DesktopUpdates.ts`, and serialising the desktop build for #47 is done with
4654
> `vp run build:desktop --concurrency-limit 1` rather than editing `build-desktop-artifact.ts`.
55+
> (That file has since taken one line for #70 — see below. #47 still does not need it.)
4756
> The integration landed on **existing** rows and grew six of them — `contracts/src/ipc.ts`,
4857
> `preload.ts`, `ipc/channels.ts`, `ipc/DesktopIpcHandlers.ts`, `main.ts`, `__root.tsx` — by +57
4958
> lines in total. Each is the aggregator-shaped edit the rule above asks for: one import and one
@@ -62,17 +71,32 @@ files upstream has never seen and cannot conflict.
6271
> `git log <merge-base>..upstream/main -- apps/marketing` and port anything worth having (pricing
6372
> changes, new pages, security-relevant fixes) by hand.
6473
65-
> **macOS code signing adds no NEW rows either — and the reason is worth keeping.** Issue #70 (every
66-
> update re-requesting every macOS permission) was diagnosed as needing a third signing mode inside
67-
> `scripts/build-desktop-artifact.ts`, because that file forces `CSC_IDENTITY_AUTO_DISCOVERY=false`
68-
> for unsigned builds. It did not. app-builder-lib consults that flag **only when no identity was
69-
> named**: `findIdentity()` reads `qualifier || process.env.CSC_NAME` first and, when that is
70-
> non-empty, goes straight to `security find-identity`. So exporting `CSC_NAME` around the existing
71-
> unsigned build is the whole mechanism, and it lives in `.github/workflows/t3x-release.yml` and
72-
> `scripts/t3x/` — a row on that hot upstream file was priced, considered, and then not needed.
73-
> The general lesson: before spending a row to add a mode, check whether the mode's escape hatch is
74-
> already an environment variable. `--concurrency-limit` for #47 and `GITHUB_REPOSITORY: ""` for the
75-
> updater were the same shape of answer.
74+
> **macOS code signing (#70) costs ONE line on `build-desktop-artifact.ts`, and not the one the issue
75+
> predicted.** The issue expected a third signing mode in that file, because it forces
76+
> `CSC_IDENTITY_AUTO_DISCOVERY=false` for unsigned builds. That turned out to be free: app-builder-lib
77+
> consults the flag **only when no identity was named** — `findIdentity()` reads
78+
> `qualifier || process.env.CSC_NAME` first and, when non-empty, goes straight to
79+
> `security find-identity`. So the signing half is entirely fork-owned (`CSC_NAME` exported by
80+
> `.github/workflows/t3x-release.yml` and `scripts/t3x/auto-build-desktop.sh`), at zero rows.
81+
>
82+
> The row is spent on the **second** cause instead, which no environment variable existed for: macOS
83+
> stores one TCC permission row per `(service, bundle id)`, and the fork shared
84+
> `com.t3tools.t3code` with upstream's nightly — so whichever app launched last owned the grants and
85+
> the other was re-prompted, however well either was signed. `DESKTOP_APP_ID` is now
86+
> `process.env.T3X_DESKTOP_APP_ID?.trim() || "com.t3tools.t3code"`, and the fork sets that variable to
87+
> `dev.curlycloud.coil`.
88+
>
89+
> **The shape of the edit is the point.** A changed literal would have been +1/-1 and would have
90+
> broken three upstream assertions in `build-desktop-artifact.test.ts`, adding a second row on a
91+
> second upstream file. An env escape hatch keeps upstream's default, its tests, and its behaviour on
92+
> an unset environment — the same answer as `--concurrency-limit` for #47 and `GITHUB_REPOSITORY: ""`
93+
> for the updater. Before spending a row to change a value, check whether it can become a variable
94+
> upstream would have accepted.
95+
>
96+
> The compensating control for a seam this quiet is in fork-owned tests: `mac-signature.test.ts`
97+
> asserts the hook still exists in that file and that every build path sets it, and
98+
> `verify-mac-signature.ts` fails any artifact whose signing identifier is not the expected one. A
99+
> sync that reverts the line cannot ship silently.
76100
77101
The churn and risk columns are measured against that same merge-base, over the 60 days preceding it.
78102
The window slides forward at every sync, so these figures move even when the fork does not.
@@ -169,6 +193,7 @@ Sorted by risk, worst first.
169193
| `apps/desktop/src/preload.ts` | +29/-0 | 14 | **406** | `showNotification` + `onNotificationActivated` on the exposed bridge, plus the `t3xUpdate` bridge object (get / subscribe / restart / dismiss) |
170194
| `packages/contracts/src/settings.ts` | +7/-2 | 23 | **207** | `notifyOnNeedsInput` (**persisted schema**) + Claude `homePath` placeholder/description |
171195
| `apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift` | +33/-0 | 6 | **198** | Shift+Return newline vs. bare Return submit |
196+
| `scripts/build-desktop-artifact.ts` | +11/-1 | 15 | **180** | Issue #70: `DESKTOP_APP_ID` reads `process.env.T3X_DESKTOP_APP_ID` before falling back to upstream's `com.t3tools.t3code`, so the fork's app owns its own TCC permission rows instead of sharing them with upstream's nightly. Ten of the eleven added lines are the comment explaining that. An env hook rather than a changed literal on purpose: the literal would also have broken three upstream assertions in `build-desktop-artifact.test.ts` and cost a second row. Guarded from the fork side by `scripts/t3x/mac-signature.test.ts` (the hook exists, every build path sets it) and by `scripts/t3x/verify-mac-signature.ts` (the shipped artifact carries the expected identifier) |
172197
| `apps/desktop/src/backend/DesktopBackendConfiguration.ts` | +29/-0 | 6 | **174** | Backend heap headroom (`NODE_OPTIONS`) |
173198
| `apps/desktop/src/backend/DesktopBackendConfiguration.test.ts` | +42/-0 | 4 | **168** | Heap-headroom assertions |
174199
| `apps/desktop/src/main.ts` | +9/-0 | 18 | **162** | `ElectronNotification` layer + the `T3xUpdateDelivery` layer |

‎docs/t3x/mac-signing-runbook.md‎

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ Program; this does not.
124124
**Anyone else's Mac.** The private key lives on one machine and in this repo's secrets. A different
125125
person building this fork gets their own identity, hence their own prompts, once.
126126

127-
**The bundle id shared with upstream's build.** Both apps report
128-
`CFBundleIdentifier = com.t3tools.t3code`:
127+
**Windows installs made before this.** `appId` is also the NSIS product identity, so the first
128+
Windows build after the bundle id changed installs alongside the old one instead of upgrading it.
129+
Uninstall the old entry by hand once. macOS is unaffected: the updater targets the `.app` by name,
130+
and the name did not change.
131+
132+
## The second cause: a bundle id shared with upstream
133+
134+
Stable signing was necessary but not sufficient, because both apps used to report the same bundle id:
129135

130136
```
131137
$ mdls -name kMDItemCFBundleIdentifier "/Applications/T3 Code (Alpha).app" \
@@ -134,13 +140,29 @@ com.t3tools.t3code
134140
com.t3tools.t3code
135141
```
136142

137-
macOS keys a TCC row on `(service, client)` where `client` is that bundle id, so the two apps share
138-
one row per permission and whichever launched most recently owns it. If you run both `T3 Code (Alpha)`
139-
and upstream's `T3 Code (Nightly)`, expect a prompt when you switch — this fix cannot help with that,
140-
because the two apps are the same app to macOS. Options, in increasing cost: stop keeping Nightly
141-
installed, or give the fork its own bundle id (which means editing `DESKTOP_APP_ID` in
142-
`scripts/build-desktop-artifact.ts` — an upstream-owned file, so a new `SEAMS.md` row, plus one more
143-
round of prompts, plus a second copy of everything keyed to that id).
143+
macOS stores **one TCC row per `(service, client)`**, where `client` is that bundle id. Two apps with
144+
one id share one row per permission, so whichever launched most recently owned the grant and the other
145+
was re-prompted — no matter how perfectly either was signed. Anyone running the fork's build next to
146+
upstream's nightly was getting dialogs from this even with a stable certificate.
147+
148+
So the fork now has its own: **`dev.curlycloud.coil`**, after `coil` (coil.curlycloud.dev). Set
149+
through `T3X_DESKTOP_APP_ID`, which is the one upstream-owned line this whole change spends —
150+
`DESKTOP_APP_ID` in `scripts/build-desktop-artifact.ts` reads it and falls back to upstream's value,
151+
so upstream's own assertions on that constant still pass and an unset environment builds exactly what
152+
upstream builds. See `SEAMS.md`.
153+
154+
Two deliberate non-changes:
155+
156+
- **`productName` stays `T3 Code (Alpha)`.** The updater refuses an install when the `.app` name inside
157+
the dmg differs from the installed one (`resolveMacInstallTarget`), so renaming the app would break
158+
the update path this is meant to make quiet. The rename stops at the bundle id (#71).
159+
- **User data does not move.** `~/Library/Application Support/t3code` comes from a hardcoded
160+
`userDataDirName`, not from the bundle id — threads, settings and sessions are untouched.
161+
162+
Since it lands in the same release as the signing change, the two identity changes cost **one**
163+
round of prompts between them, not two. `scripts/t3x/mac-signature.test.ts` asserts every build path
164+
sets the variable and that the recorded requirement names this id, because a forgotten variable or a
165+
sync that reverts the seam would silently put the fork back to sharing upstream's row.
144166

145167
## Why no upstream edit was needed
146168

‎scripts/build-desktop-artifact.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,17 @@ import { Command, Flag } from "effect/unstable/cli";
5151
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
5252

5353
const LINUX_ICON_SIZES = [16, 22, 24, 32, 48, 64, 128, 256, 512] as const;
54-
const DESKTOP_APP_ID = "com.t3tools.t3code";
54+
// t3x fork seam (issue #70). An env escape hatch, not a changed default, so upstream's own
55+
// assertions on this value keep passing and an unset environment builds exactly what upstream does.
56+
//
57+
// macOS stores one TCC permission row per (service, bundle id). This fork's build and upstream's
58+
// nightly are frequently installed side by side and shared `com.t3tools.t3code`, so whichever
59+
// launched last owned the Screen Recording / Accessibility / Files & Folders grants and the other
60+
// was re-prompted. A distinct id for the fork is the only fix — the two apps are otherwise the same
61+
// app to macOS. Set by .github/workflows/t3x-release.yml and scripts/t3x/auto-build-desktop.sh;
62+
// scripts/t3x/verify-mac-signature.ts fails any artifact whose signing identifier is not the
63+
// expected one, so an unset variable cannot ship silently.
64+
const DESKTOP_APP_ID = process.env.T3X_DESKTOP_APP_ID?.trim() || "com.t3tools.t3code";
5565
const APPLE_TEAM_ID_PATTERN = /^[A-Z0-9]{10}$/u;
5666

5767
const BuildPlatform = Schema.Literals(["mac", "linux", "win"]);

‎scripts/t3x/auto-build-desktop.sh‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ acquire_lock() {
334334
# exactly — which is why this needs no upstream edit and no new SEAMS.md row.
335335
SETUP_SIGNING="$SCRIPT_DIR/setup-mac-signing.sh"
336336

337+
# Kept in one place so the build and the verifier cannot disagree about it. The single source of
338+
# truth is DESKTOP_BUNDLE_IDENTIFIER in scripts/t3x/mac-signature.ts, and a test asserts this
339+
# literal matches it.
340+
DESKTOP_APP_ID="dev.curlycloud.coil"
341+
337342
# Prints the identity name, or nothing at all when this machine has none set up. Never fails: an
338343
# unsigned build is worse than a signed one but better than no build.
339344
signing_identity() {
@@ -553,7 +558,13 @@ build_once() {
553558
return 1
554559
fi
555560
log "running: pnpm dist:desktop:dmg:arm64"
556-
if ! ( cd "$REPO" && CSC_NAME="$signing_id" pnpm dist:desktop:dmg:arm64 ); then
561+
# T3X_DESKTOP_APP_ID: the fork's own bundle id (issue #70). macOS keys one permission row per
562+
# (service, bundle id), and sharing `com.t3tools.t3code` with upstream's nightly meant whichever
563+
# app launched last owned the grants. Must match DESKTOP_BUNDLE_IDENTIFIER in
564+
# scripts/t3x/mac-signature.ts — a test asserts it, and verify_signature below fails a build
565+
# whose signing identifier is anything else.
566+
if ! ( cd "$REPO" && CSC_NAME="$signing_id" T3X_DESKTOP_APP_ID="$DESKTOP_APP_ID" \
567+
pnpm dist:desktop:dmg:arm64 ); then
557568
write_status "build-failed" "$cur" "" "pnpm dist:desktop:dmg:arm64 failed"
558569
log "BUILD FAILED for $cur"
559570
return 1

0 commit comments

Comments
 (0)