Skip to content

Commit 6a8c155

Browse files
committed
chore(gates): scan facets, not executables, for provider coverage
The integration-progress scanner mapped client calls to command names by finding defineExecutableCommand blocks. Those are gone; a facet's run callback now holds the call, and its name may be a module constant.
1 parent 4aab7ff commit 6a8c155

1 file changed

Lines changed: 8 additions & 26 deletions

File tree

scripts/integration-progress-model.ts

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -570,29 +570,17 @@ function readCommandContractBlocks(text) {
570570
for (const match of text.matchAll(/\bconst\s+([A-Z0-9_]+)\s*=\s*['"]([^'"]+)['"]/g)) {
571571
constants.set(match[1], match[2]);
572572
}
573-
574-
const metadataNames = new Map();
575-
for (const match of text.matchAll(
576-
/\bconst\s+([A-Za-z0-9_]+CommandMetadata)\s*=\s*defineFieldCommandMetadata\(\s*([^,\s)]+)/g,
577-
)) {
578-
metadataNames.set(match[1], readMetadataName(match[2], constants));
579-
}
573+
const nameOf = (token) => token.match(/^['"]([^'"]+)['"]$/)?.[1] ?? constants.get(token);
580574

581575
const starts = [
582-
...text.matchAll(/defineExecutableCommand\(\s*metadata\(\s*['"]([^'"]+)['"]\s*\)/g),
583-
...[...text.matchAll(/defineExecutableCommand\(\s*([A-Za-z0-9_]+CommandMetadata)\b/g)].flatMap(
584-
(match) => {
585-
const name = metadataNames.get(match[1]);
586-
return name ? [{ ...match, 1: name }] : [];
587-
},
588-
),
589-
...text.matchAll(/defineFieldCommand\(\s*['"]([^'"]+)['"]/g),
590-
...text.matchAll(/defineCommand\(\s*\{[\s\S]*?\bname:\s*['"]([^'"]+)['"]/g),
576+
...text.matchAll(/defineCommandFacet\(\s*\{[\s\S]*?\bname:\s*([A-Za-z0-9_]+|['"][^'"]+['"])/g),
577+
...text.matchAll(/defineFieldCommand\(\s*(['"][^'"]+['"])/g),
578+
...text.matchAll(/defineCommand\(\s*\{[\s\S]*?\bname:\s*(['"][^'"]+['"])/g),
591579
]
592-
.map((match) => ({
593-
index: match.index ?? 0,
594-
name: match[1],
595-
}))
580+
.flatMap((match) => {
581+
const name = nameOf(match[1]);
582+
return name ? [{ index: match.index ?? 0, name }] : [];
583+
})
596584
.sort((a, b) => a.index - b.index);
597585

598586
return starts.map((start, index) => {
@@ -604,12 +592,6 @@ function readCommandContractBlocks(text) {
604592
});
605593
}
606594

607-
function readMetadataName(token, constants) {
608-
const literal = token.match(/^['"]([^'"]+)['"]$/);
609-
if (literal) return literal[1];
610-
return constants.get(token);
611-
}
612-
613595
function extractProviderScenarioCommandReferences(text, clientCommandMethods) {
614596
return [
615597
...extractLiteralCommandReferences(text),

0 commit comments

Comments
 (0)