package validate import ( "context" "gitea.maximumdirect.net/eric/promptkit/internal/domain" ) // Validator validates the generated artifact based on the output contract. // Validation checks ctx around Promptkit-controlled work and synchronous // dependency calls. A dependency call already in progress cannot be preempted; // after it returns, cancellation takes precedence over its result. type Validator interface { Validate(ctx context.Context, artifact *domain.Artifact, contract domain.OutputContract) (domain.ValidationResult, error) } // PreparedValidation validates artifacts against one frozen output contract. // Its cancellation boundary is synchronous: Validate does not detach schema // execution, and an observed context error prevents publication of a result. type PreparedValidation interface { Validate(ctx context.Context, artifact *domain.Artifact) (domain.ValidationResult, error) // SchemaDocument returns the root JSON Schema document used for provider // structured output, or nil for non-schema modes. Returned internal // immutable state must not be mutated. SchemaDocument() any } // ValidationPreparer freezes validation resources for one output contract. // Preparation reads schemas in context-checked chunks and checks ctx around // decoding and compilation. Filesystem and compiler calls remain synchronous, // so cancellation becomes authoritative when an in-progress call returns. type ValidationPreparer interface { PrepareValidation(ctx context.Context, contract domain.OutputContract) (PreparedValidation, error) }