Enhance matching module with reference identity and caching improvements

- Introduced a new `RefIdentity` type to store reference details (name and className) in the matching process.
- Updated `VCache` and `SCache` structures to include references, improving the handling of reference comparisons during matching.
- Modified `cacheVirtual` and `cacheStudio` functions to support reference caching, enhancing performance and accuracy in matching.
- Improved `countOwnDiffs` function to account for reference mismatches, ensuring more precise cost calculations.
- Added comprehensive tests to validate the new reference handling and caching mechanisms.

These changes significantly enhance the efficiency and accuracy of the matching process in the application.
This commit is contained in:
Joe 2026-02-18 06:16:33 -06:00
parent bf4aef6e94
commit b687c8862d
12 changed files with 1401 additions and 61 deletions

View file

@ -5,7 +5,7 @@ use tempfile::tempdir;
use crate::rojo_test::{
internable::InternAndRedact,
serve_util::{run_serve_test, serialize_to_xml_model},
serve_util::{run_serve_test, serialize_to_xml_model, TestServeSession},
};
use librojo::web_api::SocketPacketType;
@ -961,6 +961,24 @@ fn ref_path_nonexistent_target_no_crash() {
});
}
/// When a non-default project file is used (e.g. `named.project.json5`
/// instead of `default.project.json5`), tree validation must snapshot
/// through the project middleware — not walk the parent directory as a
/// generic Folder. Regression test for a bug where `check_tree_freshness`
/// and `reconcile_tree` used `folder_location()` instead of the project
/// file path, causing the entire repo root to be walked (including
/// unrelated directories with potentially malformed files).
#[test]
fn non_default_project_file_tree_validation() {
let _ = env_logger::try_init();
let mut session =
TestServeSession::new_with_project_file("non_default_project", "named.project.json5");
let _info = session.wait_to_come_online();
session.assert_tree_fresh();
}
/// Multiple Rojo_Ref_* attributes on the same instance should all resolve.
#[test]
fn ref_path_multiple_attributes() {