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
55 changes: 55 additions & 0 deletions .github/fork/carried-prs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"upstream": "pingdotgg/t3code",
"prs": [
{
"number": 15030,
"takenSha": "a2d855c9f602d50da63fea6c07d3ca6c7db36655",
"reason": "iOS race fixes and Android keyboard parity"
},
{
"number": 15975,
"takenSha": "b5d05a6ebf3c0b99a097f2a197983cb1203669c6",
"reason": "Home agent that manages threads across machines"
},
{
"number": 17195,
"takenSha": "31f51f4746d0ed3d59e672bdbb5596e919a73e5d",
"reason": "Android terminal transfers and paints dirty rows only",
"closedUpstream": true
},
{
"number": 17618,
"takenSha": "ce7e86f0aece6a52073c8be09ab3db479c14d532",
"reason": "Claude next-prompt composer ghost text",
"closedUpstream": true
},
{
"number": 17890,
"takenSha": "0a5d3e0083e43946b180dc4cc89568af111c645c",
"reason": "Android subscription usage widgets",
"closedUpstream": true
},
{
"number": 18634,
"takenSha": "6485555d5d7c365849dd6def5a335c8171238ccf",
"reason": "Android tablets launched in landscape open full screen"
},
{
"number": 18839,
"takenSha": "457acb425c5fa5d5248bc0ed646b5ccb68f8f256",
"reason": "Android PR viewer keeps the chat back stack"
},
{
"number": 19273,
"takenSha": "c983c522ad9c2e3ffd5735cdbfca6c073f9cde95",
"reason": "Local-model composer dictation"
},
{
"number": 19424,
"takenSha": "9e5e520f786566b3004a004efc9e21817ad49e9c",
"reason": "Android foldables use the sidebar header",
"note": "Took only the first two commits. Upstream superseded it with merged #21071, #20812 and #20813.",
"closedUpstream": true
}
]
}
29 changes: 29 additions & 0 deletions .github/workflows/fork-carried-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Fork carried PRs

on:
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:

permissions:
contents: read

jobs:
check:
name: Carried upstream PRs drift
if: github.repository == 'issuelt/t3code'
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1
with:
node-version-file: package.json
cache: true
run-install: true
- name: Check carried PRs
env:
GH_TOKEN: ${{ github.token }}
# Explicit bash adds pipefail, so drift still fails the step through tee.
shell: bash
run: node scripts/fork-carried-prs.ts | tee -a "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopStartupRecovery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { DesktopUpdateState } from "@t3tools/contracts";
import { FORK_RELEASES_URL as RELEASES_URL } from "@t3tools/shared/fork";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Option from "effect/Option";
Expand All @@ -18,7 +19,6 @@ import * as DesktopEnvironment from "./DesktopEnvironment.ts";
import * as DesktopObservability from "./DesktopObservability.ts";
import * as DesktopState from "./DesktopState.ts";

const RELEASES_URL = "https://github.com/issuelt/t3code/releases";
const LAST_STARTED_VERSION_FILE = "desktop-last-started-version";
// Buttons are plain links to this host; will-navigate cancels them and runs the action.
const ACTION_ORIGIN = "https://startup-recovery.invalid";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AuthOrchestrationOperateScope } from "@t3tools/contracts";
import { FORK_RELEASES_URL, FORK_REPOSITORY } from "@t3tools/shared/fork";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";

