Remove float-cmp dependency and implement custom float comparison logic

- Eliminated the `float-cmp` crate from the project, replacing its functionality with custom float comparison functions that match Lua's epsilon-based equality checks.
- Updated the `variant_eq` function to utilize the new fuzzy equality methods for `Float32` and `Float64` variants, ensuring consistent behavior across Rust and Lua implementations.
- Enhanced the matching algorithms in both forward sync and syncback processes to account for refined scoring of `Ref`, `Tags`, and `Attributes`, improving scoring accuracy and parity between implementations.
- Introduced a new plan document detailing the changes made to the matching algorithms, including the rationale for the updates and the expected impact on performance and correctness.

These changes aim to improve the reliability and maintainability of the matching algorithms while ensuring parity with Lua's behavior.
This commit is contained in:
Joe 2026-02-18 23:57:12 -06:00
parent a283fd1dc9
commit 7e0538b9f5
10 changed files with 1276 additions and 87 deletions

View file

@ -786,10 +786,7 @@ mod tests {
fs::write(dir.path().join("a.luau"), "content a").unwrap();
git_commit_all(dir.path(), "init");
let refs = vec![
"HEAD:a.luau".to_string(),
":0:a.luau".to_string(),
];
let refs = vec!["HEAD:a.luau".to_string(), ":0:a.luau".to_string()];
let results = git_batch_check_hashes(dir.path(), &refs);
assert_eq!(results.len(), 2);
assert!(results[0].is_some());
@ -809,19 +806,13 @@ mod tests {
fs::write(dir.path().join("b.luau"), "staged version").unwrap();
git_stage(dir.path(), "b.luau");
let refs = vec![
"HEAD:b.luau".to_string(),
":0:b.luau".to_string(),
];
let refs = vec!["HEAD:b.luau".to_string(), ":0:b.luau".to_string()];
let results = git_batch_check_hashes(dir.path(), &refs);
assert_eq!(results.len(), 2);
assert!(results[0].is_some());
assert!(results[1].is_some());
assert_ne!(results[0], results[1]);
assert_eq!(
results[0].as_ref().unwrap(),
&compute_blob_sha1("original")
);
assert_eq!(results[0].as_ref().unwrap(), &compute_blob_sha1("original"));
assert_eq!(
results[1].as_ref().unwrap(),
&compute_blob_sha1("staged version")