Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e58175d
feat(git): show file diffs inside submodules
NeilMazumdar Nov 6, 2026
e014d3c
fix(git): preserve submodule paths and bounded pointer fallbacks
NeilMazumdar Nov 6, 2026
37edc71
fix(git): keep submodule patches in bounded review fallbacks
NeilMazumdar Nov 6, 2026
84b02ed
fix(git): align submodule fallback metadata with patch paths
NeilMazumdar Nov 7, 2026
fbcf0b2
feat(git): select a repository for diff review
NeilMazumdar Nov 7, 2026
4a9b933
fix(git): keep repository review paths and scopes consistent
NeilMazumdar Nov 7, 2026
f1f44f8
fix(git): refresh and deduplicate repository choices
NeilMazumdar Nov 8, 2026
c73f7b8
fix(web): keep literal child paths and the loading state during repos…
NeilMazumdar Nov 10, 2026
4429ed7
fix(mobile): reselecting the active repository keeps the selected sec…
NeilMazumdar Nov 11, 2026
b9b72b9
test(server): give the submodule clone a Git identity before committing
NeilMazumdar Nov 11, 2026
85434ce
fix(web,mobile): show a failed repository discovery instead of the pa…
NeilMazumdar Nov 11, 2026
c33562f
fix(web,mobile): retry a failed repository discovery without losing t…
NeilMazumdar Nov 11, 2026
07ca7d5
chore: merge upstream main into submodule diff branch
NeilMazumdar Nov 11, 2026
0e2a526
Merge remote-tracking branch 'github/main' into feature/submodule-diffs
maria-rcks Nov 11, 2026
5c1110d
perf(web): only discover review repositories while the Diff panel is …
maria-rcks Nov 11, 2026
a4237c6
test(web): drop the removed keep-on-open argument after merging main
maria-rcks Nov 11, 2026
d8c6513
Merge upstream main into submodule diff review
NeilMazumdar Nov 23, 2026
8735b17
Merge remote-tracking branch 'upstream/main' into feature/submodule-d…
NeilMazumdar Nov 23, 2026
9aacd35
Verify repository picker after upstream merge
NeilMazumdar Nov 23, 2026
a0973b3
Merge remote-tracking branch 'upstream/main' into feature/submodule-d…
NeilMazumdar Nov 23, 2026
68ebb1d
fix(review): keep diffs scoped to the selected repository
NeilMazumdar Nov 23, 2026
59e2d9c
Merge remote-tracking branch 'upstream/merge-check-34105' into featur…
NeilMazumdar Nov 23, 2026
b0b6b00
test(review): keep expected repository list type-safe
NeilMazumdar Nov 23, 2026
50057ab
Merge upstream main into submodule diff review
NeilMazumdar Nov 24, 2026
a681d5b
Merge upstream main into submodule diff review
NeilMazumdar Nov 25, 2026
85667ce
fix(review): verify submodule links and cached checkouts
NeilMazumdar Nov 26, 2026
415d5a5
Merge latest upstream main into submodule diff review
NeilMazumdar Nov 26, 2026
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
40 changes: 37 additions & 3 deletions apps/mobile/src/features/review/ReviewSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { AsyncResult } from "effect/reactivity";
import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
import type { ReviewRepositoriesResult, EnvironmentId, ThreadId } from "@t3tools/contracts";
import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
import { LegendList } from "@legendapp/list/react-native";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
Expand Down Expand Up @@ -63,6 +63,9 @@ import type { usePullRequestFileFilter } from "../pull-requests/usePullRequestFi

