GeezerVison is showing github.com — Merge branch 'main' into perf/drop-unused-event-indexes · pingdotgg/t3code@a396768
File treeExpand file treeCollapse file tree Open diff view settings provider-opencode/src/server source-control-azure-devops/src/server source-control-bitbucket/src/server source-control-github/src source-control-gitlab/src/server
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/shell/DesktopShellEnvironment.test.ts +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -367,6 +367,32 @@ describe("DesktopShellEnvironment", () => { | 367 | 367 | }), | 368 | 368 | ); | 369 | 369 |
| | 370 | + it.effect("hydrates missing CA trust variables from the login shell", () => | | 371 | + Effect.gen(function* () { | | 372 | + const env: NodeJS.ProcessEnv = { | | 373 | + SHELL: "/bin/zsh", | | 374 | + PATH: "/usr/bin", | | 375 | + SSL_CERT_DIR: "/etc/ssl/certs", | | 376 | + }; | | 377 | + | | 378 | + yield* runShellEnvironment({ | | 379 | + env, | | 380 | + platform: "darwin", | | 381 | + handler: () => | | 382 | + envOutput({ | | 383 | + PATH: "/opt/zerobrew/bin:/usr/bin", | | 384 | + SSL_CERT_FILE: "/opt/zerobrew/etc/ca-certificates/cacert.pem", | | 385 | + SSL_CERT_DIR: "/opt/zerobrew/etc/ca-certificates", | | 386 | + NODE_EXTRA_CA_CERTS: "/Users/me/corp-root.pem", | | 387 | + }), | | 388 | + }); | | 389 | + | | 390 | + assert.equal(env.SSL_CERT_FILE, "/opt/zerobrew/etc/ca-certificates/cacert.pem"); | | 391 | + assert.equal(env.SSL_CERT_DIR, "/etc/ssl/certs"); | | 392 | + assert.equal(env.NODE_EXTRA_CA_CERTS, "/Users/me/corp-root.pem"); | | 393 | + }), | | 394 | + ); | | 395 | + | 370 | 396 | it.effect("keeps mise's PATH record with the login shell PATH", () => | 371 | 397 | Effect.gen(function* () { | 372 | 398 | const env: NodeJS.ProcessEnv = { | |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/shell/DesktopShellEnvironment.ts +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,6 +86,9 @@ const LOGIN_SHELL_ENV_NAMES = [ | 86 | 86 | "XDG_SESSION_DESKTOP", | 87 | 87 | "XDG_SESSION_TYPE", | 88 | 88 | "WAYLAND_DISPLAY", | | 89 | + "SSL_CERT_FILE", | | 90 | + "SSL_CERT_DIR", | | 91 | + "NODE_EXTRA_CA_CERTS", | 89 | 92 | "T3CODE_TELEMETRY_ENABLED", | 90 | 93 | "__MISE_DIFF", | 91 | 94 | ] as const; | @@ -454,6 +457,12 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix | 454 | 457 | "XDG_DATA_HOME", | 455 | 458 | "XDG_RUNTIME_DIR", | 456 | 459 | "WAYLAND_DISPLAY", | | 460 | + // CA trust set in the shell profile. Without it, a Node or OpenSSL build | | 461 | + // that has no bundled roots (a shared-OpenSSL node on PATH) cannot verify | | 462 | + // TLS, so provider updaters and agents fail to reach their registries. | | 463 | + "SSL_CERT_FILE", | | 464 | + "SSL_CERT_DIR", | | 465 | + "NODE_EXTRA_CA_CERTS", | 457 | 466 | // The telemetry opt-out is documented as a shell variable; GUI launches never see it. | 458 | 467 | "T3CODE_TELEMETRY_ENABLED", | 459 | 468 | ] as const) { | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/components/AndroidScreenHeader.tsx +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,6 +6,7 @@ import { AppText as Text } from "./AppText"; | 6 | 6 | import { cn } from "../lib/cn"; | 7 | 7 | import { MaterialIconButton } from "./MaterialIconButton"; | 8 | 8 | import { AndroidAnchoredMenu } from "./AndroidAnchoredMenu"; | | 9 | +import { splitAndroidHeaderActions } from "./headerMenu.android"; | 9 | 10 | import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; | 10 | 11 | import { useMaterialToolbarLayout } from "./useMaterialToolbarLayout"; | 11 | 12 |
| @@ -16,6 +17,8 @@ export interface AndroidHeaderAction { | 16 | 17 | readonly disabled?: boolean; | 17 | 18 | readonly loading?: boolean; | 18 | 19 | readonly selected?: boolean; | | 20 | + readonly destructive?: boolean; | | 21 | + readonly overflowOnly?: boolean; | 19 | 22 | } | 20 | 23 |
| 21 | 24 | export function AndroidHeaderIconButton(props: { | @@ -45,10 +48,10 @@ export function AndroidScreenHeader(props: { | 45 | 48 | props.embedded, | 46 | 49 | ); | 47 | 50 | const [headerWidth, setHeaderWidth] = useState(0); | 48 | | - const actions = props.actions ?? []; | 49 | | - const directCount = actions.length > 2 ? (headerWidth >= 600 ? 3 : 1) : actions.length; | 50 | | - const visibleActions = actions.slice(0, directCount); | 51 | | - const overflowActions = actions.slice(directCount); | | 51 | + const { visibleActions, overflowActions } = splitAndroidHeaderActions( | | 52 | + props.actions ?? [], | | 53 | + headerWidth >= 600, | | 54 | + ); | 52 | 55 |
| 53 | 56 | return ( | 54 | 57 | <View | @@ -115,6 +118,7 @@ export function AndroidScreenHeader(props: { | 115 | 118 | title: action.accessibilityLabel, | 116 | 119 | attributes: { | 117 | 120 | disabled: Boolean(action.disabled), | | 121 | + destructive: action.destructive, | 118 | 122 | state: action.selected ? "on" : undefined, | 119 | 123 | }, | 120 | 124 | }))} | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/components/AppSymbol.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -175,6 +175,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = { | 175 | 175 | circle: IconCircle, | 176 | 176 | "circle.dashed": IconCircleDashed, | 177 | 177 | "circle.inset.filled": IconCircleDot, | | 178 | + "circle.dashed.inset.filled": IconCircleDot, | 178 | 179 | clock: IconClock, | 179 | 180 | timer: IconClock, | 180 | 181 | ticket: IconTicket, | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/components/headerMenu.android.ts +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,3 +41,16 @@ export function findHeaderMenuAction( | 41 | 41 | } | 42 | 42 | return undefined; | 43 | 43 | } | | 44 | + | | 45 | +export function splitAndroidHeaderActions<Action extends { readonly overflowOnly?: boolean }>( | | 46 | + actions: ReadonlyArray<Action>, | | 47 | + wide: boolean, | | 48 | +) { | | 49 | + const inline = actions.filter((action) => !action.overflowOnly); | | 50 | + const directCount = actions.length > 2 ? (wide ? 3 : 1) : inline.length; | | 51 | + const visibleActions = inline.slice(0, directCount); | | 52 | + return { | | 53 | + visibleActions, | | 54 | + overflowActions: actions.filter((action) => !visibleActions.includes(action)), | | 55 | + }; | | 56 | +} |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/components/headerMenu.test.ts +37-1Lines changed: 37 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { describe, expect, it } from "vite-plus/test"; | 2 | | -import { androidHeaderMenuActions, findHeaderMenuAction } from "./headerMenu.android"; | | 2 | +import { | | 3 | + androidHeaderMenuActions, | | 4 | + findHeaderMenuAction, | | 5 | + splitAndroidHeaderActions, | | 6 | +} from "./headerMenu.android"; | 3 | 7 | import type { ScreenHeaderMenuItem } from "./ScreenHeader.types"; | 4 | 8 |
| 5 | 9 | const items: ReadonlyArray<ScreenHeaderMenuItem> = [ | @@ -63,4 +67,36 @@ describe("header menus", () => { | 63 | 67 | expect(findHeaderMenuAction(items, "sessions")).toBeUndefined(); | 64 | 68 | expect(findHeaderMenuAction(items, "removed-session")).toBeUndefined(); | 65 | 69 | }); | | 70 | + | | 71 | + it("keeps overflow-only Android header actions in the overflow menu", () => { | | 72 | + const action = (accessibilityLabel: string, overflowOnly?: boolean) => ({ | | 73 | + accessibilityLabel, | | 74 | + icon: "trash" as const, | | 75 | + onPress: () => {}, | | 76 | + overflowOnly, | | 77 | + }); | | 78 | + const labels = ( | | 79 | + split: ReturnType<typeof splitAndroidHeaderActions<ReturnType<typeof action>>>, | | 80 | + ) => ({ | | 81 | + visible: split.visibleActions.map((item) => item.accessibilityLabel), | | 82 | + overflow: split.overflowActions.map((item) => item.accessibilityLabel), | | 83 | + }); | | 84 | + const open = action("Open"); | | 85 | + const remove = action("Delete", true); | | 86 | + expect(labels(splitAndroidHeaderActions([open, action("Comment")], false))).toEqual({ | | 87 | + visible: ["Open", "Comment"], | | 88 | + overflow: [], | | 89 | + }); | | 90 | + expect(labels(splitAndroidHeaderActions([open, remove], true))).toEqual({ | | 91 | + visible: ["Open"], | | 92 | + overflow: ["Delete"], | | 93 | + }); | | 94 | + expect(labels(splitAndroidHeaderActions([remove], true))).toEqual({ | | 95 | + visible: [], | | 96 | + overflow: ["Delete"], | | 97 | + }); | | 98 | + expect( | | 99 | + labels(splitAndroidHeaderActions([action("Review"), action("Comment"), open, remove], true)), | | 100 | + ).toEqual({ visible: ["Review", "Comment", "Open"], overflow: ["Delete"] }); | | 101 | + }); | 66 | 102 | }); |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/home/useThreadListActions.ts +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -308,7 +308,9 @@ export function useThreadListActions(): { | 308 | 308 | if (!canSnooze(thread, { now: new Date().toISOString() })) { | 309 | 309 | Alert.alert( | 310 | 310 | "Could not snooze thread", | 311 | | - thread.hasPendingApprovals || thread.hasPendingUserInput | | 311 | + thread.hasPendingApprovals || | | 312 | + thread.hasPendingUserInput || | | 313 | + thread.pendingSubagentRequest != null | 312 | 314 | ? "This thread is waiting on you. Respond to the pending request before snoozing it." | 313 | 315 | : "This thread is still starting a turn. Try again once it's running.", | 314 | 316 | ); | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx +47-1Lines changed: 47 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,14 +17,20 @@ import { | 17 | 17 | PR_ROW_EXIT, | 18 | 18 | PR_POSITION_LAYOUT, | 19 | 19 | } from "./pullRequestAnimations"; | 20 | | -import { openOnProviderLabel } from "./pullRequestActions"; | | 20 | +import { | | 21 | + canPerformPullRequestAction, | | 22 | + openOnProviderLabel, | | 23 | + PR_ACTION_ICONS, | | 24 | + PR_ACTION_LABELS, | | 25 | +} from "./pullRequestActions"; | 21 | 26 | import * as Clipboard from "expo-clipboard"; | 22 | 27 | import { ControlPillMenu } from "../../components/ControlPillMenu"; | 23 | 28 | import { MaterialIconButton } from "../../components/MaterialIconButton"; | 24 | 29 | import { MaterialButton } from "../../components/MaterialButton"; | 25 | 30 | import { usePullRequestReviewDraft } from "./usePullRequestReviewDraft"; | 26 | 31 | import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed"; | 27 | 32 | import { usePullRequestPermissions } from "./usePullRequestPermissions"; | | 33 | +import { usePullRequestAction } from "./usePullRequestAction"; | 28 | 34 | import { annotatePullRequestDiff, reviewPosition } from "./pullRequestDiffComments"; | 29 | 35 | import { usePullRequestFileFilter } from "./usePullRequestFileFilter"; | 30 | 36 | import { isPullRequestTestFile } from "./pullRequestFileFilters"; | @@ -341,6 +347,15 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP | 341 | 347 | const summary = params.initialSummary; | 342 | 348 | const identity = pr ?? summary; | 343 | 349 | const permissions = usePullRequestPermissions(params, pr); | | 350 | + const action = usePullRequestAction(params, pr); | | 351 | + const showsDeleteBranch = pr !== null && canPerformPullRequestAction(pr, "delete-branch"); | | 352 | + const confirmDeleteBranch = () => | | 353 | + pr && | | 354 | + action.confirm( | | 355 | + "delete-branch", | | 356 | + PR_ACTION_LABELS["delete-branch"], | | 357 | + `Delete ${pr.headBranch} from ${pr.headRepositoryNameWithOwner ?? pr.repository}? Local branches and worktrees are not changed.`, | | 358 | + ); | 344 | 359 | const stack = usePullRequestStack(params, pr); | 345 | 360 | const refreshActivity = useAtomRefresh(composerPullRequests.activity(requestTarget(params))); | 346 | 361 | const refreshGuide = useAtomRefresh(composerPullRequests.reviewGuide(requestTarget(params))); | @@ -417,6 +432,18 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP | 417 | 432 | }, | 418 | 433 | ] | 419 | 434 | : []), | | 435 | + ...(showsDeleteBranch | | 436 | + ? [ | | 437 | + { | | 438 | + accessibilityLabel: PR_ACTION_LABELS["delete-branch"], | | 439 | + icon: PR_ACTION_ICONS["delete-branch"], | | 440 | + disabled: !action.available("delete-branch"), | | 441 | + destructive: true, | | 442 | + overflowOnly: true, | | 443 | + onPress: confirmDeleteBranch, | | 444 | + }, | | 445 | + ] | | 446 | + : []), | 420 | 447 | ]} | 421 | 448 | /> | 422 | 449 | ) : null} | @@ -456,6 +483,25 @@ export function PullRequestRouteScreen({ route }: StaticScreenProps<PullRequestP | 456 | 483 | </NativeHeaderToolbar.Label> | 457 | 484 | </NativeHeaderToolbar.MenuAction> | 458 | 485 | ) : null} | | 486 | + {showsDeleteBranch ? ( | | 487 | + <NativeHeaderToolbar.MenuAction | | 488 | + icon={PR_ACTION_ICONS["delete-branch"]} | | 489 | + destructive | | 490 | + disabled={!action.available("delete-branch")} | | 491 | + subtitle={ | | 492 | + action.busy | | 493 | + ? "Deleting…" | | 494 | + : connected | | 495 | + ? pr.headBranch | | 496 | + : "Reconnect to delete this branch." | | 497 | + } | | 498 | + onPress={confirmDeleteBranch} | | 499 | + > | | 500 | + <NativeHeaderToolbar.Label> | | 501 | + {PR_ACTION_LABELS["delete-branch"]} | | 502 | + </NativeHeaderToolbar.Label> | | 503 | + </NativeHeaderToolbar.MenuAction> | | 504 | + ) : null} | 459 | 505 | </NativeHeaderToolbar.Menu> | 460 | 506 | </NativeHeaderToolbar> | 461 | 507 | <View | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/pullRequestActions.test.ts +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -112,6 +112,19 @@ describe("mobile pull request actions", () => { | 112 | 112 | expect(mergeSummary(unknown, true)).toBe("Squash"); | 113 | 113 | }); | 114 | 114 |
| | 115 | + it("offers deleting the source branch only once merged or closed on a host that supports it", () => { | | 116 | + const capabilities = { ...detail().capabilities, deleteBranch: true }; | | 117 | + expect(canPerformPullRequestAction(detail({ capabilities }), "delete-branch")).toBe(false); | | 118 | + for (const state of ["merged", "closed"] as const) { | | 119 | + expect(canPerformPullRequestAction(detail({ state, capabilities }), "delete-branch")).toBe( | | 120 | + true, | | 121 | + ); | | 122 | + expect(canPerformPullRequestAction(detail({ state }), "delete-branch")).toBe(false); | | 123 | + } | | 124 | + const refused = detail({ state: "merged", capabilities, viewerPermissions: { actions: [] } }); | | 125 | + expect(canPerformPullRequestAction(refused, "delete-branch")).toBe(false); | | 126 | + }); | | 127 | + | 115 | 128 | it("cannot merge when the repository has disabled every offered strategy", () => { | 116 | 129 | const pr = detail({ mergeCapabilities: { merge: false, squash: false, rebase: false } }); | 117 | 130 | expect(canPerformPullRequestAction(pr, "merge")).toBe(false); | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/pull-requests/pullRequestActions.ts +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ type ActionDetail = Pick< | 13 | 13 | > & { | 14 | 14 | readonly capabilities: Pick< | 15 | 15 | PullRequestDetail["capabilities"], | 16 | | - "actions" | "mergeMethods" | "updateMethods" | | 16 | + "actions" | "mergeMethods" | "updateMethods" | "deleteBranch" | 17 | 17 | >; | 18 | 18 | readonly viewerPermissions: Pick< | 19 | 19 | PullRequestDetail["viewerPermissions"], | @@ -41,6 +41,7 @@ export const PR_ACTION_LABELS = { | 41 | 41 | "enable-auto-merge": "Enable auto-merge", | 42 | 42 | "disable-auto-merge": "Disable auto-merge", | 43 | 43 | revert: "Create revert pull request", | | 44 | + "delete-branch": "Delete branch", | 44 | 45 | "approve-workflows": "Approve workflows", | 45 | 46 | } as const satisfies Record<PullRequestAction, string>; | 46 | 47 |
| @@ -54,6 +55,7 @@ export const PR_ACTION_ICONS = { | 54 | 55 | "enable-auto-merge": "clock", | 55 | 56 | "disable-auto-merge": "xmark", | 56 | 57 | revert: "arrow.uturn.backward", | | 58 | + "delete-branch": "trash", | 57 | 59 | "approve-workflows": "checkmark", | 58 | 60 | } as const satisfies Record<PullRequestAction, AppSymbolName>; | 59 | 61 |
| @@ -68,6 +70,7 @@ export const ALL_PR_ACTIONS: readonly PullRequestAction[] = [ | 68 | 70 | "close", | 69 | 71 | "reopen", | 70 | 72 | "revert", | | 73 | + "delete-branch", | 71 | 74 | ]; | 72 | 75 |
| 73 | 76 | export function allowedMergeMethods(pr: ActionDetail) { | @@ -86,6 +89,8 @@ export function canPerformPullRequestAction(pr: ActionDetail, action: PullReques | 86 | 89 | return false; | 87 | 90 | if (action === "reopen") return pr.state === "closed"; | 88 | 91 | if (action === "revert") return pr.state === "merged"; | | 92 | + if (action === "delete-branch") | | 93 | + return pr.state !== "open" && pr.capabilities.deleteBranch === true; | 89 | 94 | if (pr.state !== "open") return false; | 90 | 95 | switch (action) { | 91 | 96 | case "update-branch": | |
|