Skip to content

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

TypeScript

fix(control-ui): resolve drive root hierarchy (r8-m4)

Josué370bcc0a31e2
diff --git a/control-ui/lib/__tests__/gfsHierarchyRevalidation.test.ts b/control-ui/lib/__tests__/gfsHierarchyRevalidation.test.ts
new file mode 100644
index 000000000..064f1187b
--- /dev/null
+++ b/control-ui/lib/__tests__/gfsHierarchyRevalidation.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it, vi } from 'vitest'
+import { resolveGfsHierarchy } from '../gfsHierarchyRevalidation'
+
+describe('GFS hierarchy revalidation', () => {
+ it('accepts the drive root without attempting to resolve a parent', async () => {
+ const root = {
+ resourceId: 'root-id',
+ rid: 'root-rid',
+ gfsUri: 'gfs://drive/root',
+ name: 'Root',
+ kind: 'directory',
+ path: '/',
+ version: 1,
+ }
+ const readAncestor = vi.fn()
+
+ await expect(
+ resolveGfsHierarchy({
+ readCurrent: async () => root,
+ readAncestor,
+ isTransient: () => false,
+ })
+ ).resolves.toEqual({ kind: 'resolved', ancestors: [] })
+ expect(readAncestor).not.toHaveBeenCalled()
+ })
+})
diff --git a/control-ui/lib/gfsHierarchyRevalidation.ts b/control-ui/lib/gfsHierarchyRevalidation.ts
index 16d712a98..5f370b6e1 100644
--- a/control-ui/lib/gfsHierarchyRevalidation.ts
+++ b/control-ui/lib/gfsHierarchyRevalidation.ts
@@ -37,9 +37,12 @@ export async function resolveGfsHierarchy(input: {
if (current.kind !== 'directory') return { kind: 'missing' }
if (!current.path || !current.path.startsWith('/')) return { kind: 'preserve' }
+ const segments = current.path.split('/').filter(Boolean)
+ if (segments.length === 0) return { kind: 'resolved', ancestors: [] }
+
const ancestors: GfsHierarchyResource[] = []
let path = ''
- for (const segment of current.path.split('/').filter(Boolean)) {
+ for (const segment of segments) {
path += `/${segment}`
let ancestor: GfsHierarchyResource
try {
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 9f2bbd129..361b54b6f 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.691",
+ "version": "0.1.692",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.691",
+ "version": "0.1.692",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 78a3f4770..d65a65f31 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.691",
+ "version": "0.1.692",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",