Skip to content

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

TypeScript

test(hcc): tighten Deployment inventory and add ConfigMap call-site lock

Alfredo Lopez088305db6851
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index 66687218b..1d372dfaa 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.281",
+ "version": "0.1.282",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.281",
+ "version": "0.1.282",
"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 cfd6aa0bb..e0bd1a0ad 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.281",
+ "version": "0.1.282",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/src/__tests__/deploymentWriterInventory.test.ts b/host-context-controller/src/__tests__/deploymentWriterInventory.test.ts
index ec1e2db33..58eeb1f23 100644
--- a/host-context-controller/src/__tests__/deploymentWriterInventory.test.ts
+++ b/host-context-controller/src/__tests__/deploymentWriterInventory.test.ts
@@ -78,7 +78,10 @@ function enclosingReplaceRetryBlock(source: string, callIndex: number): string |
}
function isDeploymentGated(block: string): boolean {
- return /isUpToDate:/.test(block) && /deploymentMatchesDesired/.test(block)
+ return (
+ /isUpToDate:\s*deploymentMatchesDesired\b/.test(block) ||
+ /return deploymentMatchesDesired\s*\(/.test(block)
+ )
}
describe('Deployment writer inventory', () => {
@@ -128,4 +131,43 @@ describe('Deployment writer inventory', () => {
.sort()
).toEqual([...GATED].sort())
})
+
+ it('every replaceNamespacedConfigMap call is gated per call-site', () => {
+ const CONFIGMAP_GATED = new Set(['reconciler.ts'])
+ const CONFIGMAP_CALL = /replaceNamespacedConfigMap\s*\(/g
+ const hits: Array<{ rel: string; count: number }> = []
+
+ for (const file of productionTsFiles(SRC_ROOT)) {
+ const rel = relative(SRC_ROOT, file).replaceAll('\\', '/')
+ const source = readFileSync(file, 'utf8')
+ const sites: number[] = []
+ for (const match of source.matchAll(CONFIGMAP_CALL)) {
+ if (match.index === undefined) continue
+ if (isCommentLine(lineAt(source, match.index))) continue
+ sites.push(match.index)
+ }
+ if (sites.length === 0) continue
+
+ expect(
+ CONFIGMAP_GATED.has(rel),
+ `${rel} calls replaceNamespacedConfigMap ${sites.length} time(s) but is not on the ConfigMap gated list`
+ ).toBe(true)
+
+ for (const index of sites) {
+ const block = enclosingReplaceRetryBlock(source, index)
+ expect(
+ block,
+ `${rel} ConfigMap call at index ${index} is not inside replaceWithConflictRetry`
+ ).not.toBeNull()
+ expect(
+ /isUpToDate:\s*configMapMatchesDesired\b/.test(block ?? ''),
+ `${rel} ConfigMap call at index ${index} is missing isUpToDate: configMapMatchesDesired`
+ ).toBe(true)
+ }
+ hits.push({ rel, count: sites.length })
+ }
+
+ expect(hits.map(h => h.rel).sort()).toEqual([...CONFIGMAP_GATED].sort())
+ expect(hits.reduce((sum, h) => sum + h.count, 0)).toBe(1)
+ })
})