Skip to content

Commit 5584d21

Browse files
realhasanshoaibclaudeYash-Singh1
authored
fix(server): update fff to stop runaway watcher rescans (pingdotgg#14543)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: Yash Singh <[email protected]>
1 parent 4b6d9a0 commit 5584d21

8 files changed

Lines changed: 140 additions & 99 deletions

File tree

‎apps/server/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@cursor/sdk": "1.0.35",
3434
"@effect/platform-node": "catalog:",
3535
"@effect/platform-node-shared": "catalog:",
36-
"@ff-labs/fff-node": "0.9.4",
36+
"@ff-labs/fff-node": "0.11.0",
3737
"@muse-code/sdk": "1.4.2",
3838
"@napi-rs/keyring": "^1.3.0",
3939
"@opencode-ai/sdk": "^1.3.15",

‎apps/server/src/workspace/WorkspaceEntries.test.ts‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,42 @@ it.layer(layerTest, { excludeTestServices: true })("WorkspaceEntries", (it) => {
192192
60_000,
193193
);
194194

195+
it.effect("includes images and other binary files in non-git workspace indexes", () =>
196+
Effect.gen(function* () {
197+
const cwd = yield* makeTempDir();
198+
const imagePaths = ["photo.png", "photo.jpg", "photo.jpeg"];
199+
const binaryPaths = [...imagePaths, "document.pdf", "archive.zip", "data.bin"];
200+
for (const filePath of binaryPaths) {
201+
yield* writeTextFile(cwd, filePath, "\0binary contents\n");
202+
}
203+
yield* writeTextFile(cwd, "notes.txt", "plain text\n");
204+
205+
const workspaceEntries = yield* WorkspaceEntries.WorkspaceEntries;
206+
const expectedPaths = [...binaryPaths, "notes.txt"].toSorted();
207+
const listed = yield* workspaceEntries.list({ cwd });
208+
expect(listed.entries.map((entry) => entry.path).toSorted()).toEqual(expectedPaths);
209+
expect(listed.truncated).toBe(false);
210+
211+
const searched = yield* workspaceEntries.search({
212+
cwd,
213+
query: "",
214+
limit: 100,
215+
kind: "file",
216+
});
217+
expect(searched.entries.map((entry) => entry.path).toSorted()).toEqual(expectedPaths);
218+
expect(searched.truncated).toBe(false);
219+
220+
const images = yield* workspaceEntries.search({
221+
cwd,
222+
query: "",
223+
limit: 100,
224+
imageOnly: true,
225+
});
226+
expect(images.entries.map((entry) => entry.path).toSorted()).toEqual(imagePaths.toSorted());
227+
expect(images.truncated).toBe(false);
228+
}),
229+
);
230+
195231
it.effect("returns the complete cached workspace index", () =>
196232
Effect.gen(function* () {
197233
const cwd = yield* makeTempDir();

‎patches/@[email protected]‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/package.json b/package.json
2+
index e000a78..8432546 100644
3+
--- a/package.json
4+
+++ b/package.json
5+
@@ -11,7 +11,7 @@
6+
".": {
7+
"types": "./dist/index.d.ts",
8+
"import": "./dist/index.js",
9+
- "require": "./dist/index.cjs",
10+
+ "require": "./dist/index.js",
11+
"default": "./dist/index.js"
12+
},
13+
"./package.json": "./package.json"
14+
diff --git a/dist/index.js b/dist/index.js
15+
index 7c1d722..1d0bc27 100644
16+
--- a/dist/index.js
17+
+++ b/dist/index.js
18+
@@ -1,7 +1,7 @@
19+
// src/binary.ts
20+
import { existsSync, readFileSync } from "fs";
21+
import { createRequire } from "module";
22+
-import { dirname, join } from "path";
23+
+import { dirname, join, sep } from "path";
24+
import { fileURLToPath } from "url";
25+
26+
// src/platform.ts
27+
@@ -120,6 +120,16 @@ function getPackageDir() {
28+
function binaryExists() {
29+
return findBinary() !== null;
30+
}
31+
+function resolveUnpackedAsarPath(binaryPath) {
32+
+ const pathSegments = binaryPath.split(sep);
33+
+ const asarIndex = pathSegments.findLastIndex((segment) => segment.endsWith(".asar"));
34+
+ if (asarIndex === -1) {
35+
+ return binaryPath;
36+
+ }
37+
+ pathSegments[asarIndex] = `${pathSegments[asarIndex]}.unpacked`;
38+
+ const unpackedPath = pathSegments.join(sep);
39+
+ return existsSync(unpackedPath) ? unpackedPath : binaryPath;
40+
+}
41+
function resolveFromNpmPackage() {
42+
const packageName = getNpmPackageName();
43+
try {
44+
@@ -128,7 +138,7 @@ function resolveFromNpmPackage() {
45+
const packageDir = dirname(packageJsonPath);
46+
const binaryPath = join(packageDir, getLibFilename());
47+
if (existsSync(binaryPath)) {
48+
- return binaryPath;
49+
+ return resolveUnpackedAsarPath(binaryPath);
50+
}
51+
} catch {
52+
}

‎patches/@[email protected]‎

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎pnpm-lock.yaml‎

Lines changed: 48 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ patchedDependencies:
292292
293293
294294
295-
"@ff-labs/fff-node@0.9.4": patches/@ff-labs__fff-node@0.9.4.patch
295+
"@ff-labs/fff-node@0.11.0": patches/@ff-labs__fff-node@0.11.0.patch
296296
"@legendapp/[email protected]": patches/@[email protected]
297297
"@opencode/[email protected]": patches/@[email protected]
298298
"@opencode/[email protected]": patches/@[email protected]

‎scripts/build-desktop-artifact.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
15271527
primaryProbe.args[4],
15281528
path.join(
15291529
fixture.packagedAppDir,
1530-
"resources/server.asar/node_modules/@ff-labs/fff-node/dist/src/index.js",
1530+
"resources/server.asar/node_modules/@ff-labs/fff-node/dist/index.js",
15311531
),
15321532
);
15331533
assert.equal(primaryProbe.options.cwd, fixture.packagedAppDir);

‎scripts/build-desktop-artifact.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,10 +3236,7 @@ export const verifyWindowsPrimaryFffNativeLoad = Effect.fn(
32363236
const probeRoot = yield* fs.makeTempDirectoryScoped({
32373237
prefix: "t3code-windows-primary-native-probe-",
32383238
});
3239-
const fffEntryPath = path.join(
3240-
input.asarPath,
3241-
"node_modules/@ff-labs/fff-node/dist/src/index.js",
3242-
);
3239+
const fffEntryPath = path.join(input.asarPath, "node_modules/@ff-labs/fff-node/dist/index.js");
32433240
const probeEnv = { ...process.env };
32443241
delete probeEnv.ELECTRON_NO_ASAR;
32453242
delete probeEnv.NODE_OPTIONS;

0 commit comments

Comments
 (0)