Implement typed module contracts and conformance bindings

This commit is contained in:
Timothy J. Aveni
2026-09-22 13:51:32 -07:00
parent 60b44a6637
commit 7173751f37
33 changed files with 2963 additions and 2261 deletions
+6 -3
View File
@@ -39,7 +39,7 @@ export const componentSharedModules = [
export interface ComponentArtifact {
id: string;
subject: string;
compatibility: "quixos-react-component-v1";
compatibility: "org.quixos.react.esm/1";
path: string;
exportName: string;
sharedModules: Record<(typeof componentSharedModules)[number], string>;
@@ -171,7 +171,7 @@ function parseComponent(value: unknown, index: number): ComponentArtifact {
[],
path,
);
if (entry.compatibility !== "quixos-react-component-v1") fail(path, "Unsupported component ABI");
if (entry.compatibility !== "org.quixos.react.esm/1") fail(path, "Unsupported component ABI");
const files = parseArtifactFiles(entry.files, `${path}.files`);
const shared = object(entry.sharedModules, `${path}.sharedModules`);
keys(shared, [...componentSharedModules], [], `${path}.sharedModules`);
@@ -187,7 +187,7 @@ function parseComponent(value: unknown, index: number): ComponentArtifact {
const component: ComponentArtifact = {
id: text(entry.id, path),
subject: text(entry.subject, path),
compatibility: "quixos-react-component-v1",
compatibility: "org.quixos.react.esm/1",
path: entryPath,
exportName,
sharedModules,
@@ -272,6 +272,9 @@ export function parsePackageArtifacts(value: unknown): PackageArtifacts {
};
}
function checkCoverage(expected: PlanPackage, manifest: PackageArtifacts): void {
for (const module of expected.modules ?? [])
if (!expected.components?.some((component) => component.id === module.id))
fail(module.id, `No artifact consumer for module contract ${module.contract} and its subject`);
if (expected.bindingDigest !== manifest.bindingDigest || expected.sourceDigest !== manifest.sourceDigest)
fail(expected.revision, "Substituted binding schema or source revision");
for (const component of manifest.components ?? []) {