PtcRunner.Kernel.RunCoordinator (PtcRunner v0.14.0)

Copy Markdown View Source

Path-free preparation and one-shot execution.

Bundle compilation and public-entry validation run before provider declarations. Provider declaration checks inspect only installed aliases; they never invoke a builder, credential resolver, preflight callback, OAuth context, store, process, or network operation.

One-shot execution consumes the prepared run inside an execution-session owner. That owner constructs both sinks, keeps responding to caller death while a subordinate worker performs provider setup and runs the Kernel, and returns only sealed, filesystem-path-free execution evidence. Publication remains a separate caller operation.

Summary

Functions

Runs the declaration-owned local input checks for validate.

Collects every attributable audited-local finding for default doctor.

Runs the audited-local phase-7 step for one sealed preparation.

Rejects an entry that evaluates into a mission when the manifest declares none.

Projects the closed validation-success result from one sealed preparation.

Functions

declared_input_checks(prepared, catalog, services)

Runs the declaration-owned local input checks for validate.

validate acquires no provider and marks no activity, but a replay installation names a fixture file the declaration owns. Reading it here is the same class of work as compiling the components the manifest names, and keeps validate from passing a host document whose fixtures run cannot load.

local_check_findings(prepared, catalog, services)

Collects every attributable audited-local finding for default doctor.

This uses the same sealed declarations, callbacks, and absolute phase budget as local_checks/3, but retains ordinary failures instead of stopping at the first one so doctor can settle every provider-local row.

local_checks(prepared, catalog, services)

Runs the audited-local phase-7 step for one sealed preparation.

This is the fail-fast runtime entry to that step. Applicability is derived from the sealed trio rather than supplied, so no caller can narrow the work, and the result is only success or one catalogued diagnostic. Default doctor uses local_check_findings/3 below to retain attributable per-occurrence failures for its report. Both entries anchor one deadline for the whole step.

Every active command crosses it before provider activity is marked: run and doctor --connect through ProviderExecution. Manifest-backed REPL opening crosses the same step before provider activity, through ProviderExecution.open_repl/6 when providers are selected and directly for provider-free manifests. Direct and analysis-profile REPL sessions do not acquire a manifest application or its providers and therefore do not enter this coordinator step.

prepare(request, catalog)

validate_entry_missions(workflow_bundle, entry, missions)

@spec validate_entry_missions(
  PtcRunner.Kernel.FrozenBundle.t(),
  binary(),
  map() | nil
) ::
  :ok | {:error, PtcRunner.Kernel.CommandDiagnostic.t()}

Rejects an entry that evaluates into a mission when the manifest declares none.

kernel-mission-model-context answers unknown_mission for every name a manifest without missions can supply, so a run that reaches it cannot reach its first model request. Both facts are in the documents validate already parses: the compiled entry's transitive tool references, and whether the manifest's mission map is empty. Which mission the entry will name is not decidable here — it comes from runtime configuration — so nothing else is checked.

The reference set is a may-call set, so an entry that reaches the capability only on a branch its input never takes is refused too. That is the deliberate trade: such a manifest carries a mission-evaluating library it never uses, the remedy is one declared mission, and the failure it replaces is a paid run ending in execution/workflow_failed with nothing naming the cause.

validation_result(prepared)

@spec validation_result(PtcRunner.Kernel.PreparedRun.t()) ::
  {:ok, map()}
  | {:error, :invalid_prepared_run}
  | {:error,
     {:selection_unverifiable, binary(),
      PtcRunner.Kernel.CommandSubject.occurrence()}}

Projects the closed validation-success result from one sealed preparation.