You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add additive ErrorDetail::causes for per-branch std::variant / AnyOf failures #74
When parsing fails on an untagged std::variant<...> / rfl::Variant<...> or rfl::AnyOf<...> validator, reflect-cpp currently collapses branch failures into a flat message under ErrorKind::invalid_value.
Effect Schema (AnyOf / Composite) and Zod (invalid_union) preserve structured per-branch failure trees so callers and form/RPC UIs can inspect why each alternative failed.
Proposed Additive Design (Post-#70)
Append a defaulted field to rfl::ErrorDetail:
std::vector<ErrorDetail> causes = {};
Source-compatible: trailing defaulted aggregate member preserves existing ErrorDetail{path, msg} and designated initializers.
Valid C++20:std::vector of an incomplete type is standard since C++17.
Zero allocation when empty: +24B per ErrorDetail (only populated on error paths; OptionalDetails remains null on happy path).
Scope & Sequencing
Fork-only backlog ticket — intentionally deferred until #70 (rfl::ErrorKind on main) and the follow-up ErrorDetail::code (validator rule ID) PR land upstream so the initial structured-error wave stays minimal and easy for liuzicheng1987 to review.
Showcase Migration evidence:osmium-tool#3 (BBoxObject failing Minimum<-180> inside a union truncated the failing field path and ErrorKind).
Throwing Rocks execution: Prototype ErrorDetail::causes on showcase/all-lanes, measure/verify against osmium-tool#3, and run Judges (gemini-4-neon + claude-opus-5-5 high via antigravity delegates) before landing.
Landed on showcase/all-lanes at 2b1fdb9b (62649db6 + 6280453b + 2b1fdb9b), approved by dual independent Judges (claude-opus-5-5 high + gemini-4-neon high, both APPROVE WITH NITS).
Implemented
Appended trailing defaulted std::vector<ErrorDetail> causes = {}; to rfl::ErrorDetail (include/rfl/internal/Error.hpp): source-compatible aggregate/designated initialization, recursive equality + JSON round-trip, zero size growth on sizeof(rfl::Error), and zero allocation on happy paths and leaf errors.
Populated 1-cause-per-alternative structured trees (wrapping multi-detail branches in a branch ErrorDetail without flattening) in:
include/rfl/parsing/ParserVariant.hpp (lazy std::vector<Error> collection; zero copies/allocations when an alternative matches)
Activity
clockblocker commentedon Nov 27, 2026
Tracked as a Lane 5 Wayfinder prototype ticket under Map (Lane 5): Structured Diagnostics.
osmium-tool#3(BBoxObjectfailingMinimum<-180>inside a union truncated the failing field path andErrorKind).ErrorDetail::causesonshowcase/all-lanes, measure/verify againstosmium-tool#3, and run Judges (gemini-4-neon+claude-opus-5-5high viaantigravitydelegates) before landing.feat(#102,#74): add rfl::Nullable<T>, rfl::TriState<T>, rfl::AddNullF…
fix(#102,#74): address dual-Judge blockers (per-branch causes groupin…
chore(#102,#74): polish Judge nits (validator_code per-detail prefix,…
clockblocker commentedon Nov 27, 2026
Landed on
showcase/all-lanesat2b1fdb9b(62649db6+6280453b+2b1fdb9b), approved by dual independent Judges (claude-opus-5-5high +gemini-4-neonhigh, bothAPPROVE WITH NITS).Implemented
std::vector<ErrorDetail> causes = {};torfl::ErrorDetail(include/rfl/internal/Error.hpp): source-compatible aggregate/designated initialization, recursive equality + JSON round-trip, zero size growth onsizeof(rfl::Error), and zero allocation on happy paths and leaf errors.ErrorDetailwithout flattening) in:include/rfl/parsing/ParserVariant.hpp(lazystd::vector<Error>collection; zero copies/allocations when an alternative matches)include/rfl/parsing/ParserRflVariant.hppinclude/rfl/AnyOf.hpp(with custom-validatorkind/codenormalization)include/rfl/internal/validator_code.hpp(compose_prefixed_validator_errorpreserves nestedcausesforSize<AnyOf<...>>andCodePoints<AnyOf<...>>).tests/json/test_error_causes.cpp(includingosmium-tool#3-styleBBoxArray | BBoxObjectunion with single and multi-field failures, nested variants,AnyOf+Size<AnyOf>, andErrorDetailJSON round-trip) — 1,106/1,106 CTests passing, 0 warnings.