Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): resolve slashed file-chip paths through the workspace index #18358

Closedcbangera2(GitHub profile, opens in a new tab)wants to merge 16 commits intomain fromrefs/pull/18358/headopened View on GitHub

Showing 5 changed files with 177 additions and 5 deletions (loading 3).

x
0 of 5 viewed, 5 left
52 additions and 0 deletionsapps/web/src/components/ChatMarkdown.browser.test.tsxModified
View file
@@ -258,6 +258,58 @@
expect(openFile).toHaveBeenCalledExactlyOnceWith(threadRef, "/elsewhere/b.md", 9);
expect(workspaceSearch).toHaveBeenCalledOnce();
});
+​
+ // regression: #18358 a missing slashed path opens the one indexed file ending with it
+ it("opens a missing slashed path at its unique indexed suffix", async () => {
+ setup();
+ workspaceSearch.mockResolvedValue(
+ AsyncResult.success({
+ entries: [
+ { path: "other/GROUPS_PLAN.md", kind: "file" },
+ { path: "BudgetLens/mydocs/GROUPS_PLAN.md", kind: "file" },
+ { path: "BudgetLens/docs/GROUPS_PLAN.md", kind: "file" },
+ ],
+ truncated: true,
+ }),
+ );
+ using openFile = vi
+ .spyOn(useRightPanelStore.getState(), "openFile")
+ .mockImplementation(() => {});
+ await using screen = await renderText("[Plan](docs/GROUPS_PLAN.md:12)", {
+ cwd: "/work",
+ threadRef,
+ });
+ await act(async () => screen.container.querySelector("a")!.click());
+​
+ expect(filesystemMetadata).toHaveBeenCalledExactlyOnceWith({
+ environmentId: threadRef.environmentId,
+ input: { paths: ["/work/docs/GROUPS_PLAN.md"] },