Commit a4298f6
DI: normalize Windows backslashes in CodeTracker suffix-stripping loops
The DEBUG-5111 Windows path fix was incomplete: Utils.path_matches_suffix?
normalizes backslashes internally, but CodeTracker#iseqs_for_path_suffix
and #resolve_path_suffix have their own suffix-shortening loops that check
working_suffix.include?('/') and strip via %r{.*/+}. When the probe path
contains only backslashes (e.g. shared\rails\app\foo.rb sent by IDE tooling
on Windows), the loop's '/' check is false, so the stripping never fires.
With no stripping, only the full suffix is tested against registry paths;
the typical Linux deployment doesn't have the source-repo prefix
(shared/rails/) in its filesystem paths, so the match fails and the probe
stays at RECEIVED instead of progressing to INSTALLED.
Surfaced via the system test test_probe_status_log_line_with_windows_path
in DataDog/system-tests, which sends sourceFile with backslashes against a
Rails weblog whose runtime paths lack the shared/rails/ prefix.
Fix: normalize backslashes upfront in both functions before the stripping
loop, mirroring the pattern Utils.path_can_match_spec? already uses.
Spec coverage in spec/datadog/di/code_tracker_spec.rb covers:
- Windows-style probe path with prefix stripping required (the failing case)
- Windows-style + uppercase, exercising both backslash normalization and
the case-insensitive fallback
- Absolute Windows-style path
Verified: 3 new specs pass; full code_tracker_spec/utils_spec/instrumenter_spec/
probe_spec suite (203 examples) passes; standardrb clean; steep clean.
Co-Authored-By: Claude <[email protected]>1 parent 36584cf commit a4298f6
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
252 | 257 | | |
253 | 258 | | |
254 | 259 | | |
| |||
371 | 376 | | |
372 | 377 | | |
373 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
374 | 384 | | |
375 | 385 | | |
376 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
655 | 693 | | |
656 | 694 | | |
657 | 695 | | |
| |||
0 commit comments