NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
validator.h
Go to the documentation of this file.
1
21#pragma once
22
23#include <neograph/api.h>
25
26#include <cstddef>
27#include <map>
28#include <set>
29#include <string>
30#include <utility>
31#include <vector>
32
33namespace neograph::graph {
34
35class GraphRegistry;
36
39struct Diagnostic {
40 std::string code;
41 std::string severity;
42 std::string path;
43 std::string message;
44 json witness;
45 std::string json_pointer;
46};
47
48struct NEOGRAPH_API ValidationReport {
49 std::vector<Diagnostic> diagnostics;
50
51 bool has_errors() const;
52 std::vector<const Diagnostic*> errors() const;
53 std::vector<const Diagnostic*> warnings() const;
55 std::string summary() const;
56};
57
65class NEOGRAPH_API ValidatedTopology {
66public:
67 const TopologySpec& topology() const noexcept { return topology_; }
68 const ValidationReport& report() const noexcept { return report_; }
69 TopologySpec release() && { return std::move(topology_); }
70
71private:
72 friend class GraphValidator;
73
74 ValidatedTopology(TopologySpec topology, ValidationReport report)
75 : topology_(std::move(topology)), report_(std::move(report)) {}
76
77 TopologySpec topology_;
78 ValidationReport report_;
79};
80
93 bool original_rules = false;
96 bool require_acyclic = false;
104 bool soundness_check = false;
106 std::size_t soundness_state_cap = 100000;
107};
108
109class NEOGRAPH_API GraphValidator {
110public:
112 static ValidationReport validate(const TopologySpec& topology);
113
115 static ValidationReport validate(const TopologySpec& topology, const GraphRegistry& registry);
116
118 static ValidationReport validate_local(const TopologySpec& topology,
119 const GraphRegistry& registry);
120
122 static ValidationReport validate(const TopologySpec& topology,
123 const GraphRegistry& registry,
124 const ValidationOptions& options);
125
127 static ValidationReport validate_local(const TopologySpec& topology,
128 const GraphRegistry& registry,
129 const ValidationOptions& options);
130
134 static ValidatedTopology require_valid(TopologySpec topology);
135
137 static ValidatedTopology require_valid(TopologySpec topology, const GraphRegistry& registry);
138
140 static ValidatedTopology require_valid_local(TopologySpec topology,
141 const GraphRegistry& registry);
142
212 static ValidationReport validate(const CompiledGraph& cg);
213
215 static ValidationReport validate(const CompiledGraph& cg, const GraphRegistry& registry);
216
218 static ValidationReport validate_local(const CompiledGraph& cg, const GraphRegistry& registry);
219
221 static ValidationReport validate(const CompiledGraph& cg,
222 const GraphRegistry& registry,
223 const ValidationOptions& options);
224
233 static std::map<std::string, std::set<std::string>> routed_successors(
234 const TopologySpec& topology);
235};
236
237} // namespace neograph::graph
NEOGRAPH_API export/import macro for shared-library builds.
Engine-owned registry of custom graph callables.
Definition registry.h:21
Topology proven free of static semantic errors.
Definition validator.h:65
JSON → declarative topology parsing and runtime node linking.
Parsed graph definition, ready for the engine to run.
Definition compiler.h:185
One static-analysis finding, with a machine-readable witness (counterexample) for tooling to highligh...
Definition validator.h:39
std::string json_pointer
RFC 6901 pointer; empty means document root.
Definition validator.h:45
std::string path
Legacy JSON-ish display path.
Definition validator.h:42
std::string message
human-readable, self-contained
Definition validator.h:43
std::string severity
"error" | "warning" | "note" (the soundness summary only)
Definition validator.h:41
json witness
machine-readable counterexample
Definition validator.h:44
std::string code
"E3".."E18", "S1".."S5", "SOUNDNESS"
Definition validator.h:40
Declarative graph topology with no live node instances or runtime state.
Definition compiler.h:128
Rule selection for GraphValidator.
Definition validator.h:84
std::size_t soundness_state_cap
States the soundness check visits at most before it reports "not checked".
Definition validator.h:106
bool original_rules
Apply only the rules Program bundles have sealed since bundle format v1.
Definition validator.h:93
bool require_acyclic
Report every cycle in the routed graph as an E16 error, for hosts that need a DAG (plans,...
Definition validator.h:96
bool soundness_check
Opt-in soundness check (X3) of a topology without errors: explore every run the routes allow and repo...
Definition validator.h:104