Module adcp.types.domains.property.validation_result

Classes

class Feature (**data: Any)
Expand source code
class Feature(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    feature_id: Annotated[
        str,
        Field(
            description="Which feature was evaluated. Data features come from the governance agent's feature catalog (e.g., 'mfa_score', 'carbon_score'). Record-level structural checks use reserved namespaces: 'record:list_membership', 'record:excluded', 'delivery:seller_authorization', 'delivery:click_url_presence'. Reserved prefixes: 'record:', 'delivery:'."
        ),
    ]
    status: feature_check_status.FeatureCheckStatus
    policy_id: Annotated[
        str | None,
        Field(
            description='Optional attribution — when this feature was evaluated for the purpose of a specific policy, policy_id references the authorizing PolicyEntry. Property-list agents populate when the validation was motivated by a specific policy. See /docs/governance/policy-attribution.'
        ),
    ] = None
    explanation: Annotated[
        str | None, Field(description='Directional human-readable explanation of the result.')
    ] = None
    requirement: Annotated[
        Requirement | None,
        Field(
            description='The feature requirement that was not met. MAY be present on failed features when the caller authored the requirement (e.g., feature_requirements on a property list). The buyer set these thresholds — echoing them back enables fix-and-retry loops without looking up the list definition.'
        ),
    ] = None
    confidence: Annotated[
        StrictFloat | None,
        Field(
            description='Optional evaluator confidence in this result (0-1). Distinguishes certain verdicts from ambiguous ones.',
            ge=0.0,
            le=1.0,
        ),
    ] = None

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var confidence : float | None
var explanation : str | None
var feature_id : str
var model_config
var policy_id : str | None
var requirement : Requirement | None
var status : FeatureCheckStatus

Inherited members

class Requirement (**data: Any)
Expand source code
class Requirement(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    min_value: Annotated[
        StrictFloat | None, Field(description='Minimum value that was required')
    ] = None
    max_value: Annotated[
        StrictFloat | None, Field(description='Maximum value that was allowed')
    ] = None
    allowed_values: Annotated[
        list[Any] | None, Field(description='Values that would have been acceptable')
    ] = None

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var allowed_values : list[typing.Any] | None
var max_value : float | None
var min_value : float | None
var model_config

Inherited members

class Status (*args, **kwds)
Expand source code
class Status(StrEnum):
    compliant = 'compliant'
    non_compliant = 'non_compliant'
    not_covered = 'not_covered'
    unidentified = 'unidentified'

Enum where members are also (and must be) strings

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var compliant
var non_compliant
var not_covered
var unidentified
class ValidationResult (**data: Any)
Expand source code
class ValidationResult(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    identifier: Annotated[
        identifier_1.Identifier, Field(description='The identifier that was validated')
    ]
    record_id: Annotated[
        str | None, Field(description='Client-provided ID from the delivery record (if provided)')
    ] = None
    status: Annotated[
        Status,
        Field(
            description='Validation status: compliant (in list), non_compliant (not in list), not_covered (identifier recognized but no data available), unidentified (identifier type not resolvable by this governance agent)'
        ),
    ]
    impressions: Annotated[
        SchemaInt, Field(description='Number of impressions from this record', ge=0)
    ]
    features: Annotated[
        list[Feature] | None,
        Field(
            description='Per-feature breakdown for this record. SHOULD include all failed and warning features. MAY include passed features. For property validation the buyer authored the requirement, so the `requirement` that was not met MAY be echoed back on failures — this is contract data, not evaluator IP.'
        ),
    ] = None
    authorization: Annotated[
        authorization_result.AuthorizationResult | None,
        Field(
            description='Authorization validation result (only present if sales_agent_url was provided in the delivery record)'
        ),
    ] = None
    ext: ext_1.ExtensionObject | None = None

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var authorization : AuthorizationResult | None
var ext : ExtensionObject | None
var features : list[Feature] | None
var identifier : Identifier
var impressions : int
var model_config
var record_id : str | None
var status : Status

Inherited members