Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(hcc): read directory entry types instead of stat-then-read

Alfredo Lopez7cee16874456
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index ce2ef8678..ff63c4035 100644
--- a/host-context-controller/package-lock.json
+++ b/host-context-controller/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.383",
+ "version": "0.1.384",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.383",
+ "version": "0.1.384",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/codex-catalog-projection": "file:../packages/codex-catalog-projection",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index d6a0ec384..eefa0f2ba 100644
--- a/host-context-controller/package.json
+++ b/host-context-controller/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.383",
+ "version": "0.1.384",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/test/statelessDeployment.workspaceLayoutMerge.test.ts b/host-context-controller/test/statelessDeployment.workspaceLayoutMerge.test.ts
index 3a04d992e..6f33afb72 100644
--- a/host-context-controller/test/statelessDeployment.workspaceLayoutMerge.test.ts
+++ b/host-context-controller/test/statelessDeployment.workspaceLayoutMerge.test.ts
@@ -12,7 +12,6 @@ import { createHash } from 'node:crypto'
import {
chmodSync,
cpSync,
- lstatSync,
mkdirSync,
mkdtempSync,
readFileSync,
@@ -47,9 +46,8 @@ afterEach(() => {
function chmodRecursive(dir: string): void {
chmodSync(dir, 0o755)
- for (const name of readdirSync(dir)) {
- const path = join(dir, name)
- if (lstatSync(path).isDirectory()) chmodRecursive(path)
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ if (entry.isDirectory()) chmodRecursive(join(dir, entry.name))
}
}
@@ -122,12 +120,14 @@ function copyTree(root: string): string {
function snapshot(root: string): Record<string, string> {
const out: Record<string, string> = {}
const walk = (dir: string, rel: string) => {
- for (const name of readdirSync(dir).sort()) {
- const path = join(dir, name)
- const key = rel ? `${rel}/${name}` : name
- const st = lstatSync(path)
- if (st.isSymbolicLink()) out[key] = `link:${readlinkSync(path)}`
- else if (st.isDirectory()) {
+ const entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) =>
+ a.name < b.name ? -1 : a.name > b.name ? 1 : 0
+ )
+ for (const entry of entries) {
+ const path = join(dir, entry.name)
+ const key = rel ? `${rel}/${entry.name}` : entry.name
+ if (entry.isSymbolicLink()) out[key] = `link:${readlinkSync(path)}`
+ else if (entry.isDirectory()) {
out[key] = 'dir'
walk(path, key)
} else out[key] = createHash('sha256').update(readFileSync(path)).digest('hex')