function ReviewHeader(
props: Parameters<typeof useReviewHeaderPresentation>[0] & {
readonly repositories: ReviewRepositoriesResult["repositories"];
readonly selectedGitRepository: ReviewRepositoriesResult["repositories"][number] | undefined;
readonly onSelectGitRepository: (cwd: string) => void;
readonly sectionMenu: ReturnType<typeof buildReviewSectionMenu>;
readonly showSectionToolbar: boolean;
readonly showChangedFilesToggle: boolean;
Expand Down Expand Up @@ -108,6 +111,21 @@ function ReviewHeader(
: undefined
}
menus={[
...(props.repositories.length > 1
? [
{
title: gt("Select Git repository"),
icon: "folder" as const,
items: props.repositories.map((repo) => ({
id: repo.cwd,
title: repo.name + ": " + (repo.branch ?? "HEAD"),
subtitle: repo.path || gt("Workspace repository"),
selected: repo.cwd === props.selectedGitRepository?.cwd,
onPress: () => props.onSelectGitRepository(repo.cwd),
})),
},
]
: []),
...(presentation.gitMenu ? [presentation.gitMenu] : []),
...(props.showSectionToolbar
? [
Expand Down Expand Up @@ -421,6 +439,11 @@ export function ReviewSheet(props: ReviewSheetProps) {
refreshSelectedSection,
selectSection,
isSelectedSectionPending,
repositories,
selectedRepository: selectedGitRepository,
selectRepository: selectGitRepository,
reviewCwd,
repositoryPath,
} = useReviewSections({
enabled: isEnvironmentReady,
environmentId,
Expand Down Expand Up @@ -454,7 +477,8 @@ export function ReviewSheet(props: ReviewSheetProps) {
} = useReviewDiffData({
threadKey: reviewCache.threadKey,
environmentId,
cwd: selectedThreadCwd,
cwd: reviewCwd,
repositoryPath,
selectedSection,
draftMessage,
draftContext,
Expand Down Expand Up @@ -506,6 +530,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
environmentId,
threadId,
selectedSection,
repositoryPath,
nativeReviewDiffData,
});
const reviewContentKey = selectedSection
Expand Down Expand Up @@ -617,7 +642,12 @@ export function ReviewSheet(props: ReviewSheetProps) {
params: { environmentId: String(environmentId), threadId: String(threadId) },
});
};
const gitRepositoryLabel =
repositories.length > 1 && selectedSection?.kind !== "turn" && selectedGitRepository
? selectedGitRepository.name + ": " + (selectedGitRepository.branch ?? "HEAD")
: null;
const androidHeaderSubtitle = [
gitRepositoryLabel,
selectedSection?.title,
selectedRepository?.name,
headerDiffSummary.additions,
Expand Down Expand Up @@ -686,6 +716,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
return <>{children}</>;
})();
const headerSubtitle = [
gitRepositoryLabel,
selectedRepository?.name,
headerDiffSummary.additions,
headerDiffSummary.deletions,
Expand Down Expand Up @@ -713,7 +744,10 @@ export function ReviewSheet(props: ReviewSheetProps) {
title={headerTitleText}
subtitle={headerSubtitle}
androidSubtitle={androidHeaderSubtitle}
selectedThreadCwd={selectedThreadCwd}
selectedThreadCwd={repositoryPath ? null : selectedThreadCwd}
repositories={repositories}
selectedGitRepository={selectedGitRepository}
onSelectGitRepository={selectGitRepository}
sectionMenu={sectionMenu}
selectedSection={selectedSection}
showSectionToolbar={showSectionToolbar}
Expand Down
5 changes: 5 additions & 0 deletions apps/mobile/src/features/review/reviewModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ describe("resolveReviewSelectedSectionId", () => {

it("shows Changes before anything is picked, not the first section", () => {
expect(resolveReviewSelectedSectionId([turn, changes], null)).toBe("git:branch-range");
const childChanges = { ...changes, id: "git:branch-range:packages/auth" };
expect(resolveReviewSelectedSectionId([turn, childChanges], null)).toBe(childChanges.id);
expect(
resolveReviewSelectedSectionId([turn, childChanges], "git:branch-range:packages/ui"),
).toBe(childChanges.id);
});

it("shows the default while the picked section loads and returns to the pick once it does", () => {
Expand Down
8 changes: 4 additions & 4 deletions apps/mobile/src/features/review/reviewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type ReviewSectionKind = "turn" | "working-tree" | "branch-range";
export type ReviewGitSectionKind = Exclude<ReviewSectionKind, "turn">;
type ReviewGitSource = ReviewDiffPreviewSource & { readonly kind: ReviewGitSectionKind };

const CHANGES_SECTION_ID = "git:branch-range";
const GIT_SECTION_KINDS = ["working-tree", "branch-range"] as const;
const GIT_PLACEHOLDER_TITLES = {
"working-tree": msg("Uncommitted", { $context: "diff section: working tree" }),
Expand Down Expand Up @@ -571,6 +570,7 @@ export function reviewTurnDiffsBySectionId(
}

export function buildReviewSectionItems(input: {
readonly repositoryPath?: string;
readonly checkpoints: ReadonlyArray<ThreadCheckpointSummary>;
readonly gitSections: ReadonlyArray<ReviewDiffPreviewSource>;
readonly turnDiffById: Readonly<Record<string, string | undefined>>;
Expand Down Expand Up @@ -607,7 +607,7 @@ export function buildReviewSectionItems(input: {
if (section) {
return [
{
id: `git:${kind}`,
id: input.repositoryPath ? `git:${kind}:${input.repositoryPath}` : `git:${kind}`,
kind,
title: section.title,
subtitle: gitSubtitle(section, resolve),
Expand All @@ -624,7 +624,7 @@ export function buildReviewSectionItems(input: {
? []
: [
{
id: `git:${kind}`,
id: input.repositoryPath ? `git:${kind}:${input.repositoryPath}` : `git:${kind}`,
kind,
title: resolve(GIT_PLACEHOLDER_TITLES[kind]),
subtitle: null,
Expand All @@ -640,7 +640,7 @@ export function buildReviewSectionItems(input: {
export function getDefaultReviewSectionId(
sections: ReadonlyArray<ReviewSectionItem>,
): string | null {
return (sections.find((section) => section.id === CHANGES_SECTION_ID) ?? sections[0])?.id ?? null;
return (sections.find((section) => section.kind === "branch-range") ?? sections[0])?.id ?? null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function useReviewCommentSelectionController(input: {
readonly environmentId?: EnvironmentId;
readonly threadId?: ThreadId;
readonly selectedSection: ReviewSectionItem | null;
readonly repositoryPath?: string;
readonly nativeReviewDiffData: NativeReviewDiffData;
}) {
const { environmentId, nativeReviewDiffData, selectedSection, threadId } = input;
Expand Down Expand Up @@ -103,19 +104,22 @@ export function useReviewCommentSelectionController(input: {
return;
}

const filePath = input.repositoryPath
? input.repositoryPath + "/" + target.filePath
: target.filePath;
if (gesture === "longPress") {
startReviewCommentRange(scope, {
sectionId: selectedSection.id,
sectionTitle: selectedSection.title,
filePath: target.filePath,
filePath,
lines: target.lines,
lineIndex: target.lineIndex,
rowId,
});
return;
}

if (pendingRange && pendingRange.filePath === target.filePath) {
if (pendingRange && pendingRange.filePath === filePath) {
completeReviewCommentRange(
scope,
buildReviewCommentTarget(pendingRange, pendingRange.lineIndex, target.lineIndex),
Expand All @@ -126,7 +130,7 @@ export function useReviewCommentSelectionController(input: {
setReviewCommentTarget(scope, {
sectionTitle: selectedSection.title,
sectionId: selectedSection.id,
filePath: target.filePath,
filePath,
lines: target.lines,
startIndex: target.lineIndex,
endIndex: target.lineIndex,
Expand Down
23 changes: 18 additions & 5 deletions apps/mobile/src/features/review/useReviewDiffData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export function useReviewDiffData(input: {
readonly threadKey: string | null;
readonly environmentId: EnvironmentId | undefined;
readonly cwd: string | null;
readonly repositoryPath?: string;
readonly selectedSection: ReviewSectionItem | null;
readonly draftMessage: string;
readonly draftContext: OrchestrationMessageContext | undefined;
Expand Down Expand Up @@ -183,7 +184,7 @@ export function useReviewDiffData(input: {
[sectionDiff, repositoryFolder, repositoryFolders],
);
const registry = useContext(RegistryContext);
const { environmentId, cwd } = input;
const { environmentId, cwd, repositoryPath } = input;
const scope = JSON.stringify([environmentId, cwd, lazySource?.kind, source?.baseRef]);
const hideTestFilesPreference = useHideTestFilesPreference();
const { hideTestFiles } = hideTestFilesPreference;
Expand Down Expand Up @@ -211,9 +212,14 @@ export function useReviewDiffData(input: {
input: {
cacheKey: scope,
// Newer preview revisions refresh patches read under an older one.
preview: { cwd, sourceKind: lazySource.kind },
preview: {
cwd,
sourceKind: lazySource.kind,
...(repositoryPath ? { requireRepositoryRoot: true } : {}),
},
request: {
cwd,
...(repositoryPath ? { requireRepositoryRoot: true } : {}),
...(lazySource.baseRef ? { baseRef: lazySource.baseRef } : {}),
...(lazySource.mergeBase ? { mergeBase: lazySource.mergeBase } : {}),
file: {
Expand All @@ -227,7 +233,7 @@ export function useReviewDiffData(input: {
})
: null,
),
[environmentId, cwd, lazySource, indices, scope],
[environmentId, cwd, lazySource, indices, scope, repositoryPath],
);
const parsedQuery = useMemo(
() =>
Expand Down Expand Up @@ -288,8 +294,15 @@ export function useReviewDiffData(input: {
if (!selectedSectionId || inlineReviewComments.length === 0) {
return EMPTY_INLINE_REVIEW_COMMENTS;
}
return inlineReviewComments.filter((comment) => comment.sectionId === selectedSectionId);
}, [inlineReviewComments, selectedSectionId]);
const prefix = input.repositoryPath ? input.repositoryPath + "/" : "";
return inlineReviewComments
.filter((comment) => comment.sectionId === selectedSectionId)
.map((comment) =>
prefix && comment.filePath.startsWith(prefix)
? { ...comment, filePath: comment.filePath.slice(prefix.length) }
: comment,
);
}, [inlineReviewComments, selectedSectionId, input.repositoryPath]);
const shownDiff = useMemo(
() => filterPullRequestTestFiles(parsedDiff, hideTestFiles),
[parsedDiff, hideTestFiles],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export function useReviewHeaderPresentation(props: {
);
// Selection-based git hooks apply only to reviews of the selected thread.
const gitMenuAvailable =
selectedThread !== null && String(selectedThread.id) === String(props.threadId);
selectedThread !== null &&
String(selectedThread.id) === String(props.threadId) &&
props.selectedThreadCwd !== null;
const gitMenu = useThreadGitMenuDefinition({
environmentId: props.environmentId,
threadId: props.threadId,
Expand Down
Loading
Loading