Surface before/after values on ValidationSummary so callers can see what a FIX changed
Smallest useful slice of #1448 — closes the reporter's minimal ask without a schema redesign.
The request in #1448 is for callers to be able to tell that a FIX occurred, which validator did it, and what it replaced. As noted in the thread, this information already exists in ValidatorLogs (value_before_validation / value_after_validation, part of Guard.history) but is not surfaced on ValidationOutcome.
Proposal: add before/after values to ValidationSummary, populated in ValidationSummary._generate_summaries_from_validator_logs (guardrails/classes/validation/validation_summary.py) from the logs that are already passed in.
Why the outcome and not just history: for server-mode users, history is not a durable channel —
/guards/{id}/history/{call_id}is marked deprecated inguardrails_api/api/guards.pyand is backed by a 300-second cache;GUARD_HISTORY_ENABLED=falseis required for sync streaming to work at all (see the FIXME inserver_ci/tests/test_server.py).
So the outcome object is the only reliable place to read this.
Notes / gotchas:
- The field lives in the published
guardrails-ai-typespackage (guardrails_ai/types/validation_summary.py), so this is a types release coordinated withguardrails-apiand any generated clients — not a change local to this repo. - Needs a camelCase alias, or
to_dict()(model_dump(by_alias=True)) and the API/JS clients will silently miss it. - Default to a concrete value rather than
None:to_dict()usesexclude_none=True, which would make "no change" and "not tracked" indistinguishable — the exact distinction this field exists to provide. ValidationSummarycurrently defaults toNonein the base types package but[]in theguardrailssubclass (guardrails/classes/validation_outcome.py:18). Worth reconciling while in here.
Source: guardrails-ai/guardrails