Repository navigation
YAML recursive alias guard and rfl::SourceLocation on ErrorDetail - #42
Closed
clockblocker wants to merge 2 commits into
Closed
clockblocker wants to merge 2 commits into
clockblocker wants to merge 2 commits into
Conversation
This was referenced Nov 25, 2026
clockblocker
changed the base branch from
yaml-recursive-alias-guard
to
main
November 25, 2026 11:28
clockblocker
force-pushed
the
yaml-error-source-locations
branch
from
November 25, 2026 11:39
fdea5d6 to
a7e7ccd
Compare
clockblocker
force-pushed
the
yaml-error-source-locations
branch
from
November 25, 2026 12:06
a7e7ccd to
3e01422
Compare
clockblocker
force-pushed
the
yaml-error-source-locations
branch
from
November 25, 2026 12:08
3e01422 to
5013acd
Compare
…iteral marks Track ancestor YAML nodes via a thread-local RAII guard (ActiveNodeGuard in src/rfl/yaml/Reader.cpp) across read_object and read_array so cyclic YAML aliases return an rfl::Error instead of overflowing the stack, while keeping const Reader instances thread-safe and allowing non-cyclic (DAG) alias reuse. Also bounds-check YAML::Mark::pos before indexing yaml_str_ when trimming trailing newlines on literal block scalars.
…in YAML
Extend rfl::ErrorDetail with an optional rfl::SourceLocation{line, column, exact}
(1-based), filled in by readers that provide source_location(...) and left
std::nullopt by other readers with zero hot-path overhead.
attach_source_location() short-circuits via Error::has_all_source_locations()
so unwinding deeply nested errors does not allocate or copy once leaf locations
are populated. Wrapping preserves leaf locations and Error::what() stays
unchanged.
clockblocker
force-pushed
the
yaml-error-source-locations
branch
from
November 25, 2026 12:10
5013acd to
cbc8ed8
Compare
clockblocker
force-pushed
the
wave-base-12
branch
from
November 25, 2026 12:10
039bcff to
bd1fdbe
Compare
Owner
Author
|
Branch is preserved on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of 4 (split from #40). Contains 2 semantic commits:
b1dc17c0— Guardrfl::yaml::Readeragainst recursive aliases and out-of-bounds literal marksReader::ActiveNodeGuardinsrc/rfl/yaml/Reader.cpp) used byread_objectandread_arrayso cyclic YAML aliases return anrfl::Errorinstead of overflowing the stack, while keepingconst rfl::yaml::Readerthread-safe and allowing non-cyclic (DAG) alias reuse.YAML::Mark::posbefore indexingyaml_str_when trimming trailing newlines on literal block scalars.tests/yaml/test_recursive_alias.cpp.a7e7ccde— Add optionalrfl::SourceLocationtorfl::ErrorDetailand populate it in YAMLrfl::ErrorDetailwithstd::optional<rfl::SourceLocation> location = std::nullopt(line,column,exact, 1-based), re-exported frominclude/rfl/Result.hpp.source_location(...)viaif constexpr (requires { ... }), leaving non-location formats (JSON, binary, etc.) untouched with zero hot-path overhead.attach_source_location()viaError::has_all_source_locations()to avoid O(depth) copies/allocations during deep error unwinding.Error::what()verbatim and documents bothSourceLocationand recursive alias rejection indocs/content/result.mdanddocs/content/supported_formats/yaml.md.tests/yaml/test_error_details.cpp.Verification
-DREFLECTCPP_BUILD_SHARED=ON -DREFLECTCPP_JSON=ON -DREFLECTCPP_YAML=ON -DREFLECTCPP_STRICT_WARNINGS=ONwith-fvisibility=hidden): 631/631 passed, plus C++20/C++23 (-DREFLECTCPP_USE_STD_EXPECTED) self-contained header checks.