Skip to content

Commit 9b48b2f

Browse files
committed
merge(main): resolve conflicts with graceful shutdown drain
Keep drain-aware queued-run selection and acceptsDrainingStage progress, and fold in main stale PR-watch wake cancellation plus accepting-session progress streams.
2 parents e3348fb + 479ee74 commit 9b48b2f

169 files changed

Lines changed: 4962 additions & 1497 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/release.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,18 @@ jobs:
14821482
14831483
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
14841484
git commit --no-verify -m "chore(release): prepare $RELEASE_TAG"
1485-
git push origin HEAD:main
1485+
1486+
# main moves while this job runs, so a rejected push rebases and retries.
1487+
for attempt in 1 2 3 4 5; do
1488+
if git push origin HEAD:main; then
1489+
exit 0
1490+
fi
1491+
echo "Push rejected (attempt $attempt). Rebasing onto latest main."
1492+
git pull --rebase origin main
1493+
done
1494+
1495+
echo "Could not push the version bump after 5 attempts." >&2
1496+
exit 1
14861497
14871498
announce_discord:
14881499
name: Announce release on Discord

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/boot.cjs",

‎apps/desktop/src/app/ClerkTokenStore.test.ts‎

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ import * as NodeFS from "node:fs";
33
import * as NodeOS from "node:os";
44
import * as NodePath from "node:path";
55
import { assert, describe, it } from "@effect/vitest";
6-
import { vi } from "vite-plus/test";
7-
8-
vi.mock("node:fs", { spy: true });
96

107
import { openClerkTokenStorage, type ClerkTokenStorage } from "./ClerkTokenStore.ts";
118

@@ -91,24 +88,6 @@ describePosix("ClerkTokenStore", () => {
9188
});
9289
});
9390

