Skip to content

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

TypeScript

test(hcc): clarify acceptance and enforce rotation write paths

Alfredo Lopez1061866b65c5
diff --git a/host-context-controller/CREATE_OBSERVABILITY.md b/host-context-controller/CREATE_OBSERVABILITY.md
index 2882c15a6..fc19e0af1 100644
--- a/host-context-controller/CREATE_OBSERVABILITY.md
+++ b/host-context-controller/CREATE_OBSERVABILITY.md
@@ -98,6 +98,9 @@ dot-property `readNamespaced*`/`readCluster*` calls. Each must be observed or ma
exclusion keyed by file, enclosing operation and SDK method, with an expected
expression count and reason. It currently accounts for 26 observed expressions
and 43 excluded ones. New unclassified reads and stale exclusions fail the test.
+The plan's forecast of 27 reads became 26: 21 original expressions plus six new
+ones minus the duplicate channel-reader Deployment expression. That retry now
+uses the helper's validated read callback; no retry path was removed.
This is structural coverage, not execution evidence: changed purpose inside an
excluded operation still needs review, and computed-property or indirect/aliased calls are outside this
static-analysis guarantee. The behavioral tests and deployed validation
@@ -131,6 +134,11 @@ supersession retains its separate error path. Preserved existing resources gain
no PUT or synthetic equality comparison. An unbound Host PVC retains its direct
update policy.
+This RBAC propagation was explicitly approved on 2026-09-09 in the canonical
+plan's Addendum C.3, which supersedes the earlier pending decision in B.5.
+The bounded Role conflict retry was subsequently approved through the PR review
+correction; it does not turn exhausted conflicts into successful provisioning.
+
Role convergence retries optimistic-lock conflicts through the shared bounded
retry helper (three attempts, fresh reads and admission checks). Exhausted
conflicts and unexpected RBAC errors still propagate; they are not successful
@@ -148,6 +156,30 @@ convergence and business state still occur. Separate legitimate new resources,
races and cold start. A lower create count alone does not establish causality;
`absent` does not guarantee a POST if the mutation fence expires afterward.
+## Deployed acceptance and rollback
+
+Evaluate each converted resource-kind lane in a stable five-minute window,
+recording the exact image/producer identity, counter boundaries and audit window.
+For resources proven present throughout that window, require zero redundant
+create attempts and a positive witness that reconciliation and the intended
+convergence/preservation actually ran. Assess cold start in a separate window;
+classify legitimate new resources and races separately instead of treating all
+creates as redundant. Report each lane rather than only an aggregate decrease.
+
+Addendum C.4 supersedes B.7's blanket zero-create target and prefix exception.
+In the NetworkPolicy lane, an `ext-egress-` name alone never exempts a conflict:
+the shared helper and the safety-inventory exception can use that family. Explain
+every residual conflict using evidence of the actual path and race/inventory
+state. Counters alone cannot attribute a request to a resource name or call site.
+These are acceptance criteria for the post-deployment measurement, not a claim
+that this PR's local tests performed that measurement.
+
+The rollback unit is PR 2 as a whole: restore the previously deployed HCC image
+through the normal deployment/rollback process. Stages A–D are review order,
+not independent rollback units; do not mix partial stage reversions or kind flags.
+For a source revert, the accompanying regression tests revert with PR 2 as well.
+Rolling back does not itself validate the restored runtime or its request load.
+
## Historical evidence and attribution limits
The historical aggregate `regimen-2026-09-09-agregado.csv` and its companion
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index e75446390..20238072a 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.309",
+ "version": "0.1.310",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.309",
+ "version": "0.1.310",
"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 98c9b543b..b409f572e 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.309",
+ "version": "0.1.310",
"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__/reconciler.credentialsRotation.test.ts b/host-context-controller/src/__tests__/reconciler.credentialsRotation.test.ts
index 027b952dc..ce5e7df25 100644
--- a/host-context-controller/src/__tests__/reconciler.credentialsRotation.test.ts
+++ b/host-context-controller/src/__tests__/reconciler.credentialsRotation.test.ts
@@ -57,11 +57,15 @@ function stored(value: string): string {
}
function createdDeployment(appsApi: ReturnType<typeof createMockAppsApi>): k8s.V1Deployment {
- const call =
- appsApi.replaceNamespacedDeployment.mock.calls.at(-1) ??
- appsApi.createNamespacedDeployment.mock.calls.at(-1)
- expect(call, 'the reconcile must write a real desired Deployment').toBeDefined()
- return (call![0] as { body: k8s.V1Deployment }).body
+ expect(appsApi.createNamespacedDeployment).toHaveBeenCalledTimes(1)
+ expect(appsApi.replaceNamespacedDeployment).not.toHaveBeenCalled()
+ return (appsApi.createNamespacedDeployment.mock.calls[0][0] as { body: k8s.V1Deployment }).body
+}
+
+function replacedDeployment(appsApi: ReturnType<typeof createMockAppsApi>): k8s.V1Deployment {
+ expect(appsApi.replaceNamespacedDeployment).toHaveBeenCalledTimes(1)
+ expect(appsApi.createNamespacedDeployment).not.toHaveBeenCalled()
+ return (appsApi.replaceNamespacedDeployment.mock.calls[0][0] as { body: k8s.V1Deployment }).body
}
function credentialsRevisionOf(deployment: k8s.V1Deployment): string | undefined {
@@ -167,29 +171,36 @@ describe('connector credentials revision (issue #223)', () => {
})
await reconciler.reconcile(makeServer())
const first = credentialsRevisionOf(createdDeployment(appsApi))
+ expect(first).toMatch(/^[0-9a-f]{64}$/)
+ appsApi.readNamespacedDeployment.mockClear()
+ coreApi.readNamespacedSecret.mockClear()
+ appsApi.createNamespacedDeployment.mockClear()
appsApi.replaceNamespacedDeployment.mockClear()
coreApi.readNamespacedSecret.mockResolvedValue({
data: { 'webhook-secret': stored('k2'), 'api-key': stored('k1') },
})
await reconciler.reconcile(makeServer())
- const second = credentialsRevisionOf(createdDeployment(appsApi))
// Key order is an artifact of how the API server answered, not a change in
// credentials: it must never roll a pod.
- expect(second).toBe(first)
+ expect(coreApi.readNamespacedSecret).toHaveBeenCalled()
+ expect(appsApi.readNamespacedDeployment).toHaveBeenCalled()
+ expect(appsApi.createNamespacedDeployment).not.toHaveBeenCalled()
+ expect(appsApi.replaceNamespacedDeployment).not.toHaveBeenCalled()
})
it('produces a different revision when a credential VALUE changes', async () => {
await reconciler.reconcile(makeServer())
const before = credentialsRevisionOf(createdDeployment(appsApi))
+ appsApi.createNamespacedDeployment.mockClear()
appsApi.replaceNamespacedDeployment.mockClear()
coreApi.readNamespacedSecret.mockResolvedValue({
data: { 'api-key': stored('rotated-key') },
})
await reconciler.reconcile(makeServer())
- const after = credentialsRevisionOf(createdDeployment(appsApi))
+ const after = credentialsRevisionOf(replacedDeployment(appsApi))
// This difference IS the rollout: same pod template otherwise.
expect(after).not.toBe(before)
@@ -203,13 +214,10 @@ describe('connector credentials revision (issue #223)', () => {
})
it('keeps the new revision when replacing over an existing Deployment', async () => {
- // The update path: create answers 409, then read+replace runs the desired
+ // The update path: read finds the existing Deployment, then replace runs the desired
// object through preserveDeploymentAnnotations. The stale revision on the
// live object must not win — otherwise a rotation would write the OLD
// digest back and the pod would never roll.
- appsApi.createNamespacedDeployment.mockRejectedValueOnce(
- Object.assign(new Error('already exists'), { code: 409 })
- )
appsApi.readNamespacedDeployment.mockResolvedValue({
metadata: {
name: 'linear',
@@ -236,10 +244,7 @@ describe('connector credentials revision (issue #223)', () => {
await reconciler.reconcile(makeServer())
- const replaced = appsApi.replaceNamespacedDeployment.mock.calls[0][0] as {
- body: k8s.V1Deployment
- }
- const annotations = replaced.body.spec?.template?.metadata?.annotations
+ const annotations = replacedDeployment(appsApi).spec?.template?.metadata?.annotations
expect(annotations?.[CREDENTIALS_REVISION_ANNOTATION]).toMatch(/^[0-9a-f]{64}$/)
expect(annotations?.[CREDENTIALS_REVISION_ANNOTATION]).not.toBe('stale-revision')
// Unrelated operator annotations still survive the replace.
diff --git a/host-context-controller/src/utils.ts b/host-context-controller/src/utils.ts
index c4e6790f6..6f3f001fc 100644
--- a/host-context-controller/src/utils.ts
+++ b/host-context-controller/src/utils.ts
@@ -68,6 +68,8 @@ export async function ensureResource<T extends { metadata?: { name?: string } }>
}
// The existing retry may deliberately return void after a missing read.
// Retain that policy while distinguishing it from completed preservation.
+ // This is invocation-local live-read state, not state of the cached snapshot.
+ // POST409 convergence never counts skipped, even when its fresh read succeeds.
let latestReadSucceeded = true
const readFresh = async (): Promise<T> => {
try {