GeezerVison is showing github.com — Merge pull request #60 from RTVision/sync/upstream-rtvision-0.0.58 · RTVision/t3code@2943cf8
File treeExpand file treeCollapse file tree Open diff view settings 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: .github/workflows/ci.yml +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 53 | 53 | - name: Check | 54 | 54 | run: vp check | 55 | 55 |
| | 56 | + - name: Check className overrides on components/ui do not grow | | 57 | + run: vp run lint:restyle-ceiling | | 58 | + | 56 | 59 | - name: Typecheck | 57 | 60 | run: vpr typecheck | 58 | 61 |
| |
Collapse file Copy file name to clipboardExpand all lines: AGENTS.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -158,6 +158,7 @@ Full glossary with file links: `docs/internals/glossary.md` | 158 | 158 | ## Taste | 159 | 159 |
| 160 | 160 | - Complexity belongs at the adapter boundary. Orchestration stays pure, UI stays dumb. | | 161 | +- `apps/web/src/components/ui` exports own their look. Pick a `variant` or `size`; do not restyle one with `className`. If none fits, add a variant to the component, not classes at the call site. Layout classes (width, flex, margin, position) belong on the parent. `shadcn/no-restyle` reports violations and CI caps their count. | 161 | 162 | - Inferred types over annotations. `any` is the enemy. | 162 | 163 | - Comments describe how a thing is used, and move when the code moves. To be used mostly to describe functions, not to annotate every line of behavior. | 163 | 164 | - Our users drive agents all day and notice a dropped frame, a lying spinner, and a stale label. No continuously repainting animations; they peg the GPU on high-refresh displays. | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/app.config.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -214,7 +214,7 @@ const config: ExpoConfig = { | 214 | 214 | slug: "t3-code", | 215 | 215 | platforms: ["ios", "android"], | 216 | 216 | scheme: variant.scheme, | 217 | | - version: "1.2.1", | | 217 | + version: "1.3.0", | 218 | 218 | runtimeVersion: { | 219 | 219 | // Development manifests resolve on every launch, so avoid fingerprint's | 220 | 220 | // expensive native-project calculation there. Preview and production stay | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx +67-6Lines changed: 67 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | type ServerSettings, | 7 | 7 | type ServerSettingsPatch, | 8 | 8 | type ThreadEnvMode, | | 9 | + type WorktreeSubmodules, | 9 | 10 | PROJECT_SCOPED_SERVER_SETTING_KEYS, | 10 | 11 | type ProjectScopedServerSettingKey, | 11 | 12 | } from "@t3tools/contracts"; | @@ -43,17 +44,43 @@ const PAGE_TITLES: Record<SettingsPage, string> = { | 43 | 44 | }; | 44 | 45 |
| 45 | 46 | const PAGE_PROJECT_KEYS: Record<SettingsPage, readonly ProjectScopedServerSettingKey[]> = { | 46 | | - "new-threads": ["defaultThreadEnvMode", "defaultRuntimeMode"], | | 47 | + "new-threads": ["defaultThreadEnvMode", "worktreeSubmodules", "defaultRuntimeMode"], | 47 | 48 | "source-control": ["defaultAutoPull", "newWorktreesStartFromOrigin"], | 48 | 49 | "agent-behavior": ["responseStreamingMode", "enableAgentBrowserAccess"], | 49 | 50 | maintenance: ["continueThreadsAfterServerUpdate"], | 50 | 51 | }; | 51 | 52 |
| | 53 | +const SUBMODULE_CHOICES: ReadonlyArray<{ | | 54 | + readonly mode: WorktreeSubmodules | null; | | 55 | + readonly label: string; | | 56 | + readonly description: string; | | 57 | +}> = [ | | 58 | + // Only offered at environment scope; a project falls back through "Use defaults". | | 59 | + { | | 60 | + mode: null, | | 61 | + label: "Inherit", | | 62 | + description: "Use the repository's t3.json, or initialize recursively.", | | 63 | + }, | | 64 | + { mode: "recursive", label: "Recursive", description: "Initialize nested submodules too." }, | | 65 | + { | | 66 | + mode: "top-level", | | 67 | + label: "Top level only", | | 68 | + description: "Skip submodules declared inside other submodules.", | | 69 | + }, | | 70 | + { mode: "none", label: "Skip", description: "Leave submodules empty for a setup script." }, | | 71 | +]; | | 72 | + | 52 | 73 | const WORKSPACE_CHOICES: ReadonlyArray<{ | 53 | | - readonly mode: ThreadEnvMode; | | 74 | + readonly mode: ThreadEnvMode | null; | 54 | 75 | readonly label: string; | 55 | 76 | readonly description: string; | 56 | 77 | }> = [ | | 78 | + // Only offered at environment scope; a project falls back through "Use defaults". | | 79 | + { | | 80 | + mode: null, | | 81 | + label: "Inherit", | | 82 | + description: "Use the repository's t3.json, or the current checkout.", | | 83 | + }, | 57 | 84 | { | 58 | 85 | mode: "local", | 59 | 86 | label: "Current checkout", | @@ -126,6 +153,10 @@ function ServerSettingsDetail(props: { readonly page: SettingsPage }) { | 126 | 153 | const value = reference.settings[key]; | 127 | 154 | return displayTargets.every((entry) => entry.settings[key] === value) ? value : null; | 128 | 155 | }; | | 156 | + // `uniform` folds a real null into "mixed"; nullable keys need the distinction. | | 157 | + const isMixed = (key: keyof ServerSettings) => | | 158 | + reference === null || | | 159 | + displayTargets.some((entry) => entry.settings[key] !== reference.settings[key]); | 129 | 160 | const updateSettings = useAtomCommand(serverEnvironment.updateSettings, { | 130 | 161 | label: "environment settings update", | 131 | 162 | reportFailure: true, | @@ -219,23 +250,53 @@ function ServerSettingsDetail(props: { readonly page: SettingsPage }) { | 219 | 250 | <SettingsSection | 220 | 251 | title="Default workspace" | 221 | 252 | trailing={ | 222 | | - pendingWrites === 0 && uniform("defaultThreadEnvMode") === null ? ( | | 253 | + pendingWrites === 0 && isMixed("defaultThreadEnvMode") ? ( | 223 | 254 | <MixedValuesLabel projectSelected={projectSelected} /> | 224 | 255 | ) : null | 225 | 256 | } | 226 | 257 | > | 227 | | - {WORKSPACE_CHOICES.map((choice, index) => ( | | 258 | + {WORKSPACE_CHOICES.filter( | | 259 | + (choice) => choice.mode !== null || !projectSelected, | | 260 | + ).map((choice, index) => ( | 228 | 261 | <ChoiceRow | 229 | | - key={choice.mode} | | 262 | + key={choice.mode ?? "inherit"} | 230 | 263 | label={choice.label} | 231 | 264 | description={choice.description} | 232 | | - selected={uniform("defaultThreadEnvMode") === choice.mode} | | 265 | + selected={ | | 266 | + !isMixed("defaultThreadEnvMode") && | | 267 | + uniform("defaultThreadEnvMode") === choice.mode | | 268 | + } | 233 | 269 | separated={index > 0} | 234 | 270 | disabled={disabledFor("defaultThreadEnvMode")} | 235 | 271 | onPress={() => write({ defaultThreadEnvMode: choice.mode })} | 236 | 272 | /> | 237 | 273 | ))} | 238 | 274 | </SettingsSection> | | 275 | + <SettingsSection | | 276 | + title="Worktree submodules" | | 277 | + trailing={ | | 278 | + pendingWrites === 0 && isMixed("worktreeSubmodules") ? ( | | 279 | + <MixedValuesLabel projectSelected={projectSelected} /> | | 280 | + ) : null | | 281 | + } | | 282 | + > | | 283 | + {SUBMODULE_CHOICES.filter( | | 284 | + (choice) => choice.mode !== null || !projectSelected, | | 285 | + ).map((choice, index) => ( | | 286 | + <ChoiceRow | | 287 | + key={choice.mode ?? "inherit"} | | 288 | + label={choice.label} | | 289 | + description={choice.description} | | 290 | + selected={ | | 291 | + !isMixed("worktreeSubmodules") && | | 292 | + uniform("worktreeSubmodules") === choice.mode | | 293 | + } | | 294 | + separated={index > 0} | | 295 | + disabled={disabledFor("worktreeSubmodules")} | | 296 | + onPress={() => write({ worktreeSubmodules: choice.mode })} | | 297 | + /> | | 298 | + ))} | | 299 | + </SettingsSection> | 239 | 300 | <SettingsSection | 240 | 301 | title="Default permissions" | 241 | 302 | trailing={ | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/settings/settings-scoped-server.test.ts +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -69,6 +69,39 @@ describe("mobile project settings scope", () => { | 69 | 69 | expect(secondSettings.responseStreamingMode).toBe("token"); | 70 | 70 | }); | 71 | 71 |
| | 72 | + it("removes a project override when a picker sends null for a key that cannot store it", () => { | | 73 | + const settings: ServerSettings = { | | 74 | + ...DEFAULT_SERVER_SETTINGS, | | 75 | + projectSettingsOverrides: { | | 76 | + [firstProject]: { defaultThreadEnvMode: "worktree", defaultAutoPull: true }, | | 77 | + }, | | 78 | + }; | | 79 | + const targets = resolveMobileSettingsTargets( | | 80 | + [environment(firstId, settings)], | | 81 | + [{ environmentId: firstId, id: firstProject }], | | 82 | + ); | | 83 | + expect(planMobileScopedSettingsPatch(targets, true, { defaultThreadEnvMode: null })).toEqual([ | | 84 | + { | | 85 | + environmentId: firstId, | | 86 | + patch: { projectSettingsOverrides: { [firstProject]: { defaultAutoPull: true } } }, | | 87 | + }, | | 88 | + ]); | | 89 | + expect(planMobileScopedSettingsPatch(targets, true, { defaultModelSelection: null })).toEqual([ | | 90 | + { | | 91 | + environmentId: firstId, | | 92 | + patch: { | | 93 | + projectSettingsOverrides: { | | 94 | + [firstProject]: { | | 95 | + defaultThreadEnvMode: "worktree", | | 96 | + defaultAutoPull: true, | | 97 | + defaultModelSelection: null, | | 98 | + }, | | 99 | + }, | | 100 | + }, | | 101 | + }, | | 102 | + ]); | | 103 | + }); | | 104 | + | 72 | 105 | it("resets only the selected page's override and rejects environment-wide writes", () => { | 73 | 106 | const settings: ServerSettings = { | 74 | 107 | ...DEFAULT_SERVER_SETTINGS, | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/settings/settings-scoped-server.ts +14-1Lines changed: 14 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { | | 2 | + isNullableProjectSettingsOverride, | 2 | 3 | PROJECT_SCOPED_SERVER_SETTING_KEYS, | 3 | 4 | type EnvironmentId, | 4 | 5 | type ProjectId, | @@ -69,7 +70,19 @@ export function planMobileScopedSettingsPatch( | 69 | 70 | continue; | 70 | 71 | const current = | 71 | 72 | target.environment.serverConfig.settings.projectSettingsOverrides[target.projectId] ?? {}; | 72 | | - const next = { ...current, ...patch }; | | 73 | + const next: Record<string, unknown> = { ...current }; | | 74 | + for (const [key, value] of Object.entries(patch)) { | | 75 | + // A picker's "Inherit" sends null; for keys whose override cannot | | 76 | + // store null that means remove the override. | | 77 | + if ( | | 78 | + value === null && | | 79 | + !isNullableProjectSettingsOverride(key as ProjectScopedServerSettingKey) | | 80 | + ) { | | 81 | + delete next[key]; | | 82 | + } else { | | 83 | + next[key] = value; | | 84 | + } | | 85 | + } | 73 | 86 | const overrides = writes.get(target.environment.environmentId) ?? {}; | 74 | 87 | overrides[target.projectId] = next; | 75 | 88 | writes.set(target.environment.environmentId, overrides); | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/new-task-flow-provider.tsx +21-28Lines changed: 21 additions & 28 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,10 +20,6 @@ import { | 20 | 20 | } from "@t3tools/contracts"; | 21 | 21 | import { resolveProjectSettings } from "@t3tools/shared/projectSettings"; | 22 | 22 | import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile"; | 23 | | -import { | 24 | | - isDefaultThreadEnvModeSettled, | 25 | | - resolveDefaultThreadEnvMode, | 26 | | -} from "@t3tools/shared/threadEnvMode"; | 27 | 23 | import * as Arr from "effect/Array"; | 28 | 24 | import { pipe } from "effect/Function"; | 29 | 25 |
| @@ -431,38 +427,35 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) { | 431 | 427 | : null, | 432 | 428 | ); | 433 | 429 | const t3ProjectFileData = t3ProjectFileQuery.data as ProjectReadFileResult | null; | 434 | | - const t3ProjectFileDefaultMode = useMemo(() => { | 435 | | - if (t3ProjectFileData === null || t3ProjectFileData.truncated) return null; | 436 | | - return parseT3ProjectFile(t3ProjectFileData.contents)?.defaultThreadEnvMode ?? null; | 437 | | - }, [t3ProjectFileData]); | 438 | | - // Environment settings with the project's overrides applied; the | 439 | | - // aggregate's own legacy fields still count until the server folds them. | | 430 | + const t3ProjectFile = useMemo( | | 431 | + () => | | 432 | + t3ProjectFileData === null || t3ProjectFileData.truncated | | 433 | + ? null | | 434 | + : parseT3ProjectFile(t3ProjectFileData.contents), | | 435 | + [t3ProjectFileData], | | 436 | + ); | | 437 | + // Environment settings with the project's overrides and its t3.json | | 438 | + // applied; the aggregate's own legacy fields still count until the server | | 439 | + // folds them. | 440 | 440 | const projectSettings = useMemo( | 441 | 441 | () => | 442 | 442 | resolveProjectSettings( | 443 | 443 | selectedEnvironmentServerConfig?.settings ?? DEFAULT_SERVER_SETTINGS, | 444 | 444 | selectedProject?.id ?? null, | 445 | 445 | selectedProject, | | 446 | + t3ProjectFile, | 446 | 447 | ), | 447 | | - [selectedEnvironmentServerConfig?.settings, selectedProject], | | 448 | + [selectedEnvironmentServerConfig?.settings, selectedProject, t3ProjectFile], | 448 | 449 | ); | 449 | | - const projectThreadEnvMode = | 450 | | - projectSettings.sources.defaultThreadEnvMode === "project" | 451 | | - ? projectSettings.settings.defaultThreadEnvMode | 452 | | - : undefined; | 453 | | - const defaultWorkspaceMode: WorkspaceMode = resolveDefaultThreadEnvMode({ | 454 | | - projectSetting: projectThreadEnvMode, | 455 | | - projectFile: t3ProjectFileDefaultMode, | 456 | | - globalDefault: projectSettings.settings.defaultThreadEnvMode, | 457 | | - }); | 458 | | - // While unsettled the resolved default is provisional. Nothing may write | 459 | | - // it into the draft during that window (the auto-branch effect does), or | 460 | | - // the frozen interim value beats the t3.json default once it loads. | 461 | | - const defaultWorkspaceModeSettled = isDefaultThreadEnvModeSettled({ | 462 | | - explicitMode: selectedProjectDraft.workspaceSelection?.mode, | 463 | | - projectSetting: projectThreadEnvMode, | 464 | | - projectFilePending: t3ProjectFileQuery.isPending, | 465 | | - }); | | 450 | + const defaultWorkspaceMode: WorkspaceMode = projectSettings.settings.defaultThreadEnvMode; | | 451 | + // While the file read is pending and nothing above it decided, the | | 452 | + // resolved default is provisional. Nothing may write it into the draft | | 453 | + // during that window (the auto-branch effect does), or the frozen interim | | 454 | + // value beats the t3.json default once it loads. | | 455 | + const defaultWorkspaceModeSettled = | | 456 | + selectedProjectDraft.workspaceSelection?.mode !== undefined || | | 457 | + projectSettings.sources.defaultThreadEnvMode !== "environment" || | | 458 | + !t3ProjectFileQuery.isPending; | 466 | 459 | const workspaceMode = selectedProjectDraft.workspaceSelection?.mode ?? defaultWorkspaceMode; | 467 | 460 | const selectedBranchName = selectedProjectDraft.workspaceSelection?.branch ?? null; | 468 | 461 | const selectedWorktreePath = selectedProjectDraft.workspaceSelection?.worktreePath ?? null; | |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/lib/composerAttachmentUploadQueue.test.ts +25Lines changed: 25 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,6 +105,31 @@ describe("composer attachment upload queue", () => { | 105 | 105 | queue.dispose(); | 106 | 106 | }); | 107 | 107 |
| | 108 | + it("retries a failed attachment when the worker restores requests after reconnect", async () => { | | 109 | + let states: Readonly<Record<string, ComposerAttachmentUploadState>> = {}; | | 110 | + const upload = vi.fn().mockRejectedValueOnce(new Error("Disconnected")).mockResolvedValue(true); | | 111 | + const queue = createComposerAttachmentUploadQueue({ | | 112 | + upload, | | 113 | + onChange: (next) => { | | 114 | + states = next; | | 115 | + }, | | 116 | + }); | | 117 | + const local = request("failed-upload"); | | 118 | + const key = composerAttachmentUploadKey(environmentId, local.attachment.id); | | 119 | + queue.sync([local]); | | 120 | + await queue.settled(); | | 121 | + expect(states[key]?.status).toBe("failed"); | | 122 | + queue.sync([local]); | | 123 | + await queue.settled(); | | 124 | + expect(upload).toHaveBeenCalledTimes(1); | | 125 | + queue.sync([]); | | 126 | + queue.sync([local]); | | 127 | + await queue.settled(); | | 128 | + expect(upload).toHaveBeenCalledTimes(2); | | 129 | + expect(states[key]?.status).toBe("ready"); | | 130 | + queue.dispose(); | | 131 | + }); | | 132 | + | 108 | 133 | it("ignores a late completion after removal or environment switch", async () => { | 109 | 134 | const gate = Promise.withResolvers<boolean>(); | 110 | 135 | const started = Promise.withResolvers<void>(); | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/git/GitManager.ts +14-5Lines changed: 14 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2543,11 +2543,20 @@ export const make = Effect.gen(function* () { | 2543 | 2543 | }); | 2544 | 2544 | } | 2545 | 2545 |
| 2546 | | - const worktree = yield* gitCore.createWorktree({ | 2547 | | - cwd: input.cwd, | 2548 | | - refName: localPullRequestBranch, | 2549 | | - path: null, | 2550 | | - }); | | 2546 | + const worktree = yield* gitCore.createWorktree( | | 2547 | + { | | 2548 | + cwd: input.cwd, | | 2549 | + refName: localPullRequestBranch, | | 2550 | + path: null, | | 2551 | + }, | | 2552 | + { | | 2553 | + // Best effort: a settings read failure falls back to the checkout's t3.json. | | 2554 | + submodules: yield* projectSettingsFor(input).pipe( | | 2555 | + Effect.map((settings) => settings.worktreeSubmodules), | | 2556 | + Effect.orElseSucceed(() => null), | | 2557 | + ), | | 2558 | + }, | | 2559 | + ); | 2551 | 2560 | yield* ensureExistingWorktreeUpstream(worktree.worktree.path); | 2552 | 2561 | yield* maybeRunSetupScript(worktree.worktree.path); | 2553 | 2562 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2637,11 +2637,14 @@ describe("ProviderCommandReactor", () => { | 2637 | 2637 |
| 2638 | 2638 | await waitFor(() => harness.startSession.mock.calls.length === 1); | 2639 | 2639 | expect(harness.pruneWorktrees).toHaveBeenCalledWith({ cwd: "/tmp/provider-project" }); | 2640 | | - expect(harness.createWorktree).toHaveBeenCalledWith({ | 2641 | | - cwd: "/tmp/provider-project", | 2642 | | - refName: "feature/restore", | 2643 | | - path: worktreePath, | 2644 | | - }); | | 2640 | + expect(harness.createWorktree).toHaveBeenCalledWith( | | 2641 | + { | | 2642 | + cwd: "/tmp/provider-project", | | 2643 | + refName: "feature/restore", | | 2644 | + path: worktreePath, | | 2645 | + }, | | 2646 | + { submodules: null }, | | 2647 | + ); | 2645 | 2648 | expect(harness.createWorktree.mock.invocationCallOrder[0]).toBeLessThan( | 2646 | 2649 | harness.startSession.mock.invocationCallOrder[0]!, | 2647 | 2650 | ); | |
|