We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation.
Created attachment 161249 [details] [review] Bug 35836: Search for loops in dependencies. We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
Created attachment 161307 [details] [review] Bug 35836: Search for loops in dependencies. We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Created attachment 161351 [details] [review] Bug 35836: Search for loops in dependencies. We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
I have just change the author.
WARN misc/maintenance/search_for_data_inconsistencies.pl WARN tidiness The file is less tidy than before (bad/messy lines before: 83, now: 94)
were I can know which lines are bad ?
Created attachment 161836 [details] [review] Bug 35836 - search_for_data_inconsistencies.pl - Search for loops in dependencies. We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
Created attachment 161837 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies - test tidiness1
Created attachment 161838 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies - test tidiness2
Created attachment 161839 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
Created attachment 161840 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies
Created attachment 161841 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies
Created attachment 161842 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
Created attachment 161843 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies
Created attachment 161844 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies
Should both of these patches be active? https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=161843 https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=161844 It's late on a Friday so my eyes might be deceiving me, but it looks like to me like the second one undoes the change from the first?
euhh yes it's true I know this is not good but it's because if I don't make this tricks the qa1 test doesn't pass and I don't understand why because is the same code. The qa1 test doesn't pass for attach 1 but pass for the attach 3 but this is the same code. If you have a solution ?
(In reply to Matthias Le Gac from comment #17) > If you have a solution ? Sorry, not really. Have you tried squashing the three patches into one?
yes I already try this but I got a error with qa1 test but I will try again
I tried qa1 before to squash and I have no error but after squash I have this error : WARN tidiness The file is less tidy than before (bad/messy lines before: 83, now: 95) but I don't understand why because the code is the same
Created attachment 162284 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies - test tidiness We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
The tidiness test on qa1 triggers a warning. I can't seem to understand where the tidiness issues are, especially since, as explained above, the same code passes the test and then fails. Could someone help me?
Created attachment 162341 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies - fixed tidiness
I found the script to fixed tidiness issues now the patch pass qa1 test
Created attachment 162344 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies
Created attachment 163368 [details] [review] Bug 35836: change | by , for the print We have guarantors who guarantee individuals who are, in turn, their guarantors. It is not clear if this should be allowed (bz35421), but it works, and has been working for a while. However, it breaks with bz12532, which produces a recursion that disrupts everything. Creation of a code in search_for_data_inconsistencies.pl that identifies loops in borrower_relationships. This must work in both directions for validation. This is the first bz I've made. Here's the test plan, let me know if there's anything to improve. Test Plan: 1 - Apply the patch. 2 - Create 4 different adult users. 3 - In the terminal, navigate to the database. 4 - Insert relationships into the "borrower_relationships" table: - Example: INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (1, 52, 53, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (2, 53, 54, 'father'); INSERT INTO borrower_relationships (id, guarantor_id, guarantee_id, relationship) VALUES (3, 54, 52, 'father'); - Ensure that the relationships created form a loop of guarantors. 5 - In the terminal, navigate to your Koha environment's git repository. 6 - Change directory to "cd misc/maintenance." 7 - Run the script to detect guarantor loops: ./search_for_data_inconsistencies.pl 8 - Verify that the output provides the borrower IDs involved in the guarantor loop. *Have fun creating intricate relationships to test the script's limit
Created attachment 164817 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Created attachment 164818 [details] [review] Bug 35836: change | by , for the print Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Created attachment 166751 [details] [review] Bug 35836: search_for_data_inconsistencies.pl - Search for loops in dependencies Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Philip Orr <philip.orr@lmscloud.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 166752 [details] [review] Bug 35836: change | by , for the print Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Signed-off-by: Philip Orr <philip.orr@lmscloud.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 166825 [details] [review] Bug 35836: (follow-up) optimize the script when searching for guarantors
This is not a bug fix as is I think, but as an addition to a CLI script I still decided to push.
Pushed for 24.05! Well done everyone, thank you!
Wow, you took me by surprise here, I didn't think anything would be pushed for a while. The script works well (discover the loops), but I found out it is ressource intensive in its coding when using it on a huge library. I had put a note to improve it. I'll open a follow-up bz.
(In reply to Blou from comment #34) > Wow, you took me by surprise here, I didn't think anything would be pushed > for a while. > > The script works well (discover the loops), but I found out it is ressource > intensive in its coding when using it on a huge library. I had put a note > to improve it. > > I'll open a follow-up bz. This was marked as a bug (not enh), so I considered it. A follow-up would be good. Maybe it could be optional with a warn if that is a possible 'quicker' fix? I expect no string changes here, so we can still take a follow-up into account.
Ok, seems Hammat already worked his magic, I hadn't noticed he had done the fixes. It seems all good from my pov.
Not backported to 23.11.x