Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(hcc,control-api): make the Host uid requirement decidable and tested
Alfredo Lopeza5ec29f4ad43
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 461945ecf..fbc5590fc 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.589",+ "version": "0.1.590","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.589",+ "version": "0.1.590","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --git a/control-api/package.json b/control-api/package.jsonindex a518fab2a..c16ca492b 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.589",+ "version": "0.1.590","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/services/tracing/adminOperationBindingResolver.ts b/control-api/src/services/tracing/adminOperationBindingResolver.tsindex 3fe769dff..026a9c4ee 100644--- a/control-api/src/services/tracing/adminOperationBindingResolver.ts+++ b/control-api/src/services/tracing/adminOperationBindingResolver.ts@@ -34,9 +34,15 @@ type HostResource = {* emitter is host-context-controller/src/administrativeOutcomeReporter.ts,* which builds this literal; the two live in different packages and cannot* import each other, so each side pins the same example string in its tests.+ *+ * The uid is matched in lowercase hex only, which is what the API server emits+ * and what the reporter copies verbatim. An uppercase spelling of the same uid+ * would parse and then fail the case-sensitive comparison below, so accepting+ * it would only move the refusal later; keeping the format exact says what the+ * one valid spelling is.*/const STATUS_REF =- /^host:([a-z0-9]([-a-z0-9]*[a-z0-9])?)\/([a-z0-9]([-a-z0-9]*[a-z0-9])?):generation=([1-9][0-9]*):uid=([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$/+ /^host:([a-z0-9]([-a-z0-9]*[a-z0-9])?)\/([a-z0-9]([-a-z0-9]*[a-z0-9])?):generation=([1-9][0-9]*):uid=([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iexport class HccAdministrativeOutcomeBindingResolver implements AdministrativeOperationBindingResolver {diff --git a/control-api/src/services/tracing/hccHealthTransitionBindingResolver.ts b/control-api/src/services/tracing/hccHealthTransitionBindingResolver.tsindex 714a50a8d..83cffc2b8 100644--- a/control-api/src/services/tracing/hccHealthTransitionBindingResolver.ts+++ b/control-api/src/services/tracing/hccHealthTransitionBindingResolver.ts@@ -77,11 +77,12 @@ export class HccHealthTransitionBindingResolver implements InfrastructureWorkloathrow new HccHealthTransitionBindingUnavailableError()}if (reference.uid === undefined) {- // The uid became mandatory once HCC started sending it: a Host deleted- // and recreated under the same name restarts at generation 1, so without- // it an event observed on the old object can bind to its successor. This- // is a 400 rather than the 403 above because the caller can fix it, and- // HCC treats a 400 as terminal instead of retrying forever (#693).+ // A Host deleted and recreated under the same name restarts at+ // generation 1, so a reference without the uid does not name one object:+ // an event observed on the old Host would bind to its successor. There+ // is no spelling of this request that names the right object, which is+ // why it is a 400 the caller must fix rather than the 403 above, which+ // says the binding is not visible yet and invites a retry (#693).throw new InvalidTracingInputError('hostLookupReference.uid is required for host-context-controller telemetry')@@ -103,6 +104,10 @@ export class HccHealthTransitionBindingResolver implements InfrastructureWorkloahost.kind !== 'Host' ||metadata?.name !== reference.name ||metadata.namespace !== reference.namespace ||+ // The generation stays optional where the uid is required: it narrows+ // which revision of an object was observed, and an event that omits it+ // still names one object. The uid is what names the object at all, so+ // its absence has no safe reading (#693).(reference.generation !== undefined && metadata.generation !== reference.generation) ||// A Host deleted and recreated under the same name restarts at generation 1;// only the uid tells the objects apart, so an event observed on the olddiff --git a/control-api/test/routes.tracingSubmissionBoundary.test.ts b/control-api/test/routes.tracingSubmissionBoundary.test.tsindex 7151a370c..56d378dc9 100644--- a/control-api/test/routes.tracingSubmissionBoundary.test.ts+++ b/control-api/test/routes.tracingSubmissionBoundary.test.ts@@ -8,6 +8,8 @@ import { clerumErrorHandler } from '../src/http/errorHandler.js'import { createInternalAdministrativeEventsRouter } from '../src/routes/internal/administrativeEvents.js'import { createInternalAgentRunEventsRouter } from '../src/routes/internal/agentRunEvents.js'import { createInternalInfrastructureTelemetryEventsRouter } from '../src/routes/internal/infrastructureTelemetryEvents.js'+import { HccAdministrativeOutcomeBindingResolver } from '../src/services/tracing/adminOperationBindingResolver.js'+import { administrativeIntentLookupKey } from '../src/services/tracing/adminOperationService.js'import {TracingIdempotencyConflictError,UnsafeTracingInputError,@@ -419,6 +421,11 @@ describe('internal tracing submission routers — rejection code on the wire', (resourceVersion: '1',},],+ // A uid that is present but cannot name an object. Each of these would+ // otherwise reach the resolver and be compared against a real Host.+ ['with an empty uid', { name: 'chatllm', namespace: 'mcp-host', generation: 7, uid: '' }],+ ['with a non-string uid', { name: 'chatllm', namespace: 'mcp-host', generation: 7, uid: 42 }],+ ['with a null uid', { name: 'chatllm', namespace: 'mcp-host', generation: 7, uid: null }],] as const)('refuses a Host reference %s as 400 invalid_tracing_input through the real route',async (_label, hostLookupReference) => {@@ -449,6 +456,119 @@ describe('internal tracing submission routers — rejection code on the wire', (})+ /**+ * The rollout order depends on this exact answer: HCC treats a 403 as+ * retryable and a 400 as terminal, so a pre-#694 sourceStatusRef reaching a+ * control-api that already requires the uid has to come back 403 or the+ * outcome is dropped for good. The row above stubs the service and only+ * proves the handler forwards the error it is handed; this one has to reach+ * the real resolver through the real route.+ */+ it('answers an administrative outcome with a pre-uid sourceStatusRef 403 through the real route', async () => {+ const OPERATION_ID = '11111111-1111-4111-8111-111111111111'+ const listResource = vi.fn().mockResolvedValue([+ {+ apiVersion: 'clerum.io/v1alpha1',+ kind: 'Host',+ metadata: {+ name: 'chatllm',+ namespace: 'mcp-host',+ generation: 7,+ uid: HOST_UID,+ annotations: {+ 'clerum.io/administrative-intent-id': OPERATION_ID,+ 'clerum.io/administrative-intent-generation': '7',+ },+ },+ },+ ])+ const findHostIntents = vi.fn().mockResolvedValue(+ new Map([+ [+ administrativeIntentLookupKey({+ operationId: OPERATION_ID,+ targetRef: 'mcp-host/chatllm',+ namespace: 'mcp-host',+ }),+ {+ operatorSub: 'admin-1',+ requestId: 'request-1',+ environment: 'test',+ tenantId: null,+ teamId: null,+ identityIssuer: 'control-api',+ operatorUserId: '22222222-2222-4222-8222-222222222222',+ resourceAud: 'control-ui',+ effectiveScopes: [],+ tokenExchangeId: null,+ authorizationDecision: 'allow' as const,+ decisionActorSub: 'control-api',+ },+ ],+ ])+ )+ const appendManyInTransaction = vi.fn().mockResolvedValue([+ {+ kind: 'accepted' as const,+ accepted: 1,+ replayed: 0,+ family: 'administrative' as const,+ eventId: '33333333-3333-4333-8333-333333333333',+ streamSequence: '7',+ payloadSha256: 'b'.repeat(64),+ ingestedAt: '2026-07-10T10:00:00.000Z',+ },+ ])+ const db = { query: vi.fn() } as unknown as DbClient+ const app = express()+ app.use(+ createInternalAdministrativeEventsRouter(+ new RouteTracingSubmissionService({+ transaction: (async (work: (client: DbClient) => Promise<unknown>) =>+ work(db)) as unknown as TracingTransactionRunner,+ administrativeOperationBindingResolver: new HccAdministrativeOutcomeBindingResolver(+ { getResource: vi.fn(), listResource },+ { findHostIntent: vi.fn(), findHostIntents }+ ),+ administrativeEventAppender: { appendManyInTransaction },+ })+ )+ )+ app.use(clerumErrorHandler)++ const post = (sourceStatusRef: string) =>+ request(app)+ .post('/internal/tracing/administrative-events')+ .set('Authorization', `Bearer ${signInternalControl('hcc')}`)+ .send({+ events: [+ {+ kind: 'linked_outcome',+ sourceEventId: `outcome-${sourceStatusRef.length}`,+ occurredAt: '2026-07-10T09:59:59.000Z',+ reasonCode: 'boundary_test',+ sourceStatusRef,+ payload: { resource_class: 'Host', status: 'succeeded' },+ },+ ],+ })++ // Liveness: the current format binds and stores through this same app, so+ // the refusal below is the legacy format and not a route that refuses all.+ const accepted = await post(`host:mcp-host/chatllm:generation=7:uid=${HOST_UID}`)+ expect(accepted.status).toBe(200)+ expect(appendManyInTransaction).toHaveBeenCalledOnce()++ const legacy = await post('host:mcp-host/chatllm:generation=7')++ expect(legacy.status).toBe(403)+ expect(legacy.body.correlationId).toEqual(expect.any(String))+ // No machine-readable code: that is what keeps HCC retrying instead of+ // classifying the failure as terminal and dropping the outcome.+ expect(legacy.body).not.toHaveProperty('code')+ expect(appendManyInTransaction).toHaveBeenCalledOnce()+ })+it('keeps a binding 403 without a code, so HCC keeps retrying it', async () => {const { app, service } = rejectingApp(createInternalAdministrativeEventsRouter,diff --git a/control-api/test/services.adminOperationBindingResolver.test.ts b/control-api/test/services.adminOperationBindingResolver.test.tsindex 7e535fcea..5483d8eb5 100644--- a/control-api/test/services.adminOperationBindingResolver.test.ts+++ b/control-api/test/services.adminOperationBindingResolver.test.ts@@ -1,5 +1,6 @@import { describe, expect, it, vi } from 'vitest'import { HccAdministrativeOutcomeBindingResolver } from '../src/services/tracing/adminOperationBindingResolver.js'+import { administrativeIntentLookupKey } from '../src/services/tracing/adminOperationService.js'const principal = {kind: 'hcc_internal_control',@@ -29,7 +30,7 @@ const event = {const intentAttribution = {operatorSub: 'admin-1',- requestId: 'request-1',+ requestId: 'request-1' as string | null,environment: 'test',tenantId: null,teamId: null,@@ -42,8 +43,29 @@ const intentAttribution = {decisionActorSub: 'control-api',}+const OPERATION_ID = '11111111-1111-4111-8111-111111111111'++/**+ * Built with the implementation's own key function rather than a literal. A+ * hardcoded key that stopped matching would turn every `toBeNull()` row below+ * into a test that passes for the wrong reason, since a missing intent also+ * refuses the binding.+ */+function intentMap(attribution = intentAttribution, name = 'chatllm') {+ return new Map([+ [+ administrativeIntentLookupKey({+ operationId: OPERATION_ID,+ targetRef: `mcp-host/${name}`,+ namespace: 'mcp-host',+ }),+ attribution,+ ],+ ])+}+function host(- operationId = '11111111-1111-4111-8111-111111111111',+ operationId = OPERATION_ID,generation = 7,intentGeneration = generation,uid = HOST_UID@@ -67,12 +89,7 @@ function host(describe('HccAdministrativeOutcomeBindingResolver', () => {it('binds a terminal outcome only after live Host and durable intent validation', async () => {const listResource = vi.fn().mockResolvedValue([host()])- const intent = intentAttribution- const findHostIntents = vi- .fn()- .mockResolvedValue(- new Map([['11111111-1111-4111-8111-111111111111:mcp-host:mcp-host/chatllm', intent]])- )+ const findHostIntents = vi.fn().mockResolvedValue(intentMap())const binding = await new HccAdministrativeOutcomeBindingResolver({ getResource: vi.fn(), listResource },{ findHostIntent: vi.fn(), findHostIntents }@@ -114,14 +131,7 @@ describe('HccAdministrativeOutcomeBindingResolver', () => {findHostIntents: vi.fn().mockResolvedValue(- hasIntent- ? new Map([- [- '11111111-1111-4111-8111-111111111111:mcp-host:mcp-host/chatllm',- { ...intentAttribution, requestId: null },- ],- ])- : new Map()+ hasIntent ? intentMap({ ...intentAttribution, requestId: null }) : new Map()),})@@ -131,16 +141,7 @@ describe('HccAdministrativeOutcomeBindingResolver', () => {it('refuses a sourceStatusRef without the uid suffix (#694)', async () => {const resolver = new HccAdministrativeOutcomeBindingResolver({ getResource: vi.fn(), listResource: vi.fn().mockResolvedValue([host()]) },- {- findHostIntent: vi.fn(),- findHostIntents: vi- .fn()- .mockResolvedValue(- new Map([- ['11111111-1111-4111-8111-111111111111:mcp-host:mcp-host/chatllm', intentAttribution],- ])- ),- }+ { findHostIntent: vi.fn(), findHostIntents: vi.fn().mockResolvedValue(intentMap()) })// Batched with the current format so the null below cannot come from a@@ -157,4 +158,53 @@ describe('HccAdministrativeOutcomeBindingResolver', () => {expect(legacy).toBeNull()expect(current).toMatchObject({ targetRef: 'mcp-host/chatllm', outcome: 'succeeded' })})++ /**+ * The test above cannot tell the format contract from the uid comparison: a+ * reference the regex rejected and one whose uid does not match the live+ * object both end as null. These rows separate them. Each malformed spelling+ * is paired with a live Host carrying that exact string as its uid, so the+ * comparison would accept it — only `STATUS_REF` refuses, and relaxing the+ * pattern makes the row bind.+ */+ it.each([+ ['a uid that is not a uuid', 'not-a-uuid'],+ ['an uppercase uid', HOST_UID.toUpperCase()],+ ['a uid with trailing text', `${HOST_UID}-extra`],+ ] as const)('refuses %s in the sourceStatusRef (#694)', async (_label, uid) => {+ // `chatllm` carries the malformed spelling as its real uid, so the+ // comparison would accept it; `chatllm-live` is the witness that binds+ // through the same call.+ const malformedHost = host(undefined, 7, 7, uid)+ const liveHost = host()+ liveHost.metadata.name = 'chatllm-live'+ const resolver = new HccAdministrativeOutcomeBindingResolver(+ {+ getResource: vi.fn(),+ listResource: vi.fn().mockResolvedValue([malformedHost, liveHost]),+ },+ {+ findHostIntent: vi.fn(),+ findHostIntents: vi+ .fn()+ .mockResolvedValue(new Map([...intentMap(), ...intentMap(undefined, 'chatllm-live')])),+ }+ )++ const [malformed, witness] = await resolver.resolveMany(principal, [+ {+ ...event,+ sourceEventId: 'outcome-malformed-uid',+ sourceStatusRef: `host:mcp-host/chatllm:generation=7:uid=${uid}`,+ },+ {+ ...event,+ sourceEventId: 'outcome-live',+ sourceStatusRef: `host:mcp-host/chatllm-live:generation=7:uid=${HOST_UID}`,+ },+ ])++ expect(malformed).toBeNull()+ expect(witness).toMatchObject({ targetRef: 'mcp-host/chatllm-live', outcome: 'succeeded' })+ })})diff --git a/control-api/test/services.firstVerticalBindingResolvers.test.ts b/control-api/test/services.firstVerticalBindingResolvers.test.tsindex e61ab3a24..b6b5c2d5b 100644--- a/control-api/test/services.firstVerticalBindingResolvers.test.ts+++ b/control-api/test/services.firstVerticalBindingResolvers.test.ts@@ -413,6 +413,7 @@ describe('first vertical trusted binding resolvers', () => {// chain does not catch exceptions, so a throw here would abort a WRC batch// before wrcInfrastructureBindingResolver ever saw it.const hostLookup = { getResource: vi.fn() }+ const resolver = new HccHealthTransitionBindingResolver(hostLookup)const principal = {kind: 'wrc_internal_control',sourceService: 'workflow-recipes',@@ -421,15 +422,29 @@ describe('first vertical trusted binding resolvers', () => {resourceAuthority: 'wrc_managed',allowedTelemetryTypes: ['health_transition'],} as const+ const hccPrincipal = {+ kind: 'hcc_internal_control',+ sourceService: 'host-context-controller',+ serviceSub: 'hcc-provisioner',+ credentialId: 'hcc-1',+ resourceAuthority: 'hcc_managed',+ allowedTelemetryTypes: ['health_transition'],+ } as const+ const event = {+ sourceEventId: 'health-wrc',+ occurredAt: NOW,+ telemetryType: 'health_transition' as const,+ hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7 },+ }- await expect(- new HccHealthTransitionBindingResolver(hostLookup).resolve(principal, {- sourceEventId: 'health-wrc',- occurredAt: NOW,- telemetryType: 'health_transition',- hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7 },- })- ).resolves.toBeNull()+ await expect(resolver.resolve(principal, event)).resolves.toBeNull()+ // Liveness: the same instance and the same uid-less reference, submitted+ // under the HCC principal, do throw. The null above is the principal guard+ // deciding, not a resolver that returns null for anything handed to it.+ await expect(resolver.resolve(hccPrincipal, event)).rejects.toMatchObject({+ code: 'invalid_tracing_input',+ status: 400,+ })expect(hostLookup.getResource).not.toHaveBeenCalled()})diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.jsonindex 23580e225..054ca389b 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.342",+ "version": "0.1.343","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-host-context-controller",- "version": "0.1.342",+ "version": "0.1.343","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.jsonindex 1c1e7faec..9ea05aa9a 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.342",+ "version": "0.1.343","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/administrativeOutcomeReporter.test.ts b/host-context-controller/src/administrativeOutcomeReporter.test.tsindex 8d739b73f..d9267bb59 100644--- a/host-context-controller/src/administrativeOutcomeReporter.test.ts+++ b/host-context-controller/src/administrativeOutcomeReporter.test.ts@@ -45,7 +45,7 @@ describe('BoundedAdministrativeOutcomeReporter', () => {fetchFn,})reporter.enqueueHostOutcome({- sourceEventId: 'hcc-admin-outcome:op-1:7:succeeded',+ sourceEventId: 'hcc-admin-outcome-v2:op-1:7:host-uid-1:succeeded',occurredAt: '2026-07-11T10:00:00.000Z',hostRef: HOST_REF,outcome: 'succeeded',@@ -250,10 +250,10 @@ describe('BoundedAdministrativeOutcomeReporter — once per process (#327, #326)const fetchFn = vi.fn().mockResolvedValue({ ok: true }) as unknown as typeof fetchconst reporter = reporterWith(fetchFn)- reporter.enqueueHostOutcome(outcome('hcc-admin-outcome:op-1:7:succeeded'))+ reporter.enqueueHostOutcome(outcome('hcc-admin-outcome-v2:op-1:7:host-uid-1:succeeded'))await settle()- reporter.enqueueHostOutcome(outcome('hcc-admin-outcome:op-1:7:succeeded'))- reporter.enqueueHostOutcome(outcome('hcc-admin-outcome:op-1:7:succeeded'))+ reporter.enqueueHostOutcome(outcome('hcc-admin-outcome-v2:op-1:7:host-uid-1:succeeded'))+ reporter.enqueueHostOutcome(outcome('hcc-admin-outcome-v2:op-1:7:host-uid-1:succeeded'))await settle()expect(fetchFn).toHaveBeenCalledOnce()@@ -294,10 +294,10 @@ describe('BoundedAdministrativeOutcomeReporter — once per process (#327, #326).mockResolvedValue({ ok: true }) as unknown as typeof fetchconst reporter = reporterWith(fetchFn)- reporter.enqueueHostOutcome(outcome('hcc-admin-outcome:op-1:7:failed'))+ reporter.enqueueHostOutcome(outcome('hcc-admin-outcome-v2:op-1:7:host-uid-1:failed'))await settle()expect(await counted('retry_exhausted')).toBe(1)- reporter.enqueueHostOutcome(outcome('hcc-admin-outcome:op-1:7:failed'))+ reporter.enqueueHostOutcome(outcome('hcc-admin-outcome-v2:op-1:7:host-uid-1:failed'))await settle()expect(fetchFn).toHaveBeenCalledTimes(4)diff --git a/host-context-controller/src/administrativeOutcomeReporter.ts b/host-context-controller/src/administrativeOutcomeReporter.tsindex b14929587..f3916ce22 100644--- a/host-context-controller/src/administrativeOutcomeReporter.ts+++ b/host-context-controller/src/administrativeOutcomeReporter.ts@@ -94,13 +94,19 @@ export class BoundedAdministrativeOutcomeReporter implements AdministrativeOutco}/**- * The dedupe key is the `sourceEventId`, which carries no `reasonCode`: for a- * given operation, generation, Host uid and outcome the first failure wins- * and later ones are deduplicated. That matches the server, which hashes the- * `reasonCode` into the stored row — a second `failed` with another reason- * under the same key would come back 409 and never be stored either. The- * per-reason detail is not lost: `controller_error` keeps it in full, with a- * unique occurrence id per event (#696).+ * Deduplicates on the `sourceEventId` this reporter is handed, which it+ * treats as opaque. Its caller builds it without the `reasonCode`+ * (hostReconciler.ts, `enqueueAdministrativeOutcome`), so for one operation,+ * generation, Host uid and outcome the first failure wins and later ones are+ * deduplicated. That matches the server, which hashes the `reasonCode` into+ * the stored row: a second `failed` with another reason under the same key+ * would come back 409 and never be stored either. The per-reason detail is+ * not lost — `controller_error` keeps it in full, with a unique occurrence id+ * per event (#696).+ *+ * `seen` is a bounded LRU, so "the first one wins" holds only while the key+ * is still resident. A key evicted under load is enqueued again and refused+ * by the server as a 409 instead, which this reporter treats as terminal.*/enqueueHostOutcome(projection: AdministrativeHostOutcomeProjection): void {const { sourceEventId } = projectiondiff --git a/host-context-controller/src/hostReconciler.ts b/host-context-controller/src/hostReconciler.tsindex 01b1a2338..b84ae5337 100644--- a/host-context-controller/src/hostReconciler.ts+++ b/host-context-controller/src/hostReconciler.ts@@ -645,11 +645,19 @@ export class HostReconciler {this.prepareHostMutationAdmission(action, host),reflectHostOutcome: (name, uid, apply) => this.reflectHostOutcome?.(name, uid, apply),onLifecycleStatusCommitted: (host, lifecycle) => {+ // A uid-less snapshot never reaches a lifecycle status commit, so this+ // branch is the compiler's requirement rather than an observed path.+ // It shares the emitter guard instead of assuming that stays true.+ const hostLookupReference = this.hostTelemetryReference(host, {+ telemetryType: 'health_transition',+ state: lifecycle.state,+ })+ if (hostLookupReference === undefined) returnconst occurredAt = this.now().toISOString()this.infrastructureTelemetryReporter?.enqueueHealthTransition({sourceEventId: `hcc-health-transition:${this.newTelemetryOccurrenceId()}`,occurredAt,- hostLookupReference: this.hostLookupReference(host),+ hostLookupReference,payload: { transition: `lifecycle:${lifecycle.state}`, state: lifecycle.state },})},@@ -1287,9 +1295,9 @@ export class HostReconciler {}/**- * Evidence is keyed by the Host uid, not by namespace/name: a Host deleted- * and recreated under the same name is a different object, and a name-keyed- * entry left behind would be reported as the new object's rotation (#696).+ * The key carries the uid alongside namespace/name: a Host deleted and+ * recreated under the same name is a different object, and an entry keyed by+ * the name alone would be reported as the new object's rotation (#696).*/private static gfsLifecycleEvidenceKey(host: Pick<HostCRD, 'namespace' | 'name' | 'uid'>@@ -1321,6 +1329,25 @@ export class HostReconciler {this.gfsTokenLifecycleEvidence.set(key, outcome)}+ /**+ * Drops one object's entry. A caller holding the snapshot it reconciled+ * knows which uid it recorded under, so it must not reach for the prefix+ * sweep below: that would also destroy a sibling uid's evidence at the same+ * name, which is the cross-object confusion the uid in the key exists to+ * prevent (#696).+ */+ private clearGfsLifecycleEvidenceForObject(+ host: Pick<HostCRD, 'namespace' | 'name' | 'uid'>+ ): void {+ const key = HostReconciler.gfsLifecycleEvidenceKey(host)+ if (key !== undefined) this.gfsTokenLifecycleEvidence.delete(key)+ }++ /**+ * Drops every object's entry at a namespace/name. Only for callers handed a+ * name with no snapshot behind it, which is `reconcileDelete`: it cannot know+ * which uid the departing object had.+ */private clearGfsLifecycleEvidence(namespace: string, name: string): void {const prefix = HostReconciler.gfsLifecycleEvidencePrefix(namespace, name)for (const key of this.gfsTokenLifecycleEvidence.keys()) {@@ -2166,12 +2193,31 @@ export class HostReconciler {}}- private hostLookupReference(host: HostCRD): HostLookupReference {+ /**+ * Undefined when the snapshot carries no uid, which `HostCRD` documents as a+ * legal state. Sending the reference anyway would earn a 400 the reporter+ * treats as terminal, so the event would be dropped — and, unlike the+ * administrative path, re-sent and dropped again on every pass, because this+ * reporter keeps no `seen` set to fall silent. Every telemetry emitter goes+ * through here so the drop is decided, and named, in one place (#693).+ */+ private hostTelemetryReference(+ host: HostCRD,+ context: Record<string, string>+ ): HostLookupReference | undefined {+ if (host.uid === undefined) {+ log.warn('skipping host telemetry: Host snapshot has no uid', {+ host: host.name,+ namespace: host.namespace,+ ...context,+ })+ return undefined+ }return {name: host.name,namespace: host.namespace,...(host.generation !== undefined ? { generation: host.generation } : {}),- ...(host.uid !== undefined ? { uid: host.uid } : {}),+ uid: host.uid,}}@@ -2181,6 +2227,8 @@ export class HostReconciler {reasonCode: string,payload: HccInfrastructureTelemetryPayload): void {+ const hostLookupReference = this.hostTelemetryReference(host, { telemetryType, reasonCode })+ if (hostLookupReference === undefined) returnconst occurredAt = this.now().toISOString()const eventPayload = {resource_class: 'Host',@@ -2191,7 +2239,7 @@ export class HostReconciler {this.infrastructureTelemetryReporter?.enqueue({occurredAt,telemetryType,- hostLookupReference: this.hostLookupReference(host),+ hostLookupReference,payload: eventPayload,})return@@ -2200,7 +2248,7 @@ export class HostReconciler {sourceEventId: `hcc-${telemetryType}:${this.newTelemetryOccurrenceId()}`,occurredAt,telemetryType,- hostLookupReference: this.hostLookupReference(host),+ hostLookupReference,payload: eventPayload,})}@@ -4486,10 +4534,12 @@ export class HostReconciler {// rethrow as a retire (reconcileDelete → 'superseded', watch callers// only log the error), so the rethrow is preserved.// This exit emits no outcome, so drop the GFS evidence this pass- // recorded: a leftover would be reported by the next pass over the- // same object. The stateless suspension path also calls reconcileCore- // without emitting an outcome and does not clear the entry (#696).- this.clearGfsLifecycleEvidence(admittedHost.namespace, admittedHost.name)+ // recorded: a leftover would be reported by the next pass over this+ // object. The clear is scoped to this snapshot's uid, so a sibling+ // object at the same name keeps its own evidence. The stateless+ // suspension path also calls reconcileCore without emitting an+ // outcome and does not clear the entry (#696).+ this.clearGfsLifecycleEvidenceForObject(admittedHost)this.observeReconcileLatency(source, 'superseded', dispatchedAt, admittedAt)throw error}diff --git a/host-context-controller/src/infrastructureTelemetryReporter.test.ts b/host-context-controller/src/infrastructureTelemetryReporter.test.tsindex 79f7b0b4d..1f7ccdbbd 100644--- a/host-context-controller/src/infrastructureTelemetryReporter.test.ts+++ b/host-context-controller/src/infrastructureTelemetryReporter.test.ts@@ -10,17 +10,20 @@ import {infrastructureTelemetryRetriesTotal,} from './metrics'+/** control-api refuses a reference without one, so every fixture carries it. */+const HOST_UID = '6f1c2f3a-2f4b-4d3a-9b2e-7c0d1a5e8b44'+const projection = {sourceEventId: 'hcc-health-transition:mcp-host:chatllm:7:active:1',occurredAt: '2026-07-11T12:00:00.000Z',- hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7 },+ hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7, uid: HOST_UID },payload: { transition: 'lifecycle:active', state: 'active' },} as constconst reconcileProjection = {occurredAt: '2026-07-11T12:00:01.000Z',telemetryType: 'reconcile_outcome',- hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7 },+ hostLookupReference: { name: 'chatllm', namespace: 'mcp-host', generation: 7, uid: HOST_UID },payload: {resource_class: 'Host',reason_code: 'ready',diff --git a/host-context-controller/src/infrastructureTelemetryReporter.ts b/host-context-controller/src/infrastructureTelemetryReporter.tsindex 142aa8243..91b8c467a 100644--- a/host-context-controller/src/infrastructureTelemetryReporter.ts+++ b/host-context-controller/src/infrastructureTelemetryReporter.ts@@ -22,12 +22,19 @@ export type HccHealthTransitionProjection = {* `uid` pins the event to one Host object. A Host deleted and recreated with* the same name restarts at generation 1; without the uid its events would* reuse the previous object's identities (#691).+ *+ * It is required rather than optional because control-api answers a reference+ * without one with a 400 this reporter classifies as terminal: the event would+ * be dropped, and re-sent and re-dropped on every reconcile pass, since this+ * reporter keeps no `seen` set to go quiet. A caller holding a Host snapshot+ * that never captured a uid has to decide what to do with it, so the type+ * makes the compiler ask instead of letting the reference ship without it.*/export type HostLookupReference = {name: stringnamespace: stringgeneration?: number- uid?: string+ uid: string}export type HccInfrastructureTelemetryType =diff --git a/host-context-controller/src/reporterHttpFailure.ts b/host-context-controller/src/reporterHttpFailure.tsindex 52062ae02..a295abd88 100644--- a/host-context-controller/src/reporterHttpFailure.ts+++ b/host-context-controller/src/reporterHttpFailure.ts@@ -5,8 +5,12 @@ const log = hccLogger.child({ module: 'reporter-http-failure' })/*** control-api answers these (status, code) pairs deterministically: resending- * the same event gets the same answer. `invalid_tracing_input` comes only from- * request shape validation, so it is as final as `unsafe_tracing_input`. Every other failure (403 binding not yet+ * the same event gets the same answer, because what they refuse is the request+ * itself and not the state of anything around it. `invalid_tracing_input`+ * covers both a malformed request and a well-formed one the server cannot bind+ * — a `hostLookupReference` without a uid, or carrying a key the server does+ * not read (#693) — and neither becomes acceptable on a retry, so it is as+ * final as `unsafe_tracing_input`. Every other failure (403 binding not yet* visible, 5xx, a 4xx without a code, a body that is not JSON) stays retryable.*/const TERMINAL_RESPONSES: ReadonlyArray<{diff --git a/host-context-controller/test/hostReconciler.lifecycle.test.ts b/host-context-controller/test/hostReconciler.lifecycle.test.tsindex b3e79f1ad..d947e9601 100644--- a/host-context-controller/test/hostReconciler.lifecycle.test.ts+++ b/host-context-controller/test/hostReconciler.lifecycle.test.ts@@ -1513,6 +1513,30 @@ describe('HostReconciler stateless lifecycle — status write idempotence', () =)})+ it('never commits a lifecycle status for a Host snapshot without a uid (#693)', async () => {+ const infrastructureTelemetryReporter = createTelemetryReporterMock()+ const { reconciler, customApi } = createReconciler({ infrastructureTelemetryReporter })+ const withUid: HostCRD = { ...makeStatelessHost(), generation: 3 }+ const withoutUid: HostCRD = { ...makeStatelessHost(), generation: 3 }+ delete (withoutUid as { uid?: string }).uid++ // Liveness: the identical fixture, differing only in the uid, does commit+ // and does emit. The absence below is the missing uid, not a fixture that+ // never had anything to commit.+ await reconciler.reconcile(withUid)+ expect(customApi.patchNamespacedCustomObjectStatus).toHaveBeenCalledTimes(1)+ expect(infrastructureTelemetryReporter.enqueueHealthTransition).toHaveBeenCalledTimes(1)++ await reconciler.reconcile(withoutUid)++ // The health-transition emitter carries a uid guard the compiler demands,+ // but it is unreachable through reconcile: the commit that invokes it does+ // not happen without a uid, so no uid-less reference can reach control-api+ // by this route and earn the terminal 400 (#693).+ expect(customApi.patchNamespacedCustomObjectStatus).toHaveBeenCalledTimes(1)+ expect(infrastructureTelemetryReporter.enqueueHealthTransition).toHaveBeenCalledTimes(1)+ })+it('skips the write when the observed status already matches', async () => {const infrastructureTelemetryReporter = createTelemetryReporterMock()const { reconciler, customApi } = createReconciler({ infrastructureTelemetryReporter })diff --git a/host-context-controller/test/hostReconciler.test.ts b/host-context-controller/test/hostReconciler.test.tsindex 378a41323..af0e94d7f 100644--- a/host-context-controller/test/hostReconciler.test.ts+++ b/host-context-controller/test/hostReconciler.test.ts@@ -468,6 +468,36 @@ describe('HostReconciler', () => {expect(administrativeOutcomeReporter.enqueueHostOutcome).not.toHaveBeenCalled()})+ it('skips Host telemetry when the Host snapshot has no uid (#693)', async () => {+ const warn = vi.spyOn(HostContextLogger.prototype, 'warn').mockImplementation(() => undefined)+ onTestFinished(() => warn.mockRestore())+ const reporter = createTelemetryReporterMock()+ const { reconciler } = createReconciler({ infrastructureTelemetryReporter: reporter })++ // Liveness: this reconciler and this reporter do enqueue when the snapshot+ // carries a uid, so the unchanged count below is the guard's doing and not+ // a reporter that was never reached.+ await reconciler.reconcile(makeHost({ generation: 7 }))+ expect(reporter.enqueue).toHaveBeenCalledTimes(1)++ const host = makeHost({ generation: 8 })+ delete (host as { uid?: string }).uid+ await reconciler.reconcile(host)++ // control-api answers a uid-less reference with a 400 this reporter treats+ // as terminal, and the infrastructure reporter keeps no `seen` set to fall+ // silent, so the event would be re-sent and re-dropped every pass (#693).+ expect(warn).toHaveBeenCalledWith(+ 'skipping host telemetry: Host snapshot has no uid',+ expect.objectContaining({+ host: 'alpha-host',+ namespace: 'mcp-host',+ telemetryType: 'reconcile_outcome',+ })+ )+ expect(reporter.enqueue).toHaveBeenCalledTimes(1)+ })+it('sends an administrative outcome once across repeated reconcile passes (#327)', async () => {const fetchFn = vi.fn().mockResolvedValue({ ok: true }) as unknown as typeof fetchconst administrativeOutcomeReporter = new BoundedAdministrativeOutcomeReporter({@@ -674,11 +704,29 @@ describe('HostReconciler', () => {const superseded = new Error('Host spec changed while the Deployment write was in flight')superseded.name = 'HostMutationSpecRevisionChangedError'appsApi.replaceNamespacedDeployment.mockRejectedValueOnce(superseded)+ // A different object at the same name, whose evidence this pass has no+ // business touching: the supersession knows which uid it reconciled.+ const evidence = gfsEvidenceOf(reconciler)+ const siblingKey = evidenceKeyOf({+ namespace: 'mcp-host',+ name: 'alpha-host',+ uid: 'host-uid-sibling',+ })!+ evidence.set(siblingKey, 'minted')await expect(reconciler.reconcile(makeHost({ generation: 3 }))).rejects.toBe(superseded)// Liveness: the superseded pass minted, and emitted no outcome.expect(vi.mocked(mintHostGfsToken).mock.calls.length - mintsBefore).toBe(1)expect(reconcileOutcomes(reporter)).toHaveLength(0)+ // The pass dropped its own entry and left the sibling's alone. Both+ // halves matter: a clear scoped too narrowly would leak the transition+ // into the next pass, and one scoped by name would destroy the sibling's.+ expect(+ evidence.has(+ evidenceKeyOf({ namespace: 'mcp-host', name: 'alpha-host', uid: 'host-uid-1' })!+ )+ ).toBe(false)+ expect(evidence.get(siblingKey)).toBe('minted')rbacApi.readNamespacedRole.mockRejectedValueOnce({ code: 500 })await expect(reconciler.reconcile(makeHost({ generation: 4 }))).rejects.toEqual({@@ -732,9 +780,12 @@ describe('HostReconciler', () => {name: 'alpha-host',uid: 'host-uid-1',})!+ // A prefix neighbour on purpose: the sweep matches `mcp-host/alpha-host/`+ // and only the trailing separator keeps `alpha-host-2` out of it. A+ // survivor with an unrelated name would leave that character untested.const survivorKey = evidenceKeyOf({namespace: 'mcp-host',- name: 'other-host',+ name: 'alpha-host-2',uid: 'host-uid-9',})!evidence.set(deletedKey, 'rotated')@@ -752,23 +803,26 @@ describe('HostReconciler', () => {const warn = vi.spyOn(HostContextLogger.prototype, 'warn').mockImplementation(() => undefined)onTestFinished(() => warn.mockRestore())const reporter = createTelemetryReporterMock()- const { reconciler } = createReconciler({ infrastructureTelemetryReporter: reporter })+ const { reconciler, appsApi } = createReconciler({+ infrastructureTelemetryReporter: reporter,+ })const host = makeHost({ generation: 3 })delete (host as { uid?: string }).uidawait reconciler.reconcile(host)- // Liveness: the pass ran to an outcome, so the GFS write did happen —- // the evidence is missing because it was refused, not because the path- // never executed.- const outcomes = reconcileOutcomes(reporter)- expect(outcomes).toHaveLength(1)+ // Liveness: the pass did its reconcile work, so it reached the GFS+ // token path — the evidence is missing because recording it was+ // refused, not because the pass never executed. The outcome itself is+ // no longer a witness: the same missing uid now also stops the+ // telemetry from being emitted at all (#693).+ expect(appsApi.replaceNamespacedDeployment).toHaveBeenCalled()expect(warn).toHaveBeenCalledWith('skipping gfs token lifecycle evidence: Host snapshot has no uid',expect.objectContaining({ host: 'alpha-host', namespace: 'mcp-host' }))expect(gfsEvidenceOf(reconciler).size).toBe(0)- expect(outcomes[0]?.payload).not.toHaveProperty('transition')+ expect(reconcileOutcomes(reporter)).toHaveLength(0)})})diff --git a/scripts/e2e/e2e-governed-tracing-operations.sh b/scripts/e2e/e2e-governed-tracing-operations.shindex f14636e58..cc8129349 100755--- a/scripts/e2e/e2e-governed-tracing-operations.sh+++ b/scripts/e2e/e2e-governed-tracing-operations.sh@@ -208,6 +208,11 @@ const fs = require('node:fs')const [target, namespace, name, generation, uid, startedAt, suffix, variant] =process.argv.slice(2)const reference = { namespace, name, generation: Number(generation), uid }+// A misspelled variant would otherwise write the valid body and the caller+// would assert a rejection against a request that deserves none.+if (!['full', 'missing-uid', 'unknown-key'].includes(variant)) {+ throw new Error(`unknown hostLookupReference variant: ${variant}`)+}if (variant === 'missing-uid') delete reference.uidif (variant === 'unknown-key') reference.resourceVersion = '1'const body = {@@ -282,7 +287,12 @@ log 'hostLookupReference with an unknown key was refused as invalid_tracing_inpu# The administrative route refuses an unparseable reference with 403# `tracing_binding_unavailable`, which HCC retries rather than dropping: that is-# what makes the control-api-first rollout order safe (#694).+# what makes the control-api-first rollout order safe (#694). The paired+# positive — the same outcome with `:uid=` binding and storing — needs a durable+# administrative intent that this lane does not create, so it lives in+# control-api/test/routes.tracingSubmissionBoundary.test.ts against the real+# router. Here the message assertion below is what separates a refused binding+# from a refused credential.STATUS="$(post_json "$CONTROL_API_URL/api/v1/internal/tracing/administrative-events" \"$LEGACY_STATUS_REF_BODY"diff --git a/scripts/tests/test-governed-tracing-operations-gate.sh b/scripts/tests/test-governed-tracing-operations-gate.shindex 4ec3f03e9..2ab4fb0ec 100755--- a/scripts/tests/test-governed-tracing-operations-gate.sh+++ b/scripts/tests/test-governed-tracing-operations-gate.sh@@ -26,7 +26,10 @@ case "${1:-}" incluster-info) exit 0 ;;get)[[ "${2:-}" == 'hosts.clerum.io' ]] || exit 91- printf 'mcp-host|chatllm|7'+ # The fourth field is metadata.uid. The script refuses to build a+ # hostLookupReference without one since #693, so a three-field stub would+ # abort the run before any tracing request went out.+ printf 'mcp-host|chatllm|7|3f6b1c28-9d4a-4f51-8c73-2b5e0a91d7ef';;*) exit 92 ;;esac@@ -36,20 +39,32 @@ cat >"$TMP_ROOT/curl" <<'STUB'#!/usr/bin/env bashset -euo pipefail: "${TEST_API_URL:?}" "${TEST_UI_URL:?}" "${TEST_STATE:?}" "${TEST_CURL_LOG:?}"+: "${TEST_TELEMETRY_LOG:?}"printf '%s\n' "$*" >>"$TEST_CURL_LOG"output_file=''url=''config_file=''+body_file=''while [[ $# -gt 0 ]]; docase "$1" in--output) output_file="$2"; shift 2 ;;--config) config_file="$2"; shift 2 ;;+ --data-binary) body_file="${2#@}"; shift 2 ;;http://*) url="$1"; shift ;;*) shift ;;esacdone+# The tracing arms answer by what the request actually carries, so the gate+# below can assert which rejection each body earned instead of trusting that+# the script sent the bodies it claims to send.+answer() {+ printf '%s\n' "$1" >>"$TEST_TELEMETRY_LOG"+ printf '%s' "$3" >"$output_file"+ printf '%s' "$2"+}+if [[ -n "$config_file" ]]; then[[ -f "$config_file" ]] || exit 93printf '%s\n' "$config_file" >>"${TEST_CONFIG_PATHS:?}"@@ -68,8 +83,37 @@ case "$url" inprintf '413';;"$TEST_API_URL/api/v1/internal/tracing/infrastructure-telemetry-events")- printf '{"accepted":1,"replayed":0}' >"$output_file"- printf '200'+ [[ -n "$body_file" && -f "$body_file" ]] || exit 98+ if grep -q '"resourceVersion"' "$body_file"; then+ answer unknown-key 400 \+ '{"error":"hostLookupReference carries a key the server does not read","code":"invalid_tracing_input","correlationId":"stub-unknown-key"}'+ elif ! grep -q '"uid":' "$body_file"; then+ answer missing-uid 400 \+ '{"error":"hostLookupReference requires uid","code":"invalid_tracing_input","correlationId":"stub-missing-uid"}'+ else+ # Idempotency is keyed on the request itself, as the server's is on the+ # payload hash: the replay answer has to be earned by resending the same+ # bytes, not by counting how many times this arm was reached.+ seen_file="$TEST_STATE.telemetry-seen"+ digest="$(cksum <"$body_file")"+ if [[ -f "$seen_file" ]] && grep -qxF "$digest" "$seen_file"; then+ answer replay 200 '{"accepted":0,"replayed":1}'+ else+ printf '%s\n' "$digest" >>"$seen_file"+ answer accepted 200 '{"accepted":1,"replayed":0}'+ fi+ fi+ ;;+ "$TEST_API_URL/api/v1/internal/tracing/administrative-events")+ [[ -n "$body_file" && -f "$body_file" ]] || exit 98+ # A sourceStatusRef without the `:uid=` suffix does not parse, so no+ # binding is resolved and the route answers 403 — the retryable refusal+ # that makes the control-api-first rollout order safe (#694).+ if grep -q ':uid=' "$body_file"; then+ answer admin-bound 200 '{"accepted":1,"replayed":0}'+ else+ answer admin-unbound 403 '{"error":"trusted operation binding is unavailable"}'+ fi;;*) exit 94 ;;esac@@ -90,6 +134,7 @@ STUBchmod +x "$TMP_ROOT/kubectl" "$TMP_ROOT/curl" "$TMP_ROOT/npm": >"$TMP_ROOT/curl.log": >"$TMP_ROOT/config-paths.log"+: >"$TMP_ROOT/telemetry.log"for unsafe_context in \'clerum-test' \@@ -123,6 +168,7 @@ PATH="$TMP_ROOT:$PATH" \TEST_UI_URL="$STUB_UI_URL" \TEST_STATE="$TMP_ROOT/metric-count" \TEST_CURL_LOG="$TMP_ROOT/curl.log" \+ TEST_TELEMETRY_LOG="$TMP_ROOT/telemetry.log" \TEST_CONFIG_PATHS="$TMP_ROOT/config-paths.log" \TEST_NPM_LOG='must-not-reach-playwright' \E2E_INTERNAL_CONTROL_JWT_WRC_HMAC_SECRET='wrc-test-secret' \@@ -135,6 +181,18 @@ PATH="$TMP_ROOT:$PATH" \grep -q 'agent-run-events' "$TMP_ROOT/curl.log" || fail 'oversized request was not sent'grep -q 'infrastructure-telemetry-events' "$TMP_ROOT/curl.log" || \fail 'valid post-rejection tracing request was not sent'+# The stub answered each request by reading its body, so this sequence is the+# proof that the script sent a uid-bearing reference, resent the identical+# event, and then sent the two references control-api must refuse. A missing+# arm here means the script stopped exercising a contract the gate claims to+# cover, which no status-code assertion inside the script would reveal.+EXPECTED_TELEMETRY='accepted+replay+missing-uid+unknown-key+admin-unbound'+[[ "$(cat "$TMP_ROOT/telemetry.log")" == "$EXPECTED_TELEMETRY" ]] || \+ fail "tracing arms exercised: $(tr '\n' ',' <"$TMP_ROOT/telemetry.log")"grep -q -- '--grep operator sees the real oversized tracing rejection prepared by the runtime gate' \"$TMP_ROOT/npm.log" || fail 'focused Playwright journey was not launched'grep -q -- '--reporter=json' "$TMP_ROOT/npm.log" || \@@ -146,4 +204,5 @@ while IFS= read -r config_path; do[[ ! -e "$config_path" ]] || fail 'ephemeral curl auth config was not removed'done <"$TMP_ROOT/config-paths.log"pass 'gate proves 413, metric increment, valid ingestion, and focused UI handoff'+pass 'gate proves the uid-bearing replay and the three refusals the object-identity contract requires'pass 'credentials stay outside browser inputs and are removed with the ephemeral temp directory'