Skip to content

Commit d6d8279

Browse files
chore(web): trim verbose comments from review fixes
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5da3214 commit d6d8279

5 files changed

Lines changed: 13 additions & 19 deletions

File tree

packages/web/src/ee/features/chat/components/chatThread/referencedFileSourceListItemContainer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ const ReferencedFileSourceListItemContainerComponent = ({
5252
ref: fetchRef,
5353
});
5454

55-
// The pinned commit can disappear (e.g. a force-push + GC prunes it),
56-
// which surfaces as an unresolvable git ref. Only that case falls
57-
// back to the symbolic ref; other errors (repo/path/access) are
58-
// surfaced as-is so we don't silently render the wrong revision.
55+
// A gone pinned commit (e.g. force-push + GC) surfaces as an
56+
// unresolvable ref. Only then fall back to the symbolic ref; other
57+
// errors are surfaced as-is rather than silently showing latest.
5958
if (
6059
isServiceError(pinned) &&
6160
pinned.errorCode === ErrorCode.INVALID_GIT_REF &&

packages/web/src/features/git/getFileSourceApi.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ describe('getFileSourceForRepo', () => {
9292
mockSimpleGit.mockReturnValue({ cwd: mockCwd });
9393
mockFindFirst.mockResolvedValue(MOCK_REPO);
9494

95-
// Default: ref resolves to a concrete sha, file show succeeds, and
96-
// .gitattributes is absent. The SUT resolves the ref first (rev-parse),
97-
// then reads content + .gitattributes at the resolved sha.
95+
// ref resolves to a sha, file show succeeds, .gitattributes is absent.
9896
mockGitRaw.mockImplementation(async (args: string[]) => {
9997
if (args[0] === 'rev-parse') {
10098
return 'resolvedsha\n';
@@ -203,7 +201,7 @@ describe('getFileSourceForRepo', () => {
203201
// pr_payload.head_sha as ref, but the bare clone hasn't fetched it yet.
204202
mockGitRaw.mockRejectedValue(
205203
new Error("fatal: ambiguous argument 'deadbeef': unknown revision or path not in the working tree"),
206-
); // rejects rev-parse (swallowed) and the show, which drives the result
204+
);
207205

208206
const result = await getFileSourceForRepo(
209207
{ path: 'src/index.ts', repo: 'github.com/owner/repo', ref: 'deadbeef' },

packages/web/src/features/git/getFileSourceApi.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ export const getFileSourceForRepo = async (
4747

4848
const gitRef = ref ?? repo.defaultBranch ?? 'HEAD';
4949

50-
// Resolve the symbolic ref to a concrete commit up front so the content,
51-
// language, and commitSha all come from the same revision even if the ref
52-
// moves mid-request. `^{commit}` peels annotated tags. Reads below fall back
53-
// to the symbolic ref when resolution fails.
50+
// Resolve to a concrete commit up front so content, language, and commitSha
51+
// all come from one revision even if the ref moves mid-request. `^{commit}`
52+
// peels annotated tags. Reads below fall back to the symbolic ref.
5453
let commitSha: string | undefined;
5554
try {
5655
commitSha = (await git.raw(['rev-parse', `${gitRef}^{commit}`])).trim();
5756
} catch {
58-
// Leave unpinned; the reads below use the symbolic ref.
57+
// Leave unpinned.
5958
}
6059
const readRef = commitSha ?? gitRef;
6160

packages/web/src/features/tools/findSymbolDefinitions.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ export const findSymbolDefinitionsDefinition: ToolDefinition<
6363
codeHostType: repoInfoResult.codeHostType,
6464
};
6565

66-
// Pin to the indexed commit carried by the same search snapshot that
67-
// produced these matches, rather than a follow-up repo-info lookup that
68-
// could drift if the index advances in between.
66+
// Pin from the indexed commit in this search's snapshot, not a separate
67+
// repo-info lookup that could drift if the index advances in between.
6968
const indexedCommitShaByRepo = new Map(
7069
response.repositoryInfo.map((info) => [info.name, info.indexedCommitHash]),
7170
);

packages/web/src/features/tools/findSymbolReferences.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ export const findSymbolReferencesDefinition: ToolDefinition<
7474
codeHostType: repoInfoResult.codeHostType,
7575
};
7676

77-
// Pin to the indexed commit carried by the same search snapshot that
78-
// produced these matches, rather than a follow-up repo-info lookup that
79-
// could drift if the index advances in between.
77+
// Pin from the indexed commit in this search's snapshot, not a separate
78+
// repo-info lookup that could drift if the index advances in between.
8079
const indexedCommitShaByRepo = new Map(
8180
response.repositoryInfo.map((info) => [info.name, info.indexedCommitHash]),
8281
);

0 commit comments

Comments
 (0)