Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(shared): skip duplicate PATH entries and per-probe tracing #9618

Mergedjadeva(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/9618/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 129 additions and 4 deletions.

x
0 of 2 viewed, 2 left
121 additions and 0 deletionspackages/shared/src/shell.test.tsModified
View file
@@ -2,11 +2,15 @@
import { it as effectIt } from "@effect/vitest";
import { HostProcessEnvironment, HostProcessPlatform } from "@t3tools/shared/hostProcess";
import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Path from "effect/Path";
+import * as TestClock from "effect/testing/TestClock";
import { describe, expect, it, vi } from "vite-plus/test";
​
import {
extractPathFromShellOutput,
CommandAvailability,
+ CommandResolutionCache,
type CommandAvailabilityChecker,
isCommandAvailable,
listLoginShellCandidates,
@@ -375,6 +379,123 @@
expect(result._tag).toBe("Failure");
}),
+​
+ // Records every path the scan stats, without ever reporting a match, so the
+ // walk runs to exhaustion and the probe set can be inspected. Assertions
+ // below count probes rather than naming paths: `Path` is the host's, so the
+ // separator differs between a Windows and a Linux CI runner.
+ const recordProbes = (env: NodeJS.ProcessEnv) =>
+ Effect.gen(function* () {
+ const probed: Array<string> = [];
+ const result = yield* resolveCommandPath("definitely-not-installed", { env }).pipe(