PtcRunner.Lisp.Prelude.Attach (PtcRunner v0.14.0)

Copy Markdown View Source

Resolves a compiled or source deployment prelude and validates every tool:<name> requirement against the host-granted tools map before user code is analyzed. Unknown requirement shapes fail closed.

Summary

Functions

Resolves prelude_or_source to a compiled artifact, then validates its requires against the attach context (%PtcRunner.Lisp.Prelude.AttachContext{}, containing the granted tools: map).

Validates every public export's requires against the attach context.

Functions

attach(prelude, context)

Resolves prelude_or_source to a compiled artifact, then validates its requires against the attach context (%PtcRunner.Lisp.Prelude.AttachContext{}, containing the granted tools: map).

Returns {:ok, %PtcRunner.Lisp.Prelude{}} on success.

Returns {:error, %ValidationError{}} when:

  • the source fails compile-time validation (any compile reason), or
  • attach-time requires validation fails (:prelude_attach_failed).

Raises ArgumentError for genuine programmer misuse: a value that is neither a %PtcRunner.Lisp.Prelude{}, prelude source (binary), nor a list of source-bearing prelude selection maps.

validate_requires(prelude, context)

Validates every public export's requires against the attach context.

Returns :ok when all required backing operations are provided (or when there are no requires to check — e.g. dynamic-backed exports). Returns {:error, %ValidationError{reason: :prelude_attach_failed}} naming the first missing operation and the export that needs it.