fix: only count user-code frames toward max_stack_depth#513
fix: only count user-code frames toward max_stack_depth#513irajaryan wants to merge 1 commit intoboxed:mainfrom
Conversation
|
Thanks for the PR, I didn't see it and worked on this simultaneously together with some other changes in #514 . There I decided to only include stack frames part of the
That's something I did not think about in my implementation. Resolving symlinks could indeed be necessary. |
Ah, didn't see #514, looks like a much bigger cleanup and I think filtering against source_paths is the right call (it correctly excludes test files, which my approach doesn't). Happy to close this in favor of #514. Let me know if I need to open a follow-up PR with just the realpath fix once #514 lands, or if you'd prefer to fold it into #514 directly. The relevant bit is small. |
Closes #378.
record_trampoline_hitpreviously decremented themax_stack_depthbudget for every frame walked, including its own frame, the injected_mutmut_trampoline, and any third-party / stdlib frames. This meant a configured value of N didn't correspond to anything a user could reason about.This change only counts frames whose file lives under the
mutants/working directory and whose function name is not_mutmut_trampoline.os.path.realpathis used so the comparison works on macOS where/varis a symlink to/private/var.The e2e
configproject'smax_stack_depthis updated from 8 to 5 to keep the same coverage pattern under the new counting; the snapshot is unchanged.Six unit tests cover: budget disabled, within/over budget, third-party frames excluded, trampoline frames excluded, and the existing test-runner heuristic preserved.