Build Camino packages from explicit contract inputs
Project source-free capability contracts and keep exact source provenance in package assembly. Reuse compiled groups across unrelated graph and dependency implementation edits. Keep React public inputs separate from workspace query lowering and retain explicit type-companion dependencies. Allow independent execution-package checks, scope resource compilation to declared dependencies, and memoize source closure traversal. Document generic-specialization limits and measured Reader rebuild behavior. Verified protocol, artifact, package, React, and managed activation checks; retained-Git independent/workspace artifact equality and incompatible type dependency rejection; nix fmt -- --check and lint. One-off Reader measurements recompiled 1 of 13 groups for a child edit and 0 for a workspace QX default edit.
This commit is contained in:
@@ -10,6 +10,9 @@ import {
|
||||
generatePackageQueryClientBindings,
|
||||
} from "../src/execution-world/client-contracts.js";
|
||||
import { compileQueryProgram } from "../src/execution-world/queries.js";
|
||||
import { presentationDeclarations, preparationArtifact } from "../src/react-build/declarations.js";
|
||||
import { compileQueryComposition } from "../src/query/composition.js";
|
||||
import type { PackageRevision } from "../src/capability-model/types.js";
|
||||
const source = { repository: "https://example.test/device-owner.git", commit: "a".repeat(40) };
|
||||
const factory = compileCapabilityResourceSource(
|
||||
`external atom Entry id "atom:entry";
|
||||
@@ -51,6 +54,17 @@ const view = compileCapabilityResourceSource(
|
||||
);
|
||||
assert.ok(view.ok && view.resource.kind === "interface", JSON.stringify(view.diagnostics));
|
||||
const viewInterface = view.resource.revision;
|
||||
function declareInputs(pkg: PackageRevision) {
|
||||
const declarations = presentationDeclarations(
|
||||
JSON.stringify({
|
||||
modules: Object.fromEntries((pkg.modules ?? []).map((module) => [module.displayName, { inputs: [] }])),
|
||||
}),
|
||||
pkg,
|
||||
[dataInterface, viewInterface],
|
||||
);
|
||||
pkg.buildArtifacts = { [preparationArtifact]: declarations.artifact };
|
||||
pkg.queryCompositions = declarations.compositions.map((entry) => compileQueryComposition(entry, new Map()));
|
||||
}
|
||||
const ui = compileCapabilityResourceSource(
|
||||
'import interface Data; import interface View; package UI id "package:ui" revision "package:ui@1" { module Card id "component:card" implements View.render; }',
|
||||
{
|
||||
@@ -65,6 +79,7 @@ const ui = compileCapabilityResourceSource(
|
||||
},
|
||||
);
|
||||
assert.ok(ui.ok && ui.resource.kind === "package", JSON.stringify(ui.diagnostics));
|
||||
declareInputs(ui.resource.revision);
|
||||
for (const variant of ["base", "added", "gateway", "gateway-next", "session"]) {
|
||||
const session = variant === "session",
|
||||
gateway = session || variant.startsWith("gateway"),
|
||||
@@ -107,6 +122,7 @@ package Owner id "package:owner" revision "package:owner@1" {
|
||||
},
|
||||
);
|
||||
assert.ok(pkg.ok && pkg.resource.kind === "package", JSON.stringify(pkg.diagnostics));
|
||||
if (session) declareInputs(pkg.resource.revision);
|
||||
if (session)
|
||||
pkg.resource.revision.checkedQueries = await Promise.all(
|
||||
pkg.resource.revision.queries!.map((query) =>
|
||||
|
||||
Reference in New Issue
Block a user