PtcRunner.Kernel.ProjectConfig (PtcRunner v0.14.0)

Copy Markdown View Source

Strict operator-owned launch configuration for a PTC project.

A project configuration keeps local application, host, environment, artifact, and Viewer choices out of the model-authorable application manifest. All paths are portable relative paths resolved beneath the project document's directory. Loading the project document is bounded and does not open any referenced file.

The V1 discriminator is "kind": "ptc-project". Unknown and duplicate keys are rejected at every level. The runtime never discovers a project implicitly; callers must name its JSON document. Schema failures retain a bounded PtcRunner.Kernel.SchemaViolation so command admission can publish the rule and a project-schema-authorized path without retaining rejected values or filesystem names. A schema worker that times out or exceeds its heap bound is reported as unavailable, never as a schema violation.

Summary

Functions

Classifies an explicitly named JSON document by its kind field.

Loads one project document without opening its references.

Returns the generated JSON Schema for project configuration V1.

Types

artifacts()

@type artifacts() :: %{
  trace: boolean(),
  inspection: boolean(),
  result: boolean(),
  envelope: boolean()
}

failure()

@type failure() ::
  :project_unavailable
  | :project_invalid
  | {:schema_validation_unavailable,
     PtcRunner.Kernel.SchemaViolation.unavailable_reason()}
  | {:project_schema_invalid, PtcRunner.Kernel.SchemaViolation.t()}

t()

@type t() :: %PtcRunner.Kernel.ProjectConfig{
  application: binary(),
  artifact_root: binary() | nil,
  artifacts: artifacts(),
  directory: binary(),
  env_file: binary() | nil,
  host: binary() | nil,
  path: binary(),
  viewer: viewer()
}

viewer()

@type viewer() :: %{
  port: 0..65535,
  open: boolean(),
  repl: boolean(),
  private: boolean()
}

Functions

classify(path)

@spec classify(binary()) :: :application | {:project, t()} | {:error, failure()}

Classifies an explicitly named JSON document by its kind field.

load(path)

@spec load(binary()) :: {:ok, t()} | {:error, failure()}

Loads one project document without opening its references.

schema()

@spec schema() :: map()

Returns the generated JSON Schema for project configuration V1.