Skip to content

Closure-local dependency components

When no existing candidate satisfies a requirement, the resolver builds one. The result is a closure-local component: immutable bytes constructed for this closure, with their own inventory and provenance.

closure_local is its source on the binding, and it is the ordinary outcome for a requirement the foundation does not carry and the project did not prepare.

What the builder is asked for

The resolver hands the component builder a request derived from the candidate it selected:

{
  "construction_purpose": "reusable_block",
  "component_kind": "python_distribution",
  "requirement_spec": "orjson>=3.10",
  "selected_version": "3.10.7",
  "selected_artifacts": [
    {
      "artifact_id": "pypi:orjson:3.10.7",
      "source_id": "internal-pypi",
      "source_locator": "https://pypi.internal.acme.example/simple",
      "source_access_profile_id": "dp-internal-pypi",
      "source_approval_digest": "sha256:3b7f...",
      "artifact_locator": "orjson-3.10.7-cp311-manylinux_2_17_x86_64.whl",
      "artifact_digest": "sha256:52ab..."
    }
  ],
  "declared_dependency_artifact_ids": []
}

Every artifact names the approved source it came from and that source's approval digest, so the built component carries the authority it was fetched under rather than a bare URL.

construction_purpose is reusable_block, project_prepared or project_system, taken from the requirement's scope. A scope with no construction purpose cannot produce a component:

dependency scope <scope> cannot construct a component

The resolver also refuses to build for a requirement it holds no admitted authority for:

resolver-selected component <name> has no admitted requirement authority

That check exists because the builder acts on the resolver's word. A component built for a requirement nobody declared would be bytes in the artifact set with no declaration behind them, and the closure would carry a mount whose authority no document states.

What comes back

A built component carries a digest-sealed inventory describing every surface in its complete transitive bundle: the Python distributions it provides, its native objects, and its executables. Closure construction checks that inventory against what the closure expects and refuses a missing, extra or conflicting surface before anything is mounted.

The build evidence is attested, and the component's provenance digest travels on the binding beside its inventory digest. A cell therefore mounts bytes whose production is recorded, not bytes that merely arrived.

Where it is one component and where it is three

closure_local means built for this closure, and a closure belongs to one block. Two blocks declaring the same unsatisfied requirement produce two bindings, and compatible component bytes may be deduplicated underneath the closure boundary even though each block's closure names its own binding.

Preparing the requirement at project scope instead makes it one build and one component by construction, at the cost of pinning the version for the project's candidates. See Preparing a shared Python component.

Build time, not run time

Components are constructed inside the build and release transaction. At runtime nothing fetches, installs or builds: the cell mounts an artifact set that was resolved, built, admitted and materialised beforehand.

That boundary is why a closure describes what ran. See Closure artifact sets and materialization.