test(cli): derive CLI tool coverage and schema parity from command registry (#11776)

* test(cli): derive CLI tool coverage and schema parity from command registry

* test(cli): check recorded routed operations and host operation bindings
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 16:30:36 -05:00
1 parent e741366c94
commit e44f0077c9
11 files changed
+605 -389

No files matched your search

+28
View File
@@ -165,3 +165,31 @@ export const distinctOperations = (
const seen = new Set<string>();
return operations.filter(({ name }) => !seen.has(name) && seen.add(name));
};
/**
* Contract operations the command itself answers, excluding the session-target
* opener and any Evidence-target source operation it runs first.
*/
export const commandOwnOperations = (
entry: CliCommandEntry,
): readonly CliCommandOperation[] => {
const { source, operations } = entry;
if (source.kind === "contract") {
const opening = source.description.sessionTarget?.opening;
const targetSource = source.description.evidenceTargets?.source;
return operations.filter(
({ name }) => name !== opening && name !== targetSource,
);
}
if (source.kind === "routed") {
const own = new Set<string>(
source.descriptions.map((description) => description.contract.name),
);
return operations.filter(({ name }) => own.has(name));
}
if (source.kind === "document") {
const opening = source.description.sessionTarget?.opening;
return operations.filter(({ name }) => name !== opening);
}
return operations;
};