Skip to content

Commit 39d90e7

Browse files
test(server): keep one untracked-totals backoff case and trim comments
AI-assisted; verified with the tests and tools listed above.
1 parent 143edca commit 39d90e7

2 files changed

Lines changed: 1 addition & 49 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6946,52 +6946,7 @@ describe("Windows long path configuration", () => {
69466946
});
69476947
});
69486948

6949-
// The listing walks the whole untracked tree before the 5,000-path cap applies, so a folder
6950-
// that failed once costs the same on every status poll. Branch totals remember the failure and
6951-
// back off until the untracked roots change.
69526949
it.layer(layerTest)("branch change totals after a failed untracked listing", (it) => {
6953-
// A listing that fails (here: output past the limit) backs off like one over the cap.
6954-
it.effect("do not repeat an untracked listing that failed", () =>
6955-
Effect.gen(function* () {
6956-
const fs = yield* FileSystem.FileSystem;
6957-
const path = yield* Path.Path;
6958-
const cwd = yield* makeTmpDir("git-untracked-error-");
6959-
yield* initRepoWithCommit(cwd);
6960-
yield* fs.writeFileString(path.join(cwd, "untracked.txt"), "new\n");
6961-
let listings = 0;
6962-
const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
6963-
// Stands in for a listing that floods its output past the 16 MiB limit.
6964-
const flood = ChildProcess.make(process.execPath, [
6965-
"-e",
6966-
"const b = Buffer.alloc(1 << 20, 120); (function w() { process.stdout.write(b, w); })();",
6967-
]);
6968-
const spawner = ChildProcessSpawner.make((command) =>
6969-
Effect.suspend(() => {
6970-
if (
6971-
ChildProcess.isStandardCommand(command) &&
6972-
command.args.includes("ls-files") &&
6973-
command.args.includes("--others")
6974-
) {
6975-
listings++;
6976-
return delegate.spawn(flood);
6977-
}
6978-
return delegate.spawn(command);
6979-
}),
6980-
);
6981-
const driver = yield* makeGitVcsDriverCore().pipe(
6982-
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
6983-
Effect.provide(layerServerConfig),
6984-
);
6985-
const read = driver.statusDetailsLocal(cwd, { includeBranchChanges: true });
6986-
assert.strictEqual((yield* read).branchChanges, undefined);
6987-
yield* read;
6988-
assert.strictEqual(listings, 1, "the failed listing is not repeated within the backoff");
6989-
yield* TestClock.adjust("1 minute");
6990-
yield* read;
6991-
assert.strictEqual(listings, 2);
6992-
}),
6993-
);
6994-
69956950
it.effect("do not list untracked files again on every status read", () =>
69966951
Effect.gen(function* () {
69976952
const fs = yield* FileSystem.FileSystem;

‎apps/server/src/vcs/GitVcsDriverCore.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,6 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
31623162
return stdout.trim();
31633163
});
31643164

3165-
// `unavailable` says why the untracked files could not be indexed.
31663165
const prepareUntrackedReviewIndexOrReason = Effect.fn("prepareUntrackedReviewIndex")(function* (
31673166
cwd: string,
31683167
pathArgs: ReadonlyArray<string>,
@@ -3285,8 +3284,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
32853284
roots.length <= 128 && roots.reduce((length, root) => length + root.length + 16, 0) < 8_000
32863285
? roots.map((root) => `:(top,literal)${root}`)
32873286
: [];
3288-
// Until the retry time, the same untracked roots get the remembered failure without a scan;
3289-
// different roots (files added or removed at status level) scan again at once.
3287+
// Changed untracked roots skip the backoff and scan again.
32903288
const rootsKey = roots.join("\0");
32913289
const remembered = untrackedTotalsFailures.get(cwd);
32923290
if (
@@ -3305,7 +3303,6 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
33053303
const untracked = yield* prepareUntrackedReviewIndexOrReason(cwd, pathspecs);
33063304
if ("unavailable" in untracked) {
33073305
const count = remembered?.roots === rootsKey ? remembered.count + 1 : 1;
3308-
// Bounded like the remote refresh failures: the oldest folder is forgotten first.
33093306
untrackedTotalsFailures.delete(cwd);
33103307
untrackedTotalsFailures.set(cwd, {
33113308
roots: rootsKey,

0 commit comments

Comments
 (0)