Skip to content

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

TypeScript

fix(ci): reject unsupported matrix metadata before counting services

Alfredo Lopez2a0a05a478d2
diff --git a/scripts/dev/check-test-services.cjs b/scripts/dev/check-test-services.cjs
index f7169df01..39004198c 100644
--- a/scripts/dev/check-test-services.cjs
+++ b/scripts/dev/check-test-services.cjs
@@ -44,13 +44,13 @@ function checkServices(workflow, localServices) {
}
if (services.length < 1) throw new Error('Expected one literal CI service matrix')
const metadata = lines.slice(cursor)
- if (metadata.some((line) => /^ {8}exclude:/.test(line))) {
- throw new Error('Unsupported CI matrix metadata: exclude removes required service coverage')
- }
- const includeKeys = metadata.filter((line) => /^ {8}include:/.test(line))
- if (includeKeys.length > 1 || (includeKeys.length === 1 && includeKeys[0] !== ' include:')) {
- throw new Error('Unsupported CI matrix metadata')
+ const siblingHeaders = metadata.filter((line) => /^ {8}\S/.test(line))
+ const unsupportedSibling = siblingHeaders.find((line) => line !== ' include:')
+ if (unsupportedSibling) {
+ throw new Error(`Unsupported CI matrix metadata: ${unsupportedSibling.trim()}`)
}
+ const includeKeys = siblingHeaders.filter((line) => line === ' include:')
+ if (includeKeys.length > 1) throw new Error('Unsupported CI matrix metadata: duplicate include')
if (includeKeys.length === 1) {
const includeIndex = metadata.indexOf(includeKeys[0])
const includeEntries = []
diff --git a/scripts/tests/test-test-services.cjs b/scripts/tests/test-test-services.cjs
index 54cfb8e13..45dc35e77 100644
--- a/scripts/tests/test-test-services.cjs
+++ b/scripts/tests/test-test-services.cjs
@@ -45,6 +45,22 @@ const workflowWithExclude = workflow.replace(
'\n steps:',
'\n exclude:\n - service: packages/two\n steps:'
)
+const workflowWithQuotedExclude = workflow.replace(
+ '\n steps:',
+ '\n "exclude":\n - service: packages/two\n steps:'
+)
+const workflowWithSpacedExclude = workflow.replace(
+ '\n steps:',
+ '\n exclude :\n - service: packages/two\n steps:'
+)
+const workflowWithQuotedInclude = workflow.replace(
+ '\n steps:',
+ '\n "include":\n - service: fixture-only\n steps:'
+)
+const workflowWithUnknownSibling = workflow.replace(
+ '\n steps:',
+ '\n unknown:\n - service: fixture-only\n steps:'
+)
test('matrix parity is independent of order', () => {
assert.equal(checkServices(workflow, ['packages/two', 'one']), 2)
@@ -91,6 +107,16 @@ test('include services must be static members of the service axis', () => {
test('matrix exclude that removes required coverage fails closed', () => {
assert.throws(() => checkServices(workflowWithExclude, ['one', 'packages/two']), /Unsupported CI matrix metadata/)
})
+test('unrecognized matrix sibling variants fail closed instead of producing partial parity', () => {
+ for (const unsupported of [
+ workflowWithQuotedExclude,
+ workflowWithSpacedExclude,
+ workflowWithQuotedInclude,
+ workflowWithUnknownSibling,
+ ]) {
+ assert.throws(() => checkServices(unsupported, ['one', 'packages/two']), /Unsupported CI matrix metadata/)
+ }
+})
test('duplicate service axes in one matrix fail closed', () => {
assert.throws(
() => checkServices(workflowWithDuplicateServiceAxis, ['one', 'packages/two']),