Skip to content

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

TypeScript

test(mcp-host): prove the GFS sweep keeps an entry whose removal failed

Alfredo Lopez88b8f6d1bb79
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 82d43ce64..e6ef5233b 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.533",
+ "version": "0.1.534",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.533",
+ "version": "0.1.534",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 0926ea7cf..8d280d045 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.533",
+ "version": "0.1.534",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts b/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts
index d35ffcd61..cf4fd20bb 100644
--- a/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts
+++ b/mcp-host/src/internalTools/gfsDownloadStoreAdversarial.test.ts
@@ -467,6 +467,29 @@ describe('GFS download store adversarial round: trash, eviction and undo (ADV-2/
expect(exists(renames[0]!)).toBe(false)
expect(await expiryCount('incomplete_removed')).toBe(removed)
})
+
+ it('a sweep keeps an incomplete entry indexed until its removal succeeds', async () => {
+ const store = await openStore()
+ const root = callerDirectory(hostRoot, KEY)
+ const { receipt } = await completedCopy(store, root, KEY, 8, 16)
+ const directory = path.join(root, `.gfs-downloads/input-${receipt.id}`)
+ // A shorter source makes the indexed copy incomplete for the sweep.
+ syncFs.writeFileSync(path.join(directory, 'source'), 'short')
+ const failedRemovals = await expiryCount('remove_failed')
+ const removals = watch('rm', '', 'EIO')
+
+ await store.cleanupExpired()
+ faults.clear()
+
+ // Witness: the sweep tried to remove it, and the removal failed.
+ expect(removals).toHaveLength(1)
+ expect(await expiryCount('remove_failed')).toBe(failedRemovals + 1)
+ expect(indexedEntry(store, receipt.id)).toBeDefined()
+
+ await store.cleanupExpired()
+ expect(exists(directory)).toBe(false)
+ expect(() => indexedEntry(store, receipt.id)).toThrow('entry is not indexed')
+ })
})
interface IndexedEntryView {
diff --git a/scripts/ci/pinned-vitest-cases/mcp-host.json b/scripts/ci/pinned-vitest-cases/mcp-host.json
index ef3dd2d64..b04a06193 100644
--- a/scripts/ci/pinned-vitest-cases/mcp-host.json
+++ b/scripts/ci/pinned-vitest-cases/mcp-host.json
@@ -703,6 +703,10 @@
"suite": "gfsDownloadStoreAdversarial.test.ts",
"fullName": "GFS download store adversarial round: trash, eviction and undo (ADV-2/F2/F3/F8) a removal of a directory that never existed is not counted as removed"
},
+ {
+ "suite": "gfsDownloadStoreAdversarial.test.ts",
+ "fullName": "GFS download store adversarial round: trash, eviction and undo (ADV-2/F2/F3/F8) a sweep keeps an incomplete entry indexed until its removal succeeds"
+ },
{
"suite": "gfsDownloadStoreAdversarial.test.ts",
"fullName": "GFS download store adversarial round: expiry, close, recency and removal proof S17: createTransfer refuses an expiry at or before its creation instant"