94-
it("removes the legacy token file when the private copy already exists", async () => {
95-
await withStateDir((stateDir) => {
96-
const directory = NodePath.join(stateDir, "clerk");
97-
const legacyPath = NodePath.join(stateDir, "clerk-tokens.json");
98-
const tokenPath = NodePath.join(directory, "clerk-tokens.json");
99-
NodeFS.mkdirSync(directory, { mode: 0o755 });
100-
writeLoose(legacyPath, "stale-credential");
101-
writeLoose(tokenPath, "kept-credential");
102-
103-
openClerkTokenStorage(stateDir, () => idleStorage());
104-
105-
assert.equal(NodeFS.existsSync(legacyPath), false);
106-
assert.equal(modeOf(directory), 0o700);
107-
assert.equal(modeOf(tokenPath), 0o600);
108-
assert.equal(NodeFS.readFileSync(tokenPath, "utf8"), "kept-credential");
109-
});
110-
});
111-
11291
it("resolves a relative state directory before opening storage", async () => {
11392
await withStateDir(async (stateDir) => {
11493
const relativeStateDir = NodePath.relative(process.cwd(), stateDir);
@@ -150,23 +129,6 @@ describePosix("ClerkTokenStore", () => {
150129
});
151130
});
152131

153-
it("migrates tokens when the legacy directory is on another filesystem", async () => {
154-
await withStateDir((stateDir) => {
155-
const legacyPath = NodePath.join(stateDir, "clerk-tokens.json");
156-
writeLoose(legacyPath, "existing-session");
157-
using _rename = vi.spyOn(NodeFS, "renameSync").mockImplementation(() => {
158-
throw Object.assign(new Error("cross-device link"), { code: "EXDEV" });
159-
});
160-
161-
openClerkTokenStorage(stateDir, idleStorage);
162-
163-
const tokenPath = NodePath.join(stateDir, "clerk", "clerk-tokens.json");
164-
assert.equal(NodeFS.readFileSync(tokenPath, "utf8"), "existing-session");
165-
assert.equal(modeOf(tokenPath), 0o600);
166-
assert.equal(NodeFS.existsSync(legacyPath), false);
167-
});
168-
});
169-
170132
it("does not follow a symlinked clerk directory or token file", async () => {
171133
await withStateDir(async (stateDir) => {
172134
const outsideDirectory = NodePath.join(stateDir, "outside-dir");

‎apps/desktop/src/snapShot/DesktopSnapShot.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,6 @@ it.effect.each([
10481048
{ backend: "gnome", screenshot: "PNG" },
10491049
{ backend: "niri", screenshot: "PNG" },
10501050
{ backend: "kde", screenshot: "PNG" },
1051-
{ backend: "hyprland", screenshot: "PNG" },
10521051
{ backend: "gnome", screenshot: "invalid" },
10531052
] as const)(
10541053
"persists $backend accessibility text with a $screenshot screenshot",

‎apps/mobile/modules/t3-terminal/android/src/main/cpp/t3_terminal_jni.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ namespace {
1212

1313
constexpr uint32_t kSnapshotMagic = 0x54563354; // "T3VT" in little endian.
1414
constexpr uint16_t kSnapshotVersion = 1;
15-
constexpr size_t kMaxScrollbackRows = 10000;
15+
// The pinned ABI measures max_scrollback in bytes despite its header saying lines.
16+
// Match Ghostty's default scrollback-limit.
17+
constexpr size_t kMaxScrollbackBytes = 10'000'000;
1618

1719
enum CellFlag : uint16_t {
1820
kBold = 1 << 0,
@@ -205,7 +207,7 @@ Java_expo_modules_t3terminal_GhosttyBridge_nativeCreate(
205207
GhosttyTerminalOptions options = {
206208
.cols = static_cast<uint16_t>(std::clamp(cols, 1, 65535)),
207209
.rows = static_cast<uint16_t>(std::clamp(rows, 1, 65535)),
208-
.max_scrollback = kMaxScrollbackRows,
210+
.max_scrollback = kMaxScrollbackBytes,
209211
};
210212
if (ghostty_terminal_new(nullptr, &session->terminal, options) != GHOSTTY_SUCCESS ||
211213
ghostty_render_state_new(nullptr, &session->render_state) != GHOSTTY_SUCCESS ||

‎apps/mobile/src/features/diffs/nativeReviewDiffSource.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ it("evicts source text by aggregate size and returns an over-budget response unc
3939
expect(fetch).toHaveBeenCalledTimes(5);
4040
});
4141

42-
it("lets later viewport requests retry a failed source fetch", async () => {
43-
const fetch = vi.fn().mockRejectedValueOnce(new Error("Offline")).mockResolvedValueOnce(SOURCE);
44-
const load = createNativeReviewDiffSourceLoader(fetch);
45-
await expect(load("retry.ts")).rejects.toThrow("Offline");
46-
expect(await load("retry.ts")).toBe(SOURCE);
47-
});
48-
4942
const failureKeys = [
5043
["string", () => "retry.ts"],
5144
["number", () => 1],

‎apps/mobile/src/features/home/useThreadListActions.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,6 @@ describe("thread action undo", () => {
532532
await undo();
533533
expect(state.requests.map(({ action }) => action)).toEqual(["unpin"]);
534534
});
535-
536-
// regression: #21401 restore archive and thread action undo
537-
it("refreshes the archive after archiving on a settlement-capable server", async () => {
538-
await useThreadListActions().archiveThread(makeThread());
539-
expect(state.requests.map(({ action }) => action)).toEqual(["archive"]);
540-
expect(state.archivedRefreshes).toEqual([primaryEnvironmentId]);
541-
});
542535
});
543536

544537
describe("thread archive guard", () => {

‎apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx‎

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
squashAtomCommandFailure,
1212
} from "@t3tools/client-runtime/state/runtime";
1313
import { AsyncResult } from "effect/reactivity";
14-
import type { PullRequestThreadComment } from "@t3tools/contracts";
14+
import { pullRequestConversationThreads, type PullRequestThreadComment } from "@t3tools/contracts";
1515
import { useRef, useState } from "react";
1616
import { ScrollView, View, type ScrollViewInstance } from "react-native";
1717
import { KeyboardAvoidingView, useKeyboardState } from "react-native-keyboard-controller";
@@ -60,7 +60,12 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
6060
reportFailure: false,
6161
});
6262
const loadMore = useAtomCommand(composerPullRequests.threadComments, { reportFailure: false });
63-
const thread = activity.data?.reviewThreads.find((thread) => thread.id === params.discussionId);
63+
const thread =
64+
activity.data &&
65+
pullRequestConversationThreads(activity.data).find(
66+
(thread) => thread.id === params.discussionId,
67+
);
68+
const filePath = thread?.path ?? null;
6469
const [body, setBody] = useState("");
6570
const completions = usePullRequestCompletions({
6671
environmentId: params.environmentId,
@@ -200,20 +205,24 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
200205
{activity.isPending && !thread ? <AppActivityIndicator /> : null}
201206
{thread ? (
202207
<View className="gap-2 pb-4">
203-
<Text selectable className="font-mono text-xs text-foreground-muted">
204-
{thread.path}
205-
{thread.line ? `:${thread.line}` : ""}
206-
</Text>
208+
{thread.path === null ? null : (
209+
<Text selectable className="font-mono text-xs text-foreground-muted">
210+
{thread.path}
211+
{thread.line ? `:${thread.line}` : ""}
212+
</Text>
213+
)}
207214
<Text className="text-xs text-foreground-muted">
208215
{thread.isResolved ? "Resolved" : "Unresolved"}
209216
{thread.isOutdated ? " · Outdated" : ""}
210217
</Text>
211-
<Button
212-
label="View file diff"
213-
onPress={() =>
214-
navigation.navigate("PullRequestFile", { ...params, path: thread.path })
215-
}
216-
/>
218+
{filePath === null ? null : (
219+
<Button
220+
label="View file diff"
221+
onPress={() =>
222+
navigation.navigate("PullRequestFile", { ...params, path: filePath })
223+
}
224+
/>
225+
)}
217226
</View>
218227
) : !activity.isPending ? (
219228
<Text>This discussion is no longer available.</Text>

‎apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
5252
import { RegistryContext, useAtomRefresh, useAtomValue } from "@effect/atom-react";
5353
import { pullRequestReviewKey } from "./pullRequestReviewDrafts";
5454
import {
55+
pullRequestConversationThreads,
5556
type PullRequestDetail,
5657
type PullRequestListEntry,
5758
type PullRequestSummary,
@@ -176,7 +177,8 @@ function usePullRequestActivityRows(params: PullRequestParams, filter: ActivityF
176177
? result.data?.comments.find((comment) => pullRequestAnchorMatchesUrl(anchor, comment.url))
177178
: null;
178179
const targetThread = anchor
179-
? result.data?.reviewThreads.find((thread) =>
180+
? result.data &&
181+
pullRequestConversationThreads(result.data).find((thread) =>
180182
thread.comments.some((comment) => pullRequestAnchorMatchesUrl(anchor, comment.url)),
181183
)
182184
: null;

‎apps/mobile/src/features/pull-requests/PullRequestTimeline.tsx‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { PullRequestEntryRow } from "./PullRequestEntryRow";
66
import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg";
77
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
88
import IconGitCommit from "@tabler/icons-react-native/IconGitCommit";
9-
import type { PullRequestActivity, PullRequestComment } from "@t3tools/contracts";
9+
import {
10+
pullRequestConversationThreads,
11+
type PullRequestActivity,
12+
type PullRequestComment,
13+
} from "@t3tools/contracts";
1014
import { StackActions, type NavigationProp } from "@react-navigation/native";
1115
import { useMemo, useState, type ComponentProps, type ReactNode } from "react";
1216
import { Pressable, StyleSheet, View } from "react-native";
@@ -216,8 +220,9 @@ export function pullRequestTimelineRows(
216220
actions: CommentActions,
217221
) {
218222
const linkTarget = parsePullRequestAnchor(params.navigationUrl);
223+
const threads = pullRequestConversationThreads(activity);
219224
const discussionIds = new Set(
220-
activity.reviewThreads.flatMap((thread) => thread.comments.map((comment) => comment.id)),
225+
threads.flatMap((thread) => thread.comments.map((comment) => comment.id)),
221226
);
222227
const events = [
223228
...activity.comments
@@ -239,7 +244,7 @@ export function pullRequestTimelineRows(
239244
/>
240245
),
241246
})),
242-
...activity.reviewThreads.map((thread) => ({
247+
...threads.map((thread) => ({
243248
key: `discussion:${thread.id}`,
244249
date: thread.comments[0]?.createdAt ?? "",
245250
content: (
@@ -260,18 +265,24 @@ export function pullRequestTimelineRows(
260265
</View>
261266
<Pressable
262267
accessibilityRole="button"
263-
accessibilityLabel={`Open ${thread.isResolved ? "resolved" : "unresolved"} discussion in ${thread.path}`}
268+
accessibilityLabel={`Open ${thread.isResolved ? "resolved" : "unresolved"} discussion in ${thread.path ?? "the overview"}`}
264269
onPress={() =>
265270
navigation.navigate("PullRequestDiscussion", { ...params, discussionId: thread.id })
266271
}
267272
className="gap-2 rounded-2xl bg-grouped-card p-3 active:opacity-70"
268273
>
269274
<View className="flex-row items-center gap-2">
270-
<SymbolView name="doc.text" size={14} tintColorClassName="accent-icon-muted" />
271-
<Text className="flex-1 font-mono text-xs" numberOfLines={2}>
272-
{thread.path}
273-
{thread.line ? `:${thread.line}` : ""}
274-
</Text>
275+
{thread.path === null ? (
276+
<Text className="flex-1 text-xs">Overview</Text>
277+
) : (
278+
<>
279+
<SymbolView name="doc.text" size={14} tintColorClassName="accent-icon-muted" />
280+
<Text className="flex-1 font-mono text-xs" numberOfLines={2}>
281+
{thread.path}
282+
{thread.line ? `:${thread.line}` : ""}
283+
</Text>
284+
</>
285+
)}
275286
<SymbolView name="chevron.right" size={12} tintColorClassName="accent-icon-muted" />
276287
</View>
277288
<Text className="text-xs text-foreground-muted">

0 commit comments

Comments
 (0)