@@ -242,14 +242,16 @@ root = "."
242242}
243243
244244// ============================================================================
245- // SCENARIO 7: Renamed Dependencies (Hard Blocker )
245+ // SCENARIO 7: Renamed Dependencies (Treated Separately )
246246// ============================================================================
247247
248248#[ test]
249249fn test_unify_renamed_dependencies_hard_blocker ( ) -> Result < ( ) > {
250250 let workspace = TestWorkspace :: new ( ) ?;
251251
252252 // Create crates with renamed dependency
253+ // With the bug fix, renamed deps (package = "...") are now properly separated
254+ // from direct deps of the same package. This prevents feature confusion.
253255 workspace. add_crate ( "crate-a" , "0.1.0" , & [ ( "serde" , r#""1.0""# ) ] ) ?;
254256
255257 // Manually create crate-b with renamed serde
@@ -276,37 +278,39 @@ serde_crate = { package = "serde", version = "1.0" }
276278
277279 workspace. commit ( "Add crates with renamed dependency" ) ?;
278280
279- // Configure rail.toml (allow_renamed = false by default)
281+ // Configure rail.toml (include_renamed = false by default)
280282 std:: fs:: write (
281283 workspace. path . join ( "rail.toml" ) ,
282284 r#"[workspace]
283285root = "."
284286
285287[unify]
286- allow_renamed = false
288+ include_renamed = false
287289"# ,
288290 ) ?;
289291
290- // Run analyze - should show Hard blocker
292+ // Run analyze - with the fix, renamed deps are now treated separately
293+ // Since each version of serde (direct vs renamed) only has 1 user,
294+ // neither qualifies for unification (needs 2+ users)
291295 let analyze_output = run_cargo_rail ( & workspace. path , & [ "rail" , "unify" , "--check" ] ) ?;
292296 let analyze_stdout = String :: from_utf8_lossy ( & analyze_output. stdout ) ;
293297
298+ // Should show no unification opportunities since each has only 1 user
294299 assert ! (
295- analyze_stdout. contains( "BLOCKING " ) || analyze_stdout. contains( "Renamed " ) ,
296- "Should show blocking issue for renamed dependency .\n Output:\n {}" ,
300+ analyze_stdout. contains( "No unification opportunities " ) || analyze_stdout. contains( "No dependencies to unify " ) ,
301+ "Should show no unification opportunities when deps are properly separated .\n Output:\n {}" ,
297302 analyze_stdout
298303 ) ;
299304
300- // Run apply - should FAIL
305+ // Run apply - should succeed (no changes needed)
301306 let apply_output = run_cargo_rail ( & workspace. path , & [ "rail" , "unify" ] ) ?;
302307 let apply_stdout = String :: from_utf8_lossy ( & apply_output. stdout ) ;
303- let apply_stderr = String :: from_utf8_lossy ( & apply_output. stderr ) ;
304308
309+ // Should indicate no changes
305310 assert ! (
306- !apply_output. status. success( ) ,
307- "Apply should fail with renamed dependency.\n stdout:\n {}\n stderr:\n {}" ,
308- apply_stdout,
309- apply_stderr
311+ apply_stdout. contains( "No unification opportunities" ) || apply_stdout. contains( "No dependencies to unify" ) ,
312+ "Apply should indicate no changes needed.\n stdout:\n {}" ,
313+ apply_stdout
310314 ) ;
311315
312316 // Check that members were NOT converted to workspace inheritance
@@ -322,7 +326,7 @@ allow_renamed = false
322326 // Should NOT have "serde = { workspace = true }"
323327 assert ! (
324328 !crate_a_member. contains( "serde = { workspace = true }" ) && !crate_a_member. contains( "serde = {workspace=true}" ) ,
325- "crate-a should not use workspace = true for serde (apply failed, so no conversion) .\n crate-a Cargo.toml:\n {}" ,
329+ "crate-a should not use workspace = true for serde.\n crate-a Cargo.toml:\n {}" ,
326330 crate_a_member
327331 ) ;
328332
0 commit comments