WPL.Validator.RepairHint (WPL Validator v1.7.0)

Copy Markdown View Source

Machine-actionable repair guidance attached to a WPL.Validator.Error.

Designed for agentic completion loops: a higher-level orchestrator reads repair_hint and constructs a targeted re-generation prompt (e.g. "add weeks 2-12 to Phase 1 of this plan") without having to parse free-text message strings.

Mirrors the TypeScript RepairHint interface in @gymbile/wpl-validator (1.7.0+).

Fields:

  • :action — atom; one of :add_weeks, :add_days, :add_phases, :fix_activity, :fix_prescription, :resolve_ref, :remove_duplicate.
  • :target_path — RFC 6901 JSON Pointer to the parent the repair attaches to.
  • :parent_name — optional human-readable label of the target.
  • :missing — optional list of identifiers the agent should generate (e.g. week numbers).
  • :expected_count / :actual_count — for count-based gaps.
  • :allowed_values — for enum-shaped repairs.
  • :expected_shape — declared schema/DSL shape the agent must match.
  • :context_dsl_example — multi-line DSL snippet illustrating the fix.

Summary

Types

action()

@type action() ::
  :add_weeks
  | :add_days
  | :add_phases
  | :fix_activity
  | :fix_prescription
  | :resolve_ref
  | :remove_duplicate

t()

@type t() :: %WPL.Validator.RepairHint{
  action: action(),
  actual_count: non_neg_integer() | nil,
  allowed_values: [String.t()] | nil,
  context_dsl_example: String.t() | nil,
  expected_count: non_neg_integer() | nil,
  expected_shape: String.t() | nil,
  missing: [String.t() | number()] | nil,
  parent_name: String.t() | nil,
  target_path: String.t()
}