Profile source capture, Nix evaluation/realization, resource/query checking, and implementation builds without putting timings into immutable outputs. Keep modular repositories; bound independent capture work, snapshot jj once per observation, and retain final concurrent-edit and Git completeness checks. Compose exact resource/closure/frontend/toolchain checks as memoized Nix derivations. Preserve whole-workspace validation and the full compiler path when no checked dependency is supplied. Share canonical Nixpkgs by content, index workspace build contexts once, and narrow lock/driver/compiler inputs with conservative complete-source fallback. Batch React witness checks only when distinct source closures cannot share ambient declarations; otherwise run the original independent TypeScript checks. Seed local authoring toolchains with exact canonical fetch identities when they match the selected inputs; retain store-path inputs for overrides. Add generic correctness checks rather than permanent Reader timing/content fixtures. Verify actual Reader edits and rejection/recovery in a private workbench, preserving the original user's workbench and runtime. Query checking currently caches at resource/closure boundaries, not individual query semantic dependency boundaries. Template helper pins and reproducible fixture snapshots follow in a separate publication change.
94 lines
5.5 KiB
Markdown
94 lines
5.5 KiB
Markdown
# Checked capability and component artifacts
|
|
|
|
`mkCaminoArtifacts` is the fresh package builder. It regenerates candidate
|
|
bindings, typechecks the entry's dependency closure, bundles declared targets,
|
|
generates a process service when requested, and emits content manifests and
|
|
receipts. It has no migration step or package-defined shell hooks.
|
|
|
|
```nix
|
|
# Inside a per-system flake output:
|
|
quixosPackages.checkedArtifacts =
|
|
{ buildContract, sourceDigest, generator, core, sharedRuntime, typescript, packageRevisionId, ... }:
|
|
helpers.mkCaminoArtifacts {
|
|
inherit pkgs buildContract sourceDigest core sharedRuntime typescript packageRevisionId;
|
|
protocol = generator;
|
|
src = ./.;
|
|
portable = {
|
|
entry = "src/portable.ts";
|
|
bindingOutput = "src/gen/qx.ts";
|
|
registryExport = "registry";
|
|
targets = [ "browser" "server" ];
|
|
};
|
|
};
|
|
```
|
|
|
|
`buildContract` is a canonical, source-free capability slice. `sourceDigest`
|
|
records the exact selected package source in the final installation manifest;
|
|
it does not enter the reusable compilation group. Ordinary source dependencies,
|
|
SDKs and React props companions remain explicit Nix inputs. Raw QX and resource
|
|
lock files enter through the checked contract and evaluated recipe, and are
|
|
excluded from the implementation source tree. The `plan` argument on the low-level
|
|
helper is a composition convenience for fixtures; it is projected before building.
|
|
Package recipes receive the contract directly and can be checked without a workspace.
|
|
|
|
Inside `checkedArtifacts = context: ...`, the package helpers expose
|
|
`camino.packageSet { inherit nixpkgs system context; }` as the usual package set
|
|
selection. It shares the workspace composition's evaluated Nixpkgs when the
|
|
source content, system, and default import arguments match. Pass ordinary Nixpkgs
|
|
arguments such as `config` or `overlays` to use a separate import. A direct
|
|
`import nixpkgs { inherit system; }` also works, with additional evaluation cost.
|
|
The implementation groups depend on the complete execution compiler bundle and
|
|
JavaScript build drivers by content; unrelated checker CLI and publication
|
|
metadata changes do not enter those inputs.
|
|
|
|
The handler entry exports `registry = createRegistry(handlers)` from the generated
|
|
bindings. One registry contains many exports. The builder always supplies a server
|
|
implementation for the generated process service. A service-only package instead
|
|
omits `portable` and supplies `service.entry`, an ordinary JavaScript process entry
|
|
using the versioned stdin/stdout protocol. Custom services own their lifecycle and
|
|
may hold external resources. This first helper supports JavaScript custom service
|
|
entries; other languages can emit the same checked artifact contract independently.
|
|
|
|
Additional portable source dependencies can be provided as a locked `nodeModules` directory.
|
|
The workspace supplies the exact SDK and compiler; packages cannot replace those
|
|
with their own versions. Authored source symlinks and non-bundled portable imports
|
|
other than the SDK and server Node builtins are rejected. This is build closure
|
|
checking, not a purity proof or security sandbox.
|
|
|
|
The core/Automerge bundle and Replicache bundle are built once. Browser modules
|
|
import the core through a content-addressed gateway URL, independent of package
|
|
identity. Each manifest covers the shared bytes it uses. The gateway retains its
|
|
workspace authentication and explicit file registry; it never interprets an HTTP
|
|
path as a Nix store path. Applications cannot import Replicache through the SDK.
|
|
|
|
`checked-artifacts.nix` evaluates a package's `checkedArtifacts` output without
|
|
activation. During the checked Nix build, `loadCheckedArtifactWorld` verifies manifest bytes, the selected
|
|
generator identity, and exact regenerated binding sources. Receipts are consistency
|
|
evidence from a trusted Nix build, not cryptographic attestations of remote builds.
|
|
The build stores the checked plan, kernel/query programs, their digests and original
|
|
compiler provenance in its immutable candidate output. Runtime loading validates
|
|
that output's identities, artifact contents and supported runtime contracts. It
|
|
does not regenerate bindings or programs with the currently running compiler.
|
|
Nix owns rebuilding and cache reuse when a toolchain input changes.
|
|
|
|
The root `camino-artifact-builds` check exercises actual reader/service outputs,
|
|
module and process execution, browser shared imports, rejection recovery, and
|
|
altered receipt rejection at the build boundary. The managed workspace host loads
|
|
the resulting checked candidate before activation. No adapter pretends this ABI
|
|
works in the old server dispatcher.
|
|
|
|
Component packages add `components = { inherit (react) sdk runtime; entries; }`.
|
|
The ordinary execution candidate checker supplies the selected React build inputs
|
|
when the package declares components. Each entry maps a component ID to
|
|
`{ entry = "src/card.tsx"; export = "Card"; }`. See the
|
|
[React SDK](../camino-react/README.md) for bindings and hooks. CSS is emitted as a
|
|
checked artifact; local image/font imports are inlined. The helper rejects
|
|
undeclared external assets and substituted React/client dependencies.
|
|
Component-only packages produce no backend service.
|
|
|
|
`camino-component-artifacts` checks bad subject/SDK/dependency/asset inputs and
|
|
proves that a component-only edit preserves a mixed package's service digest.
|
|
Run `nix run .#camino-component-source-qualification` from the monorepo to
|
|
materialize separate retained Git resources and compile an ordinary Nix candidate.
|
|
This is a source/build qualification harness; it does not deploy a workspace.
|