There are two issues here: 1) The tool suggests you can limit by library and checkout date but in fact, the library is not the patrons' library but the library the items were issued at. This is not clear from the UI. 2) When it comes to the actual anonymisation, although we've got a filtered list of Patrons by issues before X and at Library, we then delete ALL issues before X by any of the Patrons selected by the previous query, regardless of which library the checkout took place and thus we ignore the selected Library.
I think the feature should allow the Patron selection (for deletion or anonymization) in a first step (and filtering by branch should be te patrons home branch, not where the issues happened) and then proceed to a second step where you can select whether all issues (before the previously selected date) are anonymised regardless of checkout branch or whether the issues should be limited to the selected branch.. I'm not even sure if/when the second step would ever be required?
The two issues reported here are still valid in 24.11 and cause confusion for libraries. We have an instance of the circulation history across a system being anonymised in error because it appears that the 'Select a library' filter at the top of the screen will also apply to anonymisation. At the least it would be good to have a clear message on the screen explaining how the tools interact. In the Koha manual there is an important note related to this tool "It is recommended that you backup your database before using this tool. Changes made here are permanent.". Something along those lines might also be useful?