Skip to content

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

TypeScript

ci: run the subscription image fixture and memory calibration tests

Alfredo Lopezea612866fd4d
diff --git a/.github/workflows/ci-public.yml b/.github/workflows/ci-public.yml
index 031155fe8..4a86c05d3 100644
--- a/.github/workflows/ci-public.yml
+++ b/.github/workflows/ci-public.yml
@@ -176,6 +176,23 @@ jobs:
if: matrix.service == 'desktop-app'
run: node --test scripts/tests/subscription-private-ui-input.test.mjs
+ # Hermetic subscription-image and Control API memory-calibration node:test
+ # suites. Their only installed dependency is mcp-host's @napi-rs/canvas,
+ # which this leg installs for the Desktop fixture checks above.
+ - name: Test subscription image fixtures and memory calibration
+ if: matrix.service == 'desktop-app'
+ run: |
+ node scripts/tests/run-node-test-files.mjs \
+ scripts/tests/subscription-image-coordinator.test.mjs \
+ scripts/tests/subscription-image-coordinator-regressions.test.mjs \
+ scripts/tests/subscription-image-runner.test.mjs \
+ scripts/tests/subscription-image-input-frames.test.mjs \
+ scripts/tests/subscription-t0-discovery.test.mjs \
+ scripts/tests/control-api-qa-runtime.test.mjs \
+ scripts/tests/measure-control-api-authorize-memory.test.mjs \
+ scripts/e2e/prepare-subscription-remaining-fixtures.test.mjs \
+ scripts/e2e/fixtures/subscription-image-provider.test.mjs
+
- name: Test the pinned-suite checker
if: matrix.service == 'gfs-controller'
run: node scripts/tests/run-node-test-files.mjs scripts/ci/assert-pinned-vitest-suites.test.mjs
diff --git a/scripts/tests/lib/subscription-t0-discovery.mjs b/scripts/tests/lib/subscription-t0-discovery.mjs
index 703cba470..b7250ae83 100644
--- a/scripts/tests/lib/subscription-t0-discovery.mjs
+++ b/scripts/tests/lib/subscription-t0-discovery.mjs
@@ -247,15 +247,39 @@ function verifyOtherConsumer(root, file, lane) {
return `${ciPath}#test (${service}); ${configPath}`
}
+const nodeTestRunner = 'scripts/tests/run-node-test-files.mjs'
+
+// A workflow step consumes `file` only when its own run command passes it to
+// the explicit node:test runner from the repository root. A comment, another
+// step's command, a relocated working-directory or a step allowed to fail
+// does not count.
+function ciStepRunsNodeTest(ci, file) {
+ return ci.split(/\n\s*- (?=name:|uses:|run:)/).slice(1).some(step => {
+ if (/^\s*(?:working-directory|continue-on-error):/m.test(step)) return false
+ const run = step.split(/^\s*run:/m)[1]
+ if (run === undefined) return false
+ const tokens = run.split('\n')
+ .filter(line => !line.trim().startsWith('#'))
+ .join(' ')
+ .replace(/\\(?=\s|$)/g, ' ')
+ .split(/\s+/)
+ .filter(token => token && token !== '|')
+ const runner = tokens.findIndex((token, index) => token === nodeTestRunner && tokens[index - 1] === 'node')
+ return runner !== -1 && tokens.slice(runner + 1).includes(file)
+ })
+}
+
function verifyCalibrationConsumer(root, file, lane) {
if (lane !== 'calibration:control-api-memory') return undefined
const driver = 'scripts/tests/measure-control-api-authorize-memory.mjs'
- if (!regularFile(root, file) || !regularFile(root, driver)) return undefined
+ const ciPath = '.github/workflows/ci-public.yml'
+ if (!regularFile(root, file) || !regularFile(root, driver) || !regularFile(root, ciPath)) return undefined
const makefile = regularFile(root, 'Makefile')
? readFileSync(path.join(root, 'Makefile'), 'utf8')
: ''
if (!makefile.includes('minikube-control-api-authorize-memory:')) return undefined
- return `Makefile#minikube-control-api-authorize-memory (physical calibration only); ${driver}`
+ if (!ciStepRunsNodeTest(readFileSync(path.join(root, ciPath), 'utf8'), file)) return undefined
+ return `${ciPath} (${nodeTestRunner} ${file}); Makefile#minikube-control-api-authorize-memory (physical calibration only); ${driver}`
}
export function auditSubscriptionDiscovery(provider, root, registered) {
diff --git a/scripts/tests/subscription-image-coordinator.test.mjs b/scripts/tests/subscription-image-coordinator.test.mjs
index 4ca6469a2..caa292e61 100644
--- a/scripts/tests/subscription-image-coordinator.test.mjs
+++ b/scripts/tests/subscription-image-coordinator.test.mjs
@@ -184,7 +184,8 @@ test('admission fixture accepts eligible same-provider alternate and rejects imp
profile: run.profile, context: run.context, sourceManifestSha256: digest, preparedAt: new Date().toISOString(),
fixtures: Object.fromEntries(bindings.map(binding => [binding.provider, { hostRef: binding.hostRef, podUid: uid,
imageId: `sha256:${digest}`, controlApiPodUid: uid, controlApiImageId: `sha256:${digest}`, maxInFlight: 1,
- readDeadlineMs: 10000, pressure: { receiptFile: '/runner-admission/main-admission.json' }, fallback: binding.fallback }])) }
+ readDeadlineMs: 10000, pressure: { receiptFile: '/runner-admission/main-admission.json', workDeadlineMs: 30000,
+ closeGraceMs: 250, commandDeadlineMs: 40250 }, fallback: binding.fallback }])) }
const input = { suite: 'admission-recovery', fixtureReceiptPath: `${runRoot}/remaining.json` }
assert.equal(validateRemainingFixture(receipt, input, run, digest), receipt)
const bad = structuredClone(receipt)
@@ -196,8 +197,10 @@ test('public source separates private input, actual frame stream, vendor-only de
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), '../..')
const source = fs.readFileSync(path.join(root, 'scripts/e2e/coordinate-subscription-image-journeys.mjs'), 'utf8')
const dockerfile = fs.readFileSync(path.join(root, 'scripts/e2e/fixtures/subscription-image-proxy.Dockerfile'), 'utf8')
- assert(source.includes('seed(memoryOptions, privateMaterial, async session'))
- assert(source.includes('session.revokeImages()') && source.includes('restoreDeployments(memoryOptions.context, states)'))
+ assert(source.includes('seed(memoryOptions, seedPrivateMaterial(privateMaterial), async session'))
+ assert(source.includes('session.revokeImages()') &&
+ source.includes('const targets = qaRestorationTargets(grantStatus.state, states)') &&
+ source.includes('restoreDeployments(memoryOptions.context, targets.restore)'))
assert(!source.includes('/environ') && !source.includes('page.evaluate') && !source.includes('storageState'))
assert(dockerfile.includes('/app/mcp-host/node_modules/@napi-rs/') && !dockerfile.includes('npm ') && !dockerfile.includes('COPY dist'))
})
diff --git a/scripts/tests/subscription-image-input-frames.test.mjs b/scripts/tests/subscription-image-input-frames.test.mjs
index 621e242d7..8c57c3002 100644
--- a/scripts/tests/subscription-image-input-frames.test.mjs
+++ b/scripts/tests/subscription-image-input-frames.test.mjs
@@ -71,11 +71,13 @@ async function remainingFrame(admission, root) {
fixtureImagePath: remainingAssetPath(root, admission.suiteId, asset.name), imageSha256: asset.sha256,
width: 512, height: 512 }
}) }]
- const other = admission.bindings.find(candidate => candidate.provider !== binding.provider)
+ // commandDeadlineMs = max(read, work + closeGrace + 5000) + 5000 for the
+ // compiled companion policy; the eligible fallback is a same-provider alternate.
return [binding.provider, { ...identity, controlApiPodUid: uuid(40), controlApiImageId: `sha256:${'e'.repeat(64)}`,
maxInFlight: 2, readDeadlineMs: 500,
- pressure: { receiptFile: '/runner-admission/pressure-metadata.json' },
- fallback: { provider: other.provider, modelId: other.modelId } }]
+ pressure: { receiptFile: '/runner-admission/pressure-metadata.json',
+ workDeadlineMs: 1000, closeGraceMs: 250, commandDeadlineMs: 11250 },
+ fallback: { provider: binding.provider, modelId: `${binding.modelId}-alternate` } }]
}))
return buildRemainingFixtureFrame({ admission, runRoot: root, fixtures, assets })
}
diff --git a/scripts/tests/subscription-image-runner.test.mjs b/scripts/tests/subscription-image-runner.test.mjs
index a27d40060..12f4ec193 100644
--- a/scripts/tests/subscription-image-runner.test.mjs
+++ b/scripts/tests/subscription-image-runner.test.mjs
@@ -785,9 +785,15 @@ test('pressure metadata and native owner observations refuse drift', () => {
pressureRunId: 'subscription-image-pressure-123456abcdef',
hostRefs: ['unit-grok', 'unit-codex'],
maxInFlight: 2,
+ // Compiled companion policy; commandDeadlineMs = max(read, work + closeGrace + 5000) + 5000.
+ readDeadlineMs: 10000,
+ workDeadlineMs: 30000,
+ closeGraceMs: 250,
+ commandDeadlineMs: 40250,
socketPath: '/run/evenfire-e2e/pressure.sock',
}
assert.doesNotThrow(() => verifyPressureMetadata(metadata))
+ assert.throws(() => verifyPressureMetadata({ ...metadata, commandDeadlineMs: 40251 }), /METADATA_INVALID/)
assert.throws(() => verifyPressureMetadata({ ...metadata, hostRefs: ['unit-grok', 'unit-grok'] }))
assert.throws(() => verifyPressureMetadata({ ...metadata, socketPath: 'relative.sock' }))
const value = {
diff --git a/scripts/tests/subscription-t0-discovery.test.mjs b/scripts/tests/subscription-t0-discovery.test.mjs
index 819981a3d..894e77ef1 100644
--- a/scripts/tests/subscription-t0-discovery.test.mjs
+++ b/scripts/tests/subscription-t0-discovery.test.mjs
@@ -401,12 +401,53 @@ test('memory calibration owns a dedicated lane and cannot enter T0', t => {
createFile(fixture.root, testFile)
createFile(fixture.root, driver)
createFile(fixture.root, 'Makefile', 'minikube-control-api-authorize-memory:\n\t@true\n')
+ const workflow = '.github/workflows/ci-public.yml'
+ const workflowWith = step => `jobs:
+ test:
+ steps:
+ - uses: actions/checkout@v4
+${step}
+ - name: Test
+ run: npm test
+`
+ createFile(fixture.root, workflow, workflowWith(` - name: Test calibration
+ if: matrix.service == 'desktop-app'
+ run: |
+ node scripts/tests/run-node-test-files.mjs \\
+ scripts/tests/other.test.mjs \\
+ ${testFile}`))
const result = auditSubscriptionDiscovery('codex', fixture.root, fixture.registered)
assert.deepEqual(result.violations, [])
const entry = result.candidates.find(candidate => candidate.file === testFile)
assert.equal(entry?.lane, 'calibration:control-api-memory')
assert.match(String(entry?.consumer), /physical calibration only/)
+ assert.match(String(entry?.consumer), /ci-public\.yml \(scripts\/tests\/run-node-test-files\.mjs /)
+
+ // The Makefile target alone runs nothing in CI: a workflow that only names
+ // the suite in a comment, in a relocated step or not at all is rejected.
+ const unverified = `unverified calibration:control-api-memory consumer for ${testFile}`
+ for (const step of [
+ '',
+ ` # ${testFile} is listed here but never run.
+ - name: Test other suites
+ run: node scripts/tests/run-node-test-files.mjs scripts/tests/other.test.mjs`,
+ ` - name: Test calibration elsewhere
+ working-directory: scripts
+ run: node scripts/tests/run-node-test-files.mjs ${testFile}`,
+ ` - name: Test calibration allowed to fail
+ continue-on-error: true
+ run: node scripts/tests/run-node-test-files.mjs ${testFile}`,
+ ]) {
+ writeFileSync(path.join(fixture.root, workflow), workflowWith(step))
+ const negative = auditSubscriptionDiscovery('codex', fixture.root, fixture.registered)
+ assert.ok(negative.violations.includes(unverified), step || 'workflow without the step')
+ assert.equal(negative.candidates.find(candidate => candidate.file === testFile)?.consumer, undefined)
+ }
+ writeFileSync(path.join(fixture.root, workflow), workflowWith(` - name: Test calibration
+ run: node scripts/tests/run-node-test-files.mjs ${testFile}`))
+ const restored = auditSubscriptionDiscovery('codex', fixture.root, fixture.registered)
+ assert.deepEqual(restored.violations, [])
const registered = auditSubscriptionDiscovery(
'codex',