Enable leak detector on nplb in CI#10769
Conversation
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
NPLB is no longer leaking symbols, so we can now have CI check for new leaks being introduced in it. This also requires a change to the leak detector to not allow NPLB to "remove" leaks that still need to be fixed in Cobalt. Bug: 477257357
There was a problem hiding this comment.
Code Review
This pull request updates the API leak detector action to also run against the 'nplb' target and modifies the leak detector script to reset the 'removed' leak count when checking non-default targets. A review comment suggests resetting 'removed' using 'type(removed)()' to maintain type consistency and prevent potential type errors.
| if args.target != _DEFAULT_TARGET: | ||
| removed = 0 |
There was a problem hiding this comment.
To maintain type consistency and avoid potential runtime TypeErrors or static analysis issues, it is safer to reset removed to an empty instance of its original type (e.g., if removed is a list or set of symbols rather than an int). Using type(removed)() dynamically creates the correct empty/falsy value regardless of whether removed is an integer, list, or set.
| if args.target != _DEFAULT_TARGET: | |
| removed = 0 | |
| if args.target != _DEFAULT_TARGET: | |
| removed = type(removed)() |
Bug: 477257357