import { canMaintainEnvironment, findEnvironmentUpdate } from "./environment-maintenance";
Expand Down Expand Up @@ -58,7 +59,7 @@ describe("environment release checks", () => {
const signal = new AbortController().signal;
const feed = (...tags: ReadonlyArray<string>) =>
new Response(
`<feed><id>tag:github.com,2008:https://github.com/pingdotgg/t3code/releases</id>${tags
`<feed><id>tag:github.com,2008:${FORK_RELEASES_URL}</id>${tags
.map((tag) => `<entry><id>tag:github.com,2008:Repository/1/${tag}</id></entry>`)
.join("")}</feed>`,
);
Expand All @@ -67,7 +68,7 @@ describe("environment release checks", () => {
vi.stubGlobal(
"fetch",
vi.fn(async (url: string) =>
url === "https://github.com/pingdotgg/t3code/releases.atom"
url === `${FORK_RELEASES_URL}.atom`
? feed(
"desktop-preview",
"v1.0.0-preview.20260924.3",
Expand All @@ -93,11 +94,12 @@ describe("environment release checks", () => {
vi.stubGlobal(
"fetch",
vi.fn(async (url: string) => {
if (url === "https://github.com/pingdotgg/t3code/releases.atom") return feed(...nightlies);
if (url === "https://api.github.com/repos/pingdotgg/t3code/releases?per_page=100&page=1") {
const releasesApi = `https://api.github.com/repos/${FORK_REPOSITORY}/releases?per_page=100`;
if (url === `${FORK_RELEASES_URL}.atom`) return feed(...nightlies);
if (url === `${releasesApi}&page=1`) {
return Response.json(Array.from({ length: 100 }, () => ({ tag_name: "v2.0.0" })));
}
if (url === "https://api.github.com/repos/pingdotgg/t3code/releases?per_page=100&page=2") {
if (url === `${releasesApi}&page=2`) {
return Response.json([
{ tag_name: "v1.0.0-preview.20260925.1", draft: true },
{ tag_name: "v1.0.0-preview.20260924.3" },
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/cli/update.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import type { ManagedUpdatesPolicy } from "@t3tools/contracts";
import { FORK_REPOSITORY } from "@t3tools/shared/fork";
import * as HostProcess from "@t3tools/shared/HostProcess";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
Expand Down Expand Up @@ -43,7 +44,7 @@ it.effect("authenticates each release page until the requested channel is found"
const httpClient = HttpClient.make((request) => {
const url = new URL(request.url);
assert.equal(url.origin, "https://api.github.com");
assert.equal(url.pathname, "/repos/pingdotgg/t3code/releases");
assert.equal(url.pathname, `/repos/${FORK_REPOSITORY}/releases`);
assert.equal(request.headers.accept, "application/vnd.github+json");
assert.equal(request.headers.authorization, "Bearer gh-token");
const page = url.searchParams.get("page") ?? "";
Expand Down
9 changes: 4 additions & 5 deletions apps/web/src/components/desktopUpdate.logic.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
import type { DesktopUpdateState } from "@t3tools/contracts";
import { FORK_RELEASES_URL } from "@t3tools/shared/fork";

import {
canCheckForUpdate,
Expand Down Expand Up @@ -66,13 +67,11 @@ describe("desktop update button state", () => {

describe("desktop update UI helpers", () => {
it.each(["owner/repo/extra", "owner#notes/repo", "owner/repo?tab=notes"])(
"falls back to upstream for an invalid configured repository: %s",
"falls back to the fork for an invalid configured repository: %s",
(repository) => {
expect(getDesktopUpdateReleaseHistoryUrl(repository)).toBe(
"https://github.com/pingdotgg/t3code/releases",
);
expect(getDesktopUpdateReleaseHistoryUrl(repository)).toBe(FORK_RELEASES_URL);
expect(getDesktopUpdateReleaseUrl("1.2.3", repository)).toBe(
"https://github.com/pingdotgg/t3code/releases/tag/v1.2.3",
`${FORK_RELEASES_URL}/tag/v1.2.3`,
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/desktopUpdate.logic.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts";
import { FORK_REPOSITORY as DEFAULT_DESKTOP_RELEASE_REPOSITORY } from "@t3tools/shared/fork";

export type DesktopUpdateButtonAction = "download" | "install" | "none";

const DEFAULT_DESKTOP_RELEASE_REPOSITORY = "pingdotgg/t3code";
const GITHUB_REPOSITORY_SEGMENT = /^[A-Za-z0-9._-]+$/u;

function isValidRepositorySegment(value: string | undefined): value is string {
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@
"types": "./src/cliRelease.ts",
"import": "./src/cliRelease.ts"
},
"./fork": {
"types": "./src/fork.ts",
"import": "./src/fork.ts"
},
"./gitPatchPath": {
"types": "./src/gitPatchPath.ts",
"import": "./src/gitPatchPath.ts"
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/cliRelease.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as Option from "effect/Option";
import * as Schema from "effect/Schema";

import { FORK_REPOSITORY } from "./fork.ts";
import { compareSemverVersions } from "./semver.ts";

const CLI_RELEASE_REPOSITORY = "pingdotgg/t3code";
const CLI_RELEASE_REPOSITORY = FORK_REPOSITORY;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve track-switch versions from the same release source

When Settings → About switches a boot-service environment to another update track, UpdateTrackSwitchDialog still resolves the target through npmReleaseAtom, backed by cloud/npmRelease.ts querying upstream's t3 npm package. However, cloud/selfUpdate.ts installs that exact version through pinnedRuntime.ts, whose download URL now defaults to the fork because of this change. The fork's fork-release.yml publishes independently versioned nightlies, not upstream's stable releases, so switching to Stable now attempts to download an upstream version from the fork and fails instead of updating. Make track-switch resolution and archive downloads use a consistent release source, or explicitly disable unsupported tracks.

AGENTS.md reference: AGENTS.md:L69-L69

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, but the bug predates this PR. The track switch reads its target version from upstream's t3 npm package, and the fork doesn't publish to npm. Before this PR, the switch installed upstream's archive of that version, which quietly moved a fork install onto an upstream build running on a database with fork migrations. Now the download from fork releases fails instead, which is the safer of the two. The fork also has no Stable releases, only nightlies.

The real fix depends on what the fork does about npm (npx t3, and whether to publish or disable tracks it doesn't ship). A follow-up already owns that, so I'm leaving this PR's scope as is.

export const CLI_RELEASES_PAGE_URL = `https://github.com/${CLI_RELEASE_REPOSITORY}/releases`;
export const CLI_RELEASE_CHECKSUMS_FILE = "SHA256SUMS";
export const CLI_RELEASE_BASE_URL_ENV = "T3CODE_RELEASE_BASE_URL";
Expand Down
41 changes: 41 additions & 0 deletions packages/shared/src/fork.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// @effect-diagnostics-next-line nodeBuiltinImport:off -- reads repo files synchronously to cross-check literals.
import * as NodeFS from "node:fs";

import { describe, expect, it } from "vite-plus/test";

import {
CLI_RELEASES_PAGE_URL,
cliReleaseDownloadBaseUrl,
cliReleaseIndexPageUrl,
} from "./cliRelease.ts";
import { FORK_RELEASES_URL, FORK_REPOSITORY } from "./fork.ts";

const repoFile = (path: string) =>
NodeFS.readFileSync(new URL(`../../../${path}`, import.meta.url), "utf8");

// Upstream syncs have reverted the release source to pingdotgg/t3code before.
describe("fork release source", () => {
it("serves CLI updates and downloads from the fork", () => {
expect(CLI_RELEASES_PAGE_URL).toBe(FORK_RELEASES_URL);
expect(cliReleaseDownloadBaseUrl("1.2.3")).toBe(`${FORK_RELEASES_URL}/download/v1.2.3`);
expect(cliReleaseIndexPageUrl(1)).toBe(
`https://api.github.com/repos/${FORK_REPOSITORY}/releases?per_page=100&page=1`,
);
});

it.each([
["scripts/install.sh", /^repo="([^"]+)"$/m],
["scripts/install.ps1", /^\$repo = "([^"]+)"$/m],
])("installs from the fork in %s", (path, repoLiteral) => {
expect(repoLiteral.exec(repoFile(path))?.[1]).toBe(FORK_REPOSITORY);
});

it.each([
"apps/desktop/src/app/DesktopStartupRecovery.ts",
"apps/web/src/components/desktopUpdate.logic.ts",
])("takes desktop release links from the fork module in %s", (path) => {
const source = repoFile(path);
expect(source).toContain('from "@t3tools/shared/fork"');
expect(source).not.toContain("pingdotgg/t3code");
});
});
4 changes: 4 additions & 0 deletions packages/shared/src/fork.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// The fork's release source: CLI and desktop updates, installers, and release links point here.
// scripts/install.sh and scripts/install.ps1 repeat the slug as a literal; fork.test.ts keeps them in sync.
export const FORK_REPOSITORY = "issuelt/t3code";
export const FORK_RELEASES_URL = `https://github.com/${FORK_REPOSITORY}/releases`;
52 changes: 52 additions & 0 deletions scripts/fork-carried-prs.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { assert, describe, it } from "@effect/vitest";

import { classifyCarriedPr } from "./fork-carried-prs.ts";

const taken = "a".repeat(40);
const later = "b".repeat(40);
const other = "c".repeat(40);

function pullRequest(
state: "OPEN" | "CLOSED" | "MERGED",
headRefOid: string,
oids: ReadonlyArray<string>,
totalCount = oids.length,
) {
return {
state,
headRefOid,
commits: { totalCount, nodes: oids.map((oid) => ({ commit: { oid } })) },
} as const;
}

describe("classifyCarriedPr", () => {
it("separates every upstream state", () => {
const cases = [
[pullRequest("OPEN", taken, [other, taken]), { kind: "unchanged" }],
[pullRequest("OPEN", later, [taken, other, later]), { kind: "new-commits", newCommits: 2 }],
[
pullRequest("OPEN", later, [other, later]),
{ kind: "new-commits", newCommits: "rewritten" },
],
[
pullRequest("OPEN", later, [other, later], 150),
{ kind: "new-commits", newCommits: "unknown" },
],
[pullRequest("MERGED", taken, [taken]), { kind: "merged" }],
[pullRequest("CLOSED", taken, [taken]), { kind: "closed-unmerged" }],
] as const;
for (const [pr, expected] of cases) {
assert.deepStrictEqual(classifyCarriedPr({ takenSha: taken }, pr), expected);
}
});

it("stays quiet on an accepted closed PR until its head moves", () => {
const entry = { takenSha: taken, closedUpstream: true } as const;
assert.deepStrictEqual(classifyCarriedPr(entry, pullRequest("CLOSED", taken, [taken])), {
kind: "unchanged",
});
assert.deepStrictEqual(classifyCarriedPr(entry, pullRequest("CLOSED", later, [taken, later])), {
kind: "closed-unmerged",
});
});
});
Loading
Loading