Skip to content

API Reference parrot_formdesigner.services.validation_trace

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.services.validation_trace

View source

Deterministic validation trace: collector, schema fingerprint, size cap (FEAT-732).

Pure in-memory bookkeeping. FormValidator records into a collector it is handed explicitly; SubmissionPipeline seals, caps and persists the result.

Class ValidationTraceCollector

Accumulate deterministic validation evidence for one validate call.

Parameter Type Default Description
detail AuditDetail Evidence detail level. OFF is invalid because callers skip collector construction for disabled auditing.
locale str Locale used by validation messages.
clock Callable[[], datetime] | None None Optional wall-clock provider for deterministic tests.

Method ValidationTraceCollector.record_form

Record a form-level check.

record_form(check: CheckId, outcome: CheckOutcome, *, message: str | None = None, skip_reason: SkipReason | None = None) -> None

Parameter Type Default Description
check CheckId
outcome CheckOutcome
message str | None None
skip_reason SkipReason | None None

Raises:

  • ValueError — If a skipped check has no reason.

Method ValidationTraceCollector.record_resolution

Record the effective visibility and requirement for one field.

record_resolution(field_id: str, *, visible: bool, required: bool) -> None

Parameter Type Default Description
field_id str
visible bool
required bool

Method ValidationTraceCollector.record

Record one field-level check, replacing an earlier result for the same check.

record(field_id: str, check: CheckId, outcome: CheckOutcome, *, bound: str | None = None, skip_reason: SkipReason | None = None, message: str | None = None) -> None

Parameter Type Default Description
field_id str
check CheckId
outcome CheckOutcome
bound str | None None
skip_reason SkipReason | None None
message str | None None

Raises:

  • ValueError — If a skipped check has no reason.

Method ValidationTraceCollector.skip_remaining

Record skipped declared checks without overwriting checks already reached.

skip_remaining(field_id: str, checks: Iterable[tuple[CheckId, str | None]], reason: SkipReason) -> None

Parameter Type Default Description
field_id str
checks Iterable[tuple[CheckId, str | None]]
reason SkipReason

Method ValidationTraceCollector.finish

Seal the collector into a trace with the configured detail projection.

finish(form: FormSchema, *, fingerprint: str, ruleset_version: str, is_valid: bool) -> ValidationTrace

Parameter Type Default Description
form FormSchema
fingerprint str
ruleset_version str
is_valid bool

Returns: ValidationTrace

Function callable_identity

Return a stable, process-independent name for a callable.

callable_identity(fn: Any) -> str

Parameter Type Default Description
fn Any

Returns: str

Function cap_trace

Serialize a trace within max_bytes, dropping successful fields first.

cap_trace(trace: ValidationTrace, *, max_bytes: int) -> dict[str, Any]

Parameter Type Default Description
trace ValidationTrace
max_bytes int

Returns: dict[str, Any]

Function schema_fingerprint

Hash the validation-relevant subset using the validator's field traversal.

schema_fingerprint(form: FormSchema) -> str

Parameter Type Default Description
form FormSchema

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally