Repository navigation
refactor(vdef): extract resolver with full coverage and browser tests - #8483
somethingwithproof wants to merge 6 commits into
Conversation
8b8b831 to
79ae508
Compare
694f8ac to
cf7dfc4
Compare
03cecde to
cb269cf
Compare
28a3946 to
9215e52
Compare
d4a0fd3 to
5f0afa1
Compare
TheWitness
left a comment
There was a problem hiding this comment.
I want to review with the team. Can these be defined using use and namespaces as opposed to requiring? Not sure it makes much of a difference here anyway. The other question is did we go far enough here?
5f0afa1 to
77668e2
Compare
Done in e214316.
Each VDEF item is still looked up through |
8992f2d to
f8e13d7
Compare
f8e13d7 to
55f67ad
Compare
55f67ad to
c41313a
Compare
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Imported vdef_items rows are stored as given, so a type 5 item can name its own VDEF or form a cycle. VdefResolver followed such references until the stack was exhausted. Track the reference chain, cap nesting depth and total expansions like the CDEF resolver, log the reason and resolve the definition to ''. Also drop the unneeded PSR-4 entry from composer.json (every entry point loads lib/Vdef with require_once), add PHPDoc to the new classes and record the duplicate id field fix in a changelog fragment. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The changed-coverage job only reads probes from run_pr_change_tests.sh, so lib/Vdef and lib/vdef.php reported "instrumented: false" even though the dedicated VDEF job covers every line. Run the VDEF suite there too, with FixtureCoverage prepended to write the Xdebug report. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Register Cacti\Vdef in the PSR-4 map, as Cacti\Auth and Cacti\Console already are, and import the classes with use statements instead of require_once. lib/vdef.php still loads without Composer; the classes are resolved only when get_vdef() runs, which every caller reaches after include/global.php has registered the autoloader. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…the CDEF ones between them lets both PRs merge in either order. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
c41313a to
219d05a
Compare
|



Extract VDEF expression assembly into an injectable resolver and repository while retaining the public functions, display spacing, item ordering, nested definitions, and live function dictionary. Keep legacy item lookup at the adapter boundary to preserve its existing result and error contracts. No persistent cache or new dependency is introduced.
Real-browser testing also found that the VDEF editor renders the hidden id twice, causing creation to submit an array that validation rejects. Remove the redundant field and cover creating a definition and item through the public form.
Validation:
Targets develop (Cacti 1.3). Existing callers continue to use the same public functions.
Fixes #8879.