PtcRunner.Kernel.CommandPath (PtcRunner v0.14.0)

Copy Markdown View Source

Schema-authorized diagnostic path.

Paths are minted only after every property or index has been walked through the host/manifest schema, the exact selected branch of one compiled value contract, the shared discriminator projection when no tagged-union branch matches, or — for a contract schema rejected before it compiles — the submitted document itself. The attestation prevents a caller-authored segment list from being substituted at the diagnostic boundary, and carries the authority that admitted it so a path cannot be moved to another document.

Summary

Types

segment()

@type segment() :: {:property, binary()} | {:index, non_neg_integer()}

t()

@type t() :: %PtcRunner.Kernel.CommandPath{
  attestation: binary(),
  authority:
    :host
    | :project
    | :manifest
    | :component_override
    | {:value_contract_schema, binary()}
    | {:contract, PtcRunner.Kernel.CommandContractAuthority.t()},
  segments: [segment()]
}

Functions

component_override(segments)

@spec component_override([segment()]) :: {:ok, t()} | {:error, :invalid_command_path}

contract(authority, segments)

@spec contract(PtcRunner.Kernel.CommandContractAuthority.t(), [segment()]) ::
  {:ok, t()} | {:error, :invalid_command_path}

host(segments)

@spec host([segment()]) :: {:ok, t()} | {:error, :invalid_command_path}

manifest(segments)

@spec manifest([segment()]) :: {:ok, t()} | {:error, :invalid_command_path}

project(segments)

@spec project([segment()]) :: {:ok, t()} | {:error, :invalid_command_path}

to_pointer(path)

@spec to_pointer(t()) :: binary()

valid?(path)

@spec valid?(term()) :: boolean()

value_contract_schema(name, document, segments)

@spec value_contract_schema(binary(), map(), [segment()]) ::
  {:ok, t()} | {:error, :invalid_command_path}

Locates a fault inside a value-contract schema document that failed to compile.

A rejected contract has no compiled path schema to authorize against, so the submitted document is the authority: a pointer is minted only when every segment resolves in the document the author wrote. The pointer therefore always names a key or index that file actually carries.

The document's logical name is attested with the segments. A diagnostic boundary requires it to equal the source it names, so a pointer minted for one contract file cannot be attached to a diagnostic about another.