Skip to main content

Module validate

Module validate 

Source
Expand description

ATIF validator, mirroring Harbor’s trajectory-validator semantics: validates required fields, types and constraints, sequential step ids (starting from 1), tool-call references in observations, ISO-8601 timestamps, agent-only field placement — and collects errors as it goes (not just the first), up to MAX_VALIDATION_ISSUES, after which a truncation notice is appended.

Two modes (Mode): Strict additionally rejects unknown fields outside the spec’s extra escape hatches (outbound gate for files we produce); Compat tolerates unknown fields (inbound tolerance for files produced by newer or third-party writers).

Structs§

ValidationIssue
One validation problem, with a Harbor-style dotted path.

Enums§

Mode
Validation mode.

Constants§

MAX_COST_USD
Upper bound for USD-denominated cost fields (total_cost_usd in final_metrics, cost_usd per step). Aligned with the downstream recovery scaling in av_harness::session::cost_from_atif_total: recovery converts dollars → micros via cost * USD_MICROS_PER_DOLLAR (1_000_000) and refuses results exceeding JCS_SAFE_MAX = 2^53. Setting the strict-validator cap at 9e9 (nine billion USD) fits comfortably below JCS_SAFE_MAX / USD_MICROS_PER_DOLLAR (~9.007e9) and ensures every trajectory that passes strict validation can also pass recovery — before this alignment the validator accepted up to 1e12 (one trillion USD) while recovery capped at ~9e9, so hypothetical mid-range trajectories became unrecoverable with an explicit “recovered cost exceeds JCS-safe bounds” error.
MAX_VALIDATION_ISSUES
Cap on the number of issues collected by validate_value.

Functions§

validate_bytes
Validate an ATIF trajectory from its RAW BYTES. This is the correct entry point for every path that receives operator/attacker-supplied ATIF content (CLI avctl atif-validate, reconciler recovery + promotion). Unlike serde_json::from_slice::<Trajectory>() + validate_trajectory, the bytes path:
validate_trajectory
Validate a typed trajectory (serializes then defers to validate_value).
validate_value
Validate a raw JSON value as an ATIF trajectory.