[Bug 41921] New: Add ability to run reports as background jobs
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Bug ID: 41921 Summary: Add ability to run reports as background jobs Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Reports Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: lisette@bywatersolutions.com It would be nice if reports can as background jobs instead of standard page loads. This would allow long running reports to be viewable from the staff interface. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41920 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41920 [Bug 41920] Limit number of concurrent reports that can be run simultaneously for an instance of Koha -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=14435 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- This one could leverage bug 14435 to save the results as well, yeah? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Mathieu Saby <mathsabypro@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mathsabypro@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #2 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- (In reply to David Cook from comment #1)
This one could leverage bug 14435 to save the results as well, yeah?
Yes! I've incorporated that into my work! I hope to have patches ready soon. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42108 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42108 [Bug 42108] Add ability to specify that a report can only be run as a foreground or background report -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #3 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195480 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195480&action=edit Bug 41921: Add ability to run reports as background jobs Reports should be run as background jobs to prevent reports from the database server causing Koha to go unresponsive. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #4 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195481 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195481&action=edit Bug 41921: Split user permission Splits the execute_reports permission into execute_reports_foreground and execute_reports_background. System preference decides what options are available to use, permissions decide if the user is able to take the allowed action. That is to say, the system preference has precedence over the user permission. If a librarian has the execute_reports_foreground permission, but no the execute_reports_background permission, and the syspref is set to only allow background reports to run, that librarian will not be able to execute reports. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195482 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195482&action=edit Bug 41921: Add Koha::RunningReport(s) Patch from commit 59fd1a6 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195482|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #6 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195483 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195483&action=edit Bug 41921: Add Koha::RunningReport(s) Patch from commit 4f1f469 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195480|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195481|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195483|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #7 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195484 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195484&action=edit Bug 41921: Add ability to run reports as background jobs Reports should be run as background jobs to prevent reports from the database server causing Koha to go unresponsive. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #8 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195485 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195485&action=edit Bug 41921: Split user permission Splits the execute_reports permission into execute_reports_foreground and execute_reports_background. System preference decides what options are available to use, permissions decide if the user is able to take the allowed action. That is to say, the system preference has precedence over the user permission. If a librarian has the execute_reports_foreground permission, but no the execute_reports_background permission, and the syspref is set to only allow background reports to run, that librarian will not be able to execute reports. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #9 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195486 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195486&action=edit Bug 41921: Add Koha::RunningReport(s) Patch from commit a50b446 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I am wondering if this is practical - I think we resend the query quite often, when changing the number of results on a page and when switching between the paginated pages. Could it make sense intstead of tying it to a preference/permission to tie it to the report? Some reports might be quick and the background job could get in the way easily why this might make more sense for other reports. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195484|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195485|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195486|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #11 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195842 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195842&action=edit Bug 41921: Add ability to run reports as background jobs Reports should be run as background jobs to prevent reports from the database server causing Koha to go unresponsive. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #12 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195843 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195843&action=edit Bug 41921: Split user permission Splits the execute_reports permission into execute_reports_foreground and execute_reports_background. System preference decides what options are available to use, permissions decide if the user is able to take the allowed action. That is to say, the system preference has precedence over the user permission. If a librarian has the execute_reports_foreground permission, but no the execute_reports_background permission, and the syspref is set to only allow background reports to run, that librarian will not be able to execute reports. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #13 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 195844 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=195844&action=edit Bug 41921: Add Koha::RunningReport(s) Patch from commit 05b2746 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #14 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to Katrin Fischer from comment #10)
I am wondering if this is practical - I think we resend the query quite often, when changing the number of results on a page and when switching between the paginated pages. Could it make sense intstead of tying it to a preference/permission to tie it to the report? Some reports might be quick and the background job could get in the way easily why this might make more sense for other reports.
When running a report as a background job, it seems we always return all rows on a single page, so there's no re-running while paging through. If the syspref is set to "let the user choose," there's a "run as background job" checkbox each time one runs a report that is checked by default. So if one were running a report multiple times with different parameter selections and didn't want to run them in the background, one would need to uncheck that box each time. That does seem onerous. Maybe there could be an option to set any given report to default to running not as a background job? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #15 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- If I've got ReportsRunInBackground set to Never and have a user with only execute_reports_background permission, they can get to the reports module homepage and are presented with the "Use Saved" link, but get a 403 error when they click it. They should either not get the Use Saved link on the screen at all or get a permissions message when clicking on it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=38414 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42593 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42593 [Bug 42593] Add ability for background reports ( and saved reports ) output to be stored on the filesystem instead of the database -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42596 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42596 [Bug 42596] Add ability for reports APIs ( svc/report, opac/svc/report ) to run reports as background jobs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42642 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42642 [Bug 42642] Move background report jobs to a dedicated queue -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42643 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195842|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195843|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #195844|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #16 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199311 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199311&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #17 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199312 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199312&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #18 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199314 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199314&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #19 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199315 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199315&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #20 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199316 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199316&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #21 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199317&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #22 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199318 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199318&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #23 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199319 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199319&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #24 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199320 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199320&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #25 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199321 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199321&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Patch from commit fb8ad49 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Alex Carver [Acerock7] <alex@rcls.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply CC| |alex@rcls.org --- Comment #26 from Alex Carver [Acerock7] <alex@rcls.org> --- Error: Apply failed: Git command (git am -3 /tmp/bhxfUDZmdj/0001-199311.patch) failed: error: sha1 information is lacking or useless (reports/guided_reports.pl). error: could not build fake ancestor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199311|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199312|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199314|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199315|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199316|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199317|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199318|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199319|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199320|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199321|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #27 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199551 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199551&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #28 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199552 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199552&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #29 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199553 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199553&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #30 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199554&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #31 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199555 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199555&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #32 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199556 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199556&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #33 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199557 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199557&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #34 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199558 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199558&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #35 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199559 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199559&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #36 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199560 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199560&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Patch from commit 20230e9 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42667 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42667 [Bug 42667] Split the ability to edit other librarian's reports into a separate permission -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199551|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199552|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199553|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199554|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199555|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199556|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199557|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199558|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199559|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199560|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #37 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199567 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199567&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #38 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199568 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199568&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #39 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199569 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199569&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #40 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199570 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199570&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #41 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199571 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199571&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #42 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199572 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199572&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #43 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199573 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199573&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #44 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199574 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199574&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #45 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199575 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199575&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #46 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 199576 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199576&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Patch from commit c2019a8 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #47 from David Cook <dcook@prosentient.com.au> --- How long are report results stored? This could be a big problem in terms of data privacy. Adding Katrin in here as she might have some thoughts on that. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42596 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42596 [Bug 42596] Add ability for reports APIs ( svc/report, opac/svc/report ) to run reports as background jobs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #48 from David Nind <david@davidnind.com> --- I managed to work my way through the test plans 8-) A couple of things I have noted: 1. When accessing the standard background jobs page (Administration > Jobs > Manage jobs) you get a browser popup with this error and table sits on "Processing ...": Something went wrong when loading the table 500: Internal Server error. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. .... In the developer tools console I get: GET http://127.0.0.1:8081/api/v1/jobs?only_current=0&_page=1&_per_page=20&_match=contains&_order_by=-me.enqueued_date 500 (Internal Server Error) Got 500 (Internal Server Error) 2. For the "Reports job" page for the "Currently running" section: - There is a "X Clear filter" option which is greyed out, but there is no search box or other controls apart from "Export" - Nothing works for me when entering anything in the column filters. - Filters (search + column) work OK in the "Background jobs" section. Consolidated test plan (so far) =============================== 1. Apply all the patches 2. Update the database: updatedatabase 3. Rebuild things (not sure if it is required): - yarn api:bundle - yarn build 4. DBIC (not sure if it is required): dbic 5. Update koha-conf.xml: - Edit koha-conf.xml: vi /etc/koha/sites/kohadev/koha-conf.xml - Added this after </plugin_repos> (near the end of file but before CSP section): <total_running_reports_per_instance_limit>1</total_running_reports_per_instance_limit> 6. Restart everything: restart_all 7. Tests pass: prove t/db_dependent/Koha/BackgroundJob/RunReport.t t/db_dependent/Koha/Reports.t t/Koha/Auth/Permissions.t t/db_dependent/api/v1/reports_jobs.t 8. Create a report using SQL: select * from biblio 9. Run through the individual test plans for: - Add ability to run reports as background jobs - Add check_limits to guided_reports.pl - Wire check_limits into svc/report and opac/svc/report - Add per-run-type overrides to report concurrency caps - Add a Report jobs dashboard for librarians - Add currently-running reports to the dashboard Add ability to run reports as background jobs ============================================= Check the different settings for the new system preference ReportsRunInBackground: - 'always run as a background job' (always): . Run the report . Confirm a job appears under Administration > Jobs > Manage jobs (admin/background_jobs.pl) with type 'Run report'. . Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. - 'always run in the foreground' (never): . Run the report. . Confirm it executes in the foreground. - 'let the user choose' (user_choice): . Run the report. . Confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. Results: 'always run as a background job' (always) ----------------------------------------- 1. After clicking "Run" action, goes to the "Report jobs" page: . Information message at the top of the page: "Your report has been queued as job #XX. It is highlighted below." . "Currently running" heading with "No reports are running right now" . "Background jobs" heading: lists background jobs with the current job highlighted with an orange border around the table . Clicking "View results" action: gives you the report results 2. When accessing the standard background jobs page (Administration > Jobs > Manage jobs) you get a browser popup with this error and the table sits on "Processing ...": Something went wrong when loading the table 500: Internal Server error. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. Properties not allowed: report_id. .... In the developer tools console I get: GET http://127.0.0.1:8081/api/v1/jobs?only_current=0&_page=1&_per_page=20&_match=contains&_order_by=-me.enqueued_date 500 (Internal Server Error) Got 500 (Internal Server Error) 'always run in the foreground' (never) -------------------------------------- 1. After clicking "Run" action, you get the report results page. 2. When accessing the background jobs page I get the same results as 'always' option 'let the user choose' (user_choice) ----------------------------------- 1. After clicking "Run" action, get: How would you like to run this report? "Run now" "Queue as background job" 2. Run now: report runs 3. Queue as background job: get "Report jobs" page 4. When accessing the background jobs page I get the same results as 'always' and 'never' options. Add check_limits to guided_reports.pl ===================================== 1. Added koha-conf.xml setting earlier, as got errors on the report pages otherwise. 2. Create a new saved report with this SQL: SELECT SLEEP(120) 3. Results from running the report in two different tabs: - First tab: eventually completes - Second tab: you eventually (but not straight away) get this message: The following error was encountered: There are too many total reports running at the moment. Please wait for some of them to finish before running this report again. Return to previous page 4. On the same two tabs using Download > Comma separated text (CSV): - First tab: eventually saves CSV - Second tab: get a page with a white background and "Too many reports are currently running. Please wait for some to finish before running this report." Wire check_limits into svc/report and opac/svc/report ===================================================== 1. Step 4: Make the report public. 2. Results as per the test plan. Add per-run-type overrides to report concurrency caps ===================================================== 1. Edit koha-conf.xml and change and add settings: <total_running_reports_per_instance_limit>5</total_running_reports_per_instance_limit> <foreground_total_running_reports_per_instance_limit>2</foreground_total_running_reports_per_instance_limit> 2. Restart everything: restart_all Add a Report jobs dashboard for librarians =========================================== 1. For the "Cancel" option to come up under "background jobs" section, need to start a couple of reports running. 2. Found it hard to test steps 8 and 9, so skipped. Add currently-running reports to the dashboard ============================================== Works as expected. However, note that for the "Currently running" section: 1. There is a "X Clear filter" option which is greyed out, but there is no search box or other controls apart from "Export" 2. Nothing works for me when entering anything in the column filters. 3. Filters (search + column) work OK in the "Background jobs" section. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #49 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #47)
How long are report results stored?
This could be a big problem in terms of data privacy.
Adding Katrin in here as she might have some thoughts on that.
I haven't inspected these patches in depth, but I'm assuming we're storing the results in the database? That means that people would be able to run SQL reports about SQL report results. We might want to consider storing the results on disk instead and possibly encrypting them on disk as well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #50 from David Nind <david@davidnind.com> --- The third thing to note (I forgot to include in my notes in comment #48): 3. In the reports table, the list of saved reports column is going to get very long after a while. Is there any way to remove these or collapse to only show the last few? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #51 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to David Cook from comment #47)
How long are report results stored?
This could be a big problem in terms of data privacy.
Adding Katrin in here as she might have some thoughts on that.
Saved report results can be deleted by cleanup_database after a given number of days. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #52 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Andrew Fuerste-Henry from comment #51)
(In reply to David Cook from comment #47)
How long are report results stored?
This could be a big problem in terms of data privacy.
Adding Katrin in here as she might have some thoughts on that.
Saved report results can be deleted by cleanup_database after a given number of days.
This cron is not scheduled by default as it's currently not needed if you don't also run reports from cron/command line. Maybe we should add it to the defaults? The table could get really really big pretty fast which is a bit of a risk. I am not sure how it helps the load to run as a background job - it's still the same query. Can someone explain what difference it actually makes on the server side or what the big advantage here is? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #53 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Andrew Fuerste-Henry from comment #51)
(In reply to David Cook from comment #47)
How long are report results stored?
This could be a big problem in terms of data privacy.
Adding Katrin in here as she might have some thoughts on that.
Saved report results can be deleted by cleanup_database after a given number of days.
Oh also: are the results stored in background_jobs or in the table for saved report results? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #54 from David Cook <dcook@prosentient.com.au> --- (In reply to Katrin Fischer from comment #52)
I am not sure how it helps the load to run as a background job - it's still the same query. Can someone explain what difference it actually makes on the server side or what the big advantage here is?
There's a couple advantages that I can think of. If you have a big query/long running report, it might take a long time to run, and if it's synchronous your browser could time out. Also, if you do execute a long running report and then try to page through it, it would likely be slow. Whereas if you're viewing the results, you could page through them fairly quickly I suspect. A pro/con would also be that it captures a moment in time. The pro being that you could run a report and its results would be fixed, so you could rely on that report result again and again. The con would be that it would be stale immediately after running. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #55 from David Cook <dcook@prosentient.com.au> --- What happens if you run the same report multiple times? Do you get multiple results or does it overwrite results? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #56 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to David Cook from comment #54)
(In reply to Katrin Fischer from comment #52)
I am not sure how it helps the load to run as a background job - it's still the same query. Can someone explain what difference it actually makes on the server side or what the big advantage here is?
There's a couple advantages that I can think of.
If you have a big query/long running report, it might take a long time to run, and if it's synchronous your browser could time out.
Also, if you do execute a long running report and then try to page through it, it would likely be slow. Whereas if you're viewing the results, you could page through them fairly quickly I suspect.
A pro/con would also be that it captures a moment in time. The pro being that you could run a report and its results would be fixed, so you could rely on that report result again and again. The con would be that it would be stale immediately after running.
But that means it won't help with the situation where a long running query creates load on the server. The advantage is storing it, so multiple people might use the results from within Koha. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #57 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to Katrin Fischer from comment #56)
But that means it won't help with the situation where a long running query creates load on the server. The advantage is storing it, so multiple people might use the results from within Koha.
Currently we re-run the sql query each time you move between results pages or change how many results are on the page. This would save us from repeating each query so many times. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #58 from David Cook <dcook@prosentient.com.au> --- (In reply to Katrin Fischer from comment #56)
But that means it won't help with the situation where a long running query creates load on the server. The advantage is storing it, so multiple people might use the results from within Koha.
Yes, a long running query will still create load on the server. That said, if we wanted to handle that better, we could create the ability for Koha to use a different database connection to connect to a read-only MySQL instance in a database cluster. Another option is allowing a separate database connection for the same database, but using a user with more limited database permissions. This would actually be useful for a number of security reasons as well, although could lead to reduced report functionality. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #59 from David Cook <dcook@prosentient.com.au> --- I think there's a bug report somewhere for adding max_execution_time which would be valuable as well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #60 from David Nind <david@davidnind.com> --- (In reply to David Cook from comment #59)
I think there's a bug report somewhere for adding max_execution_time which would be valuable as well.
Bug 39164 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42643 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43016 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43016 [Bug 43016] [OMNIBUS] Server resource protection -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43017 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43017 [Bug 43017] [OMNIBUS] Interface optimization -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Michelle Spinney <mspinney@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mspinney@clamsnet.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |blawlor@clamsnet.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply --- Comment #61 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- I get: Error: Apply failed: Git command (git am -3 /tmp/LY9bEjfeu6/0001-199567.patch) failed: error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt). error: could not build fake ancestor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199567|0 |1 is obsolete| | Attachment #199568|0 |1 is obsolete| | Attachment #199569|0 |1 is obsolete| | Attachment #199570|0 |1 is obsolete| | Attachment #199571|0 |1 is obsolete| | Attachment #199572|0 |1 is obsolete| | Attachment #199573|0 |1 is obsolete| | Attachment #199574|0 |1 is obsolete| | Attachment #199575|0 |1 is obsolete| | Attachment #199576|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #62 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203106 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203106&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #63 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203107 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203107&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #64 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203108 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203108&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #65 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203109 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203109&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #66 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203110&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #67 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203111 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203111&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #68 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203112 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203112&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #69 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203113 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203113&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #70 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203114 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203114&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #71 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203115&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Patch from commit 09850a9 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #72 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 203116 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203116&action=edit Bug 41921: (follow-up) Tidy Patch from commit 57c66ef -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Medium patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #73 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- rebased for current main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #74 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to Lucas Gass (lukeg) from comment #67) This is the one bit of this test plan that didn't work for me. When I set that limit in the koha-conf and started one long report running I was still able to get results via the svc URL
3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #75 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Revisiting this in the light of morning, it worked as intended. Setting back to NSO. A note for testing, I do sometimes see a meaningful delay on my KTD between when I click Run on a report and when it actually starts processing in the database. I'm guessing that's what happened here -- I clicked Run on my long report and then loaded up the other report via the svc url before the db had actually started working on my long report. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #76 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Test plans do include testing the new permissions execute_reports_foreground and execute_reports_background. These do not seem to be enforcing correctly. To recreate: - set ReportsRunInBackground to "let the user choose" - log in as a user with execute_reports_foreground but not execute_reports_background - run a report, see you are given both foreground and background options ** we should not present the user with the background option when they don't have the background permission. Ideally, they'd bypass the choice of run method entirely as they only have one option ** - click "Queue background job," not the job enqueues and runs successfully ** in addition to not giving the user the background option, we should block the job from enqueueing if they try to sneak it in by entering the url or something ** - reverse your user's permissions so they do have background permissions but do not have foreground permissions - observe they are still able to run foreground reports ** again, we should not present them with a choice of how to run and we should block foreground reports that they attempt to run by some other means ** - set ReportsRunInBackground to "always run in the foreground" - your user still has background permission but not foreground - confirm that they get a Run button and reports run in the foreground when they click it ** if the syspref is set to always foreground, users without foreground permissions should not get a Run button and not be able to run any reports ** - set ReportsRunInBackground to "always run in the background" - edit your user to have foreground permissions but not background - confirm that they get a Run button and reports run in the foreground when they click it ** if the syspref is set to always background, users without background permissions should not get a Run button and not be able to run any reports ** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|kyle@bywatersolutions.com |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_26_11_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |BLOCKED --- Comment #77 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Currently blocked by Bug 42667 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #78 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206544 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206544&action=edit Bug 43237: (follow-up) Adding [% PROCESS 'i18n.inc' %] to two templates which lack it Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #203106|0 |1 is obsolete| | Attachment #203107|0 |1 is obsolete| | Attachment #203108|0 |1 is obsolete| | Attachment #203109|0 |1 is obsolete| | Attachment #203110|0 |1 is obsolete| | Attachment #203111|0 |1 is obsolete| | Attachment #203112|0 |1 is obsolete| | Attachment #203113|0 |1 is obsolete| | Attachment #203114|0 |1 is obsolete| | Attachment #203115|0 |1 is obsolete| | Attachment #203116|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #79 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206545 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206545&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #80 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206546 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206546&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #81 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206547 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206547&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #82 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206548 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206548&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #83 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206549 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206549&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #84 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206550 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206550&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #85 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206551 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206551&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #86 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206552 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206552&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #87 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206553 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206553&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #88 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206554&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Patch from commit 8e1ecb1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #89 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206555 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206555&action=edit Bug 41921: (follow-up) Tidy Patch from commit 89c1abd -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206544|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Signed Off --- Comment #90 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Rebased for current main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff --- Comment #91 from Lisette Scheer <lisette@bywatersolutions.com> --- was fqa before patch didn't apply, setting to needs sign off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #92 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Lisette Scheer from comment #91)
was fqa before patch didn't apply, setting to needs sign off
thank you, my mistake. This was never signed-off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #93 from Lisette Scheer <lisette@bywatersolutions.com> --- (In reply to Andrew Fuerste-Henry from comment #76) Good point, these are the comments from when it was FQA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #94 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206758 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206758&action=edit Bug 41921: (follow-up) Enforce permissions for background/foreground running on guided_reports_start.tt Note: tidy is doing a lot here. please use 'git diff -w' to see my changes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #95 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Andrew Fuerste-Henry from comment #76)
Test plans do include testing the new permissions execute_reports_foreground and execute_reports_background. These do not seem to be enforcing correctly.
To recreate: - set ReportsRunInBackground to "let the user choose" - log in as a user with execute_reports_foreground but not execute_reports_background - run a report, see you are given both foreground and background options ** we should not present the user with the background option when they don't have the background permission. Ideally, they'd bypass the choice of run method entirely as they only have one option ** - click "Queue background job," not the job enqueues and runs successfully ** in addition to not giving the user the background option, we should block the job from enqueueing if they try to sneak it in by entering the url or something **
- reverse your user's permissions so they do have background permissions but do not have foreground permissions - observe they are still able to run foreground reports ** again, we should not present them with a choice of how to run and we should block foreground reports that they attempt to run by some other means **
- set ReportsRunInBackground to "always run in the foreground" - your user still has background permission but not foreground - confirm that they get a Run button and reports run in the foreground when they click it ** if the syspref is set to always foreground, users without foreground permissions should not get a Run button and not be able to run any reports **
- set ReportsRunInBackground to "always run in the background" - edit your user to have foreground permissions but not background - confirm that they get a Run button and reports run in the foreground when they click it ** if the syspref is set to always background, users without background permissions should not get a Run button and not be able to run any reports **
I should have read this all before supplying a patch. Maybe we need a subroutine to work out who can run a report based on the sys pref + the permissions. Then we could cover with unit test also -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #96 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to Lucas Gass (lukeg) from comment #95)
I should have read this all before supplying a patch. Maybe we need a subroutine to work out who can run a report based on the sys pref + the permissions. Then we could cover with unit test also
Subroutine + unit tests makes sense to me. It's some complicated interaction of who can do what, so tests to make sure it remains functional seem like a good idea. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206758|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #97 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206764 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206764&action=edit Bug 41921: (follow-up) Enforce permissions and system pref for background/foreground running Note: tidy is doing a lot here. please use 'git diff -w' to see my changes -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #98 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 206765 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206765&action=edit Bug 41921: Add a unit test for can_run_foreground_background Patch from commit 21bafb0 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #99 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- updated test plan: Test plan 1) Apply patch, updatedatabase, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), note its id 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the "Currently running" table 8) Refresh the view with the refresh button, note the data changes 9) Let the foreground report finish 10) Confirm the row disappears from the "Currently running" table on the next refresh 11) Run the same report as a background job 12) Confirm the row appears again with a Type of "background" while the worker is executing 13) Confirm the row disappears from the "Currently running" table once the worker has finished executing 14) Create a staff user with catalogue, reports > create_reports and reports > execute_reports_foreground only, and log in as them in a private window 15) Set ReportsRunInBackground to "let the user choose" 16) As the foreground-only user, run the report - Confirm you are NOT shown the "How would you like to run this report?" choice, and the report runs straight away in the foreground 17) Visit /cgi-bin/koha/reports/guided_reports.pl?op=run&id=<id>&run_in_background_chosen=1&run_in_background=1 - Confirm no background job is enqueued (check /cgi-bin/koha/admin/background_jobs.pl) 18) Change the user to have execute_reports_background but NOT execute_reports_foreground 19) Run the report - Confirm you are NOT shown the choice, and the report is queued as a background job 20) Visit /cgi-bin/koha/reports/guided_reports.pl?op=run&id=<id>&run_in_background_chosen=1&run_in_background=0 - Confirm you get a permission error and the report does not run in the foreground 21) Visit /cgi-bin/koha/reports/guided_reports.pl?op=export&id=<id>&format=csv - Confirm you get a permission error 22) Give the user both execute_reports_foreground and execute_reports_background 23) Run the report - Confirm you ARE shown the choice, and both "Run now" and "Queue as background job" work 24) Set ReportsRunInBackground to "always run in the foreground" 25) Change the user to have execute_reports_background but NOT execute_reports_foreground 26) Go to Reports > Saved reports, and to the report's view page - Confirm there is no Run button (the saved reports list shows "View" instead) 27) Visit /cgi-bin/koha/reports/guided_reports.pl?op=run&id=<id> - Confirm you get a permission error 28) Set ReportsRunInBackground to "always run in the background" 29) Change the user to have execute_reports_foreground but NOT execute_reports_background 30) Go to Reports > Saved reports, and to the report's view page - Confirm there is no Run button 31) Visit /cgi-bin/koha/reports/guided_reports.pl?op=run&id=<id> - Confirm you get a permission error 32) Change the user to have execute_reports_background 33) Run the report - Confirm there is no choice and the report is queued as a background job 34) Log in as a superlibrarian and repeat 15, 24 and 28 - "let the user choose": both options offered - "always run in the foreground": runs in the foreground, no choice - "always run in the background": queued as a background job, no choice -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zoho.roboto@bywatersolution | |s.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206545|0 |1 is obsolete| | Attachment #206546|0 |1 is obsolete| | Attachment #206547|0 |1 is obsolete| | Attachment #206548|0 |1 is obsolete| | Attachment #206549|0 |1 is obsolete| | Attachment #206550|0 |1 is obsolete| | Attachment #206551|0 |1 is obsolete| | Attachment #206552|0 |1 is obsolete| | Attachment #206553|0 |1 is obsolete| | Attachment #206554|0 |1 is obsolete| | Attachment #206555|0 |1 is obsolete| | Attachment #206764|0 |1 is obsolete| | Attachment #206765|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #100 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206911&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #101 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206912&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #102 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206913 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206913&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #103 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206914 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206914&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #104 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206915 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206915&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #105 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206916 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206916&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #106 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206917 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206917&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #107 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206918 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206918&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #108 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206919 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206919&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #109 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206920 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206920&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #110 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206921 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206921&action=edit Bug 41921: (follow-up) Tidy Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #111 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206922 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206922&action=edit Bug 41921: (follow-up) Enforce permissions and system pref for background/foreground running Note: tidy is doing a lot here. please use 'git diff -w' to see my changes Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #112 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 206923 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206923&action=edit Bug 41921: Add a unit test for can_run_foreground_background Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |blawlor@clamsnet.org |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #113 from Brendan Lawlor <blawlor@clamsnet.org> --- This is a really cool new feature and the test plan works as described. I used Claude Code Opus 5.5 to help test and confirmed a few blockers through manual human testing. 1. The new jobs page is vulnerable to cross-site scripting because it passes the raw url parameter to the template and into the javascript To replicate: As superlibrarian open a link like http://localhost:8081/cgi-bin/koha/reports/jobs.pl?new_job_id=document.title... Confirm the title of the page has been changed to 1337 View source, search for new_job_id and confirm the parameter was injected into the script Fix in jobs.pl by only accepting an integer: my $new_job_id = $input->param('new_job_id'); $template->param( new_job_id => $new_job_id ) if defined $new_job_id && $new_job_id =~ /^\d+$/; 2. svc/convert_report still requires the old execute_reports permission To replicate: Create a report with outdated SQL but don’t run it yet SELECT biblionumber, ExtractValue(marcxml, '//datafield[@tag="245"]/subfield[@code="a"]') AS title FROM biblioitems With a user that does not have the top level reports permission but has execute_reports_foreground and execute_reports_background Go to the list of reports Click on the Update SQL button Confirm the modal shows a login form with Error: You do not have permission to access this page. Fix in svc/convert_report by allowing either of the new permissions: flagsrequired => { reports => [ 'execute_reports_foreground', 'execute_reports_background' ] 3. Stored results skip the report library limits To replicate: Enable LimitReportsByLibrary Create a report named CPL Only, with Library limitation Centerville select * from items where homebranch = ‘CPL’ Run it once so that there are saved results Login as a user from another home library with one of execute_reports_background or execute_reports_foreground They can view the report jobs page and click on the View results button they can then see the results of a report that they are not allowed to run. Jobs should be hidden for reports that they can’t run. They also should get a permission error if they try to change the id to a report they can’t run in a url like /reports/guided_reports.pl?op=view_stored_results&id=<not_my_report_id> guided_reports.pl doesn't respect Libray limitations when op=view_stored results, but it should. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #114 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207435 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207435&action=edit Bug 41921: (follow-up) Make sure jobs.pl new_job_id only takes integer -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #115 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207436 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207436&action=edit Bug 41921: (follow-up) Make sure svc/convert uses the new permissions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #116 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- That's 2/3 blockers. The other one seems less trivial and I hope to work on it tomorrow. Thanks Brendan! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207436|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #117 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207487 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207487&action=edit Bug 41921: (follow-up) Make sure svc/convert uses the new permissions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #118 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207488 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207488&action=edit Bug 41921: (follow-up) Don't render reports that a staff cant view based on LimitReportsByLibrary -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #119 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Other problems Brendan pointed out to me: 4. Failed background reports show no error on the admin background jobs page. - Where: includes/background_jobs/run_report.inc:23 - Why: the include loops over m.error.pairs, which expects a hash with keys like sqlerr and queryerr. RunReport::process stores error as a plain string with codes like execute_error and report_not_found, so the failure details never appear. 5. "Run with template" loses the template. - The "how would you like to run this report?" form (choose_run_mode in guided_reports_start.tt) has no hidden template_code field. A user with both permissions who picks a template ends up with a plain run. - The background path ignores template_code entirely: enqueue only passes the report id and parameters. 6. Old limit-handling code is now dead. - prep_report no longer throws DuplicateRunning, TotalRunning or InstanceTotalRunning, but guided_reports.pl (around lines 805 and 1218), svc/report and opac/svc/report still catch them. - One branch also still uses the old total_running_reports_limit_exceeded key (guided_reports.pl ~1222). - Either remove these branches and the unused exception classes in Koha/Exceptions/Report.pm, or keep them on purpose. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #120 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207494 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207494&action=edit Bug 41921: Fix error coding in run_report.inc -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #121 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207495 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207495&action=edit Bug 41921: (follow-up) Restore ability to run with template when in choose_run_mode -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #122 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207496 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207496&action=edit Bug 41921: (follow-up) Remove old limit handling code -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Patch doesn't apply --- Comment #123 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Merge errors due to Bug 43736 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #206911|0 |1 is obsolete| | Attachment #206912|0 |1 is obsolete| | Attachment #206913|0 |1 is obsolete| | Attachment #206914|0 |1 is obsolete| | Attachment #206915|0 |1 is obsolete| | Attachment #206916|0 |1 is obsolete| | Attachment #206917|0 |1 is obsolete| | Attachment #206918|0 |1 is obsolete| | Attachment #206919|0 |1 is obsolete| | Attachment #206920|0 |1 is obsolete| | Attachment #206921|0 |1 is obsolete| | Attachment #206922|0 |1 is obsolete| | Attachment #206923|0 |1 is obsolete| | Attachment #207435|0 |1 is obsolete| | Attachment #207487|0 |1 is obsolete| | Attachment #207488|0 |1 is obsolete| | Attachment #207494|0 |1 is obsolete| | Attachment #207495|0 |1 is obsolete| | Attachment #207496|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #124 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207844 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207844&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #125 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207845 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207845&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #126 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207846 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207846&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #127 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207847 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207847&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #128 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207848 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207848&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #129 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207849 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207849&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #130 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207850 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207850&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #131 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207851 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207851&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #132 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207852 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207852&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #133 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207853 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207853&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #134 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207854 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207854&action=edit Bug 41921: (follow-up) Tidy Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #135 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207855 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207855&action=edit Bug 41921: (follow-up) Enforce permissions and system pref for background/foreground running Note: tidy is doing a lot here. please use 'git diff -w' to see my changes Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #136 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207856&action=edit Bug 41921: Add a unit test for can_run_foreground_background Signed-off-by: Rae Schumann <rschumann@utah.gov> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #137 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207857&action=edit Bug 41921: (follow-up) Make sure jobs.pl new_job_id only takes integer -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #138 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207858 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207858&action=edit Bug 41921: (follow-up) Make sure svc/convert uses the new permissions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #139 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207859 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207859&action=edit Bug 41921: (follow-up) Don't render reports that a staff cant view based on LimitReportsByLibrary -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #140 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207860 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207860&action=edit Bug 41921: Fix error coding in run_report.inc -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #141 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207861 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207861&action=edit Bug 41921: (follow-up) Restore ability to run with template when in choose_run_mode -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #142 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207862 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207862&action=edit Bug 41921: (follow-up) Remove old limit handling code -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #143 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 207863 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207863&action=edit Bug 41921: (follow-up) Swap template_code for template_id -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Status|Signed Off |Passed QA Comma delimited| |CLAMS list of Sponsors| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207844|0 |1 is obsolete| | Attachment #207845|0 |1 is obsolete| | Attachment #207846|0 |1 is obsolete| | Attachment #207847|0 |1 is obsolete| | Attachment #207848|0 |1 is obsolete| | Attachment #207849|0 |1 is obsolete| | Attachment #207850|0 |1 is obsolete| | Attachment #207851|0 |1 is obsolete| | Attachment #207852|0 |1 is obsolete| | Attachment #207853|0 |1 is obsolete| | Attachment #207854|0 |1 is obsolete| | Attachment #207855|0 |1 is obsolete| | Attachment #207856|0 |1 is obsolete| | Attachment #207857|0 |1 is obsolete| | Attachment #207858|0 |1 is obsolete| | Attachment #207859|0 |1 is obsolete| | Attachment #207860|0 |1 is obsolete| | Attachment #207861|0 |1 is obsolete| | Attachment #207862|0 |1 is obsolete| | Attachment #207863|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #144 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208019 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208019&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #145 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208020 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208020&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #146 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208021 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208021&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #147 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208022 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208022&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #148 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208023 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208023&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #149 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208024 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208024&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #150 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208025 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208025&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #151 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208026 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208026&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #152 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208027 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208027&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #153 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208028 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208028&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #154 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208029 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208029&action=edit Bug 41921: (follow-up) Tidy Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #155 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208030 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208030&action=edit Bug 41921: (follow-up) Enforce permissions and system pref for background/foreground running Note: tidy is doing a lot here. please use 'git diff -w' to see my changes Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #156 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208031 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208031&action=edit Bug 41921: Add a unit test for can_run_foreground_background Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #157 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208032 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208032&action=edit Bug 41921: (follow-up) Make sure jobs.pl new_job_id only takes integer Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #158 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208033 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208033&action=edit Bug 41921: (follow-up) Make sure svc/convert uses the new permissions Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #159 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208034 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208034&action=edit Bug 41921: (follow-up) Don't render reports that a staff cant view based on LimitReportsByLibrary Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #160 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208035 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208035&action=edit Bug 41921: Fix error coding in run_report.inc Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #161 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208036 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208036&action=edit Bug 41921: (follow-up) Restore ability to run with template when in choose_run_mode Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #162 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208037 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208037&action=edit Bug 41921: (follow-up) Remove old limit handling code Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #163 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208038 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208038&action=edit Bug 41921: (follow-up) Swap template_code for template_id Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #164 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208039 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208039&action=edit Bug 41921: (QA follow-up) Fix report jobs list for deleted reports In Koha::REST::V1::Reports::Jobs::list calling can_access on an undefined report dies, GET /api/v1/reports/jobs returns 500, and the Report jobs dashboard blows up. This patch only checks can_access when the report still exists. Jobs for deleted reports stay in the list, where the dashboard shows them as "(report deleted)". Test plan: 1. Set ReportsRunInBackground to "let the user choose" 2. Go to Reports > Saved reports, run a report and choose "Queue as background job" 3. Wait for the job to finish on the Report jobs page 4. Delete that saved report 5. Go to Reports > Report jobs 6. Note the "Background jobs" table fails to load, and /api/v1/reports/jobs returns 500, an alert pops up 7. Apply patch and restart_all 8. Reload Reports > Report jobs 9. Note the table loads and the job shows "(report deleted)" 10. Run: prove t/db_dependent/api/v1/reports_jobs.t Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #165 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208040 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208040&action=edit Bug 41921: (QA follow-up) Handle missing stored report results format_results looks up stored results by joining saved_sql to saved_reports. Deleting a report does not delete its stored results, so for results whose report was deleted, or for an id that does not exist, the lookup finds no row and from_json(undef) dies. Following a "View results" link from the Report jobs page after the report was deleted would return 500. This patch: - Makes format_results return undef when no stored results are found - Shows a "results do not exist" message in view_stored_results instead of crashing - Adds tests for format_results, including results in the new headers/rows format and the older array format Test plan: 1. Go to: /cgi-bin/koha/reports/guided_reports.pl?op=view_stored_results&id=99999999 2. Boom. 500 error malformed JSON string 3. Set ReportsRunInBackground to "let the user choose" 4. Run a saved report and choose "Queue as background job" 5. When the job has finished, click "View results" on the Report jobs page and note the results display 6. Copy that page's URL, then delete the saved report 7. Open the copied URL and note the error page (500) 8. Apply patch and restart_all 9. Repeat steps 1 and 7 10. Note both now show "These saved report results do not exist, or the report they belong to has been deleted." 11. Run a report as a background job again and confirm "View results" still shows its results 12. Run: prove t/db_dependent/Reports/Guide Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #166 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208041 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208041&action=edit Bug 41921: (QA follow-up) Filter report jobs by library before paging When LimitReportsByLibrary is enabled, GET /api/v1/reports/jobs hid jobs for reports the user cannot access by checking can_access on each job after the page had been fetched. The pagination headers were already set from the unfiltered query, so X-Total-Count included the hidden jobs, and pages could come back short or empty. This patch filters the jobs in the query, before paging, using Koha::Reports->search_with_library_limits. Jobs are listed if their report has no library limits, is limited to the user's library, or has been deleted. Users who can manage report limits still see every job. X-Total-Count, paging and sorting now all count the same jobs. Test plan: 1. Enable LimitReportsByLibrary 2. Create two saved SQL reports, A and B. Limit report B to a library other than your test staff user's library 3. As a superlibrarian, run both reports and choose "Queue as background job". The jobs do not need to finish 4. Log in as a staff user with catalogue, execute_reports_foreground and execute_reports_background permissions, but not manage_report_limits 5. Go to Reports > Report jobs 6. Note only report A's job is shown, but the table says "Showing 1 to 1 of 2 entries" 7. Apply patch and restart_all 8. Reload Reports > Report jobs 9. Note the table now says "Showing 1 to 1 of 1 entries" 10. Log in as the superlibrarian and note both jobs are shown 11. Run: prove t/db_dependent/api/v1/reports_jobs.t Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #167 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 208042 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208042&action=edit Bug 41921: (QA follow-up) Fix typos in run_report.inc, tidy jobs.pl and add POD - Fix typos in the run_report background job messages - In reports/jobs.pl, pass the already-checked $new_job_id to the template instead of reading the new_job_id parameter a second time. Only whole numbers are still accepted - Add POD coverage to satisfy qa script Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited|CLAMS | list of Sponsors| | Sponsorship status|Sponsored |--- --- Comment #168 from Brendan Lawlor <blawlor@clamsnet.org> --- QA notes: After applying patches: updatedatabase && restart_all && yarn api:bundle I used Claude Opus 5.5 for testing and code review and confirmed everything with manual human testing in a browser. There is one more thing that came up in testing that could use a follow up bug. Reports run as background jobs do not support being run with a template. To support templates for background jobs we could pass the template id to the job and store it with the results. "View results" could then render the template like a foreground run does. This would need updates to RunReport.pm, guided_reports.pl and tests. This is an awesome new feature. Most excellent work! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Miranda Nero <mnero@oslri.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mnero@oslri.net -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This enhancement adds the release notes| |ability to run reports as | |background jobs. This | |allows long-running reports | |to process their query in | |the background, with | |results available to users | |once they've completed. | |This behavior is controlled | |by a new system preference, | |ReportsRunInBackground. The | |system preference options | |allow for either all | |reports to run in the | |foreground, all reports to | |run in the background, or | |for the user to choose when | |the report is run. A new | |report jobs page shows all | |currently running reports | |and provides access to all | |reports previously run as | |background jobs. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This enhancement adds the |This enhancement adds the release notes|ability to run reports as |ability to run reports as |background jobs. This |background jobs. This |allows long-running reports |allows long-running reports |to process their query in |to process their query in |the background, with |the background, with |results available to users |results available to users |once they've completed. |once they've completed. A |This behavior is controlled |new report jobs page shows |by a new system preference, |all currently running |ReportsRunInBackground. The |reports and provides access |system preference options |to all reports previously |allow for either all |run as background jobs. |reports to run in the |This behavior is controlled |foreground, all reports to |by a new system preference, |run in the background, or |ReportsRunInBackground. The |for the user to choose when |system preference options |the report is run. A new |allow for either all |report jobs page shows all |reports to run in the |currently running reports |foreground, all reports to |and provides access to all |run in the background, or |reports previously run as |for the user to choose when |background jobs. |the report is run. Further, | |the execute_reports | |permission is split into a | |permission to execute | |reports in the foreground | |and a permission to execute | |reports in the background. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k Status|Passed QA |Patch doesn't apply --- Comment #169 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Doesn't apply after bug 43249 I believe. Please rebase when convenient. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited| |CLAMS list of Sponsors| | Status|Patch doesn't apply |Passed QA Sponsorship status|--- |Sponsored -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208019|0 |1 is obsolete| | Attachment #208020|0 |1 is obsolete| | Attachment #208021|0 |1 is obsolete| | Attachment #208022|0 |1 is obsolete| | Attachment #208023|0 |1 is obsolete| | Attachment #208024|0 |1 is obsolete| | Attachment #208025|0 |1 is obsolete| | Attachment #208026|0 |1 is obsolete| | Attachment #208027|0 |1 is obsolete| | Attachment #208028|0 |1 is obsolete| | Attachment #208029|0 |1 is obsolete| | Attachment #208030|0 |1 is obsolete| | Attachment #208031|0 |1 is obsolete| | Attachment #208032|0 |1 is obsolete| | Attachment #208033|0 |1 is obsolete| | Attachment #208034|0 |1 is obsolete| | Attachment #208035|0 |1 is obsolete| | Attachment #208036|0 |1 is obsolete| | Attachment #208037|0 |1 is obsolete| | Attachment #208038|0 |1 is obsolete| | Attachment #208039|0 |1 is obsolete| | Attachment #208040|0 |1 is obsolete| | Attachment #208041|0 |1 is obsolete| | Attachment #208042|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #170 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208679 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208679&action=edit Bug 41921: Add syspref and split execute_reports permission Split the execute_reports user permission into execute_reports_foreground and execute_reports_background. Adds ReportsRunInBackground system preference the controls which types of reports running are available for this instance. Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #171 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208680 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208680&action=edit Bug 41921: Add run_type to the prep_report tracking marker Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #172 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208681 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208681&action=edit Bug 41921: Add Koha::Reports->check_limits Consolidates the per-user duplicate, per-user total, and per-instance total concurrent-run checks into a single method. Adds the count of queued run_report background jobs to the total. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #173 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208682 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208682&action=edit Bug 41921: Add ability to run reports as background jobs Adds Koha::BackgroundJob::RunReport job type, registered with the long_tasks queue ( dedicated queue planned in bug 42642 ) Test plan 1) Apply patch, run updatedatabase.pl 2) prove t/db_dependent/Koha/BackgroundJob/RunReport.t 3) prove t/db_dependent/Koha/Reports.t 4) prove t/Koha/Auth/Permissions.t 5) Set ReportsRunInBackground to 'always'. Run a saved SQL report from the staff client. Confirm a job appears under admin/background_jobs.pl with type 'Run report'. Once finished, click 'View results' on the job page and confirm the stored result renders in the standard report-results view. 6) Set ReportsRunInBackground to 'never'. Run the same report. Confirm it executes in the foreground. 7) Set ReportsRunInBackground to 'user_choice'. Run the report, confirm the 'choose run mode' page is shown with a Background checkbox preselected, and the report runs accordingly. Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #174 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208683 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208683&action=edit Bug 41921: Add check_limits to guided_reports.pl Wires check_limits to the guided reports script. Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Run two long reports ( "SELECT SLEEP(120)" works well) in two tabs 5) Confirm the second tab shows the 'too many total reports' alert 6) Click 'Export' on a saved report under the same conditions and confirm the export request returns 429 with a 'too many reports' message Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #175 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208684 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208684&action=edit Bug 41921: Wire check_limits into svc/report and opac/svc/report * svc/report calls Koha::Reports->check_limits before prep_report, passing the logged-in patron's borrowernumber. Returns a 429 if the limits have been exceeded. * opac/svc/report does the same, but with borrowernumber from the userenv when present (anonymous OPAC requests still count toward the per-instance limit). * Update error keys for consistency Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 1 in koha-conf.xml 4) Start a long report through the staff UI ( e.g. "SELECT SLEEP(120)" ) 5) Browse to /cgi-bin/koha/svc/report?id=N (while authenticated) and confirm the response is 429 with body {"error":"total_running_reports_per_instance_limit_exceeded"} 6) Browse to /cgi-bin/koha/opac/svc/report?id=N (while logged out) and confirm the same 429 response 7) Reset the limit 8) Repeat steps 4-6 9) Confirm normal JSON results Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #176 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208685 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208685&action=edit Bug 41921: Add per-run-type overrides to report concurrency caps The existing caps in koha-conf.xml apply to every run type, so an admin who wanted to leave plenty of headroom for background jobs but keep a tight cap on foreground reports had no way to express that. This commit adds six new keys that override the combined caps per run type. Each existing cap now has matching foreground_ and background_ keys. A value of 0 in any key means no limit, matching how the combined keys already behave. When a run-type key is non-zero it replaces the combined key for that run type and only counts same-run-type queries: - foreground_X caps count foreground processlist queries only. - background_X caps count background processlist queries plus queued run_report jobs (queued jobs are always background). Test plan 1) Apply patch 2) prove t/db_dependent/Koha/Reports.t 3) Set total_running_reports_per_instance_limit to 5 and foreground_total_running_reports_per_instance_limit to 2 in koha-conf.xml, restart all the things 4) Start 2 long foreground reports 5) Start a third foreground report, confirm the 'too many total reports' alert is shown 6) Queue 4 background reports (ReportsRunInBackground=always or the choose-run-mode page) 7) Confirm all 4 are enqueued (foreground cap doesn't apply to background, combined cap allows 5) 8) Queue a 5th, confirm it is enqueued, queue a 6th and confirm it is blocked by the combined cap 9) Unset the foreground override, set background_total_running_reports_per_instance_limit to 3 and restart, repeat steps 5 and 7 confirming the bg cap now applies Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #177 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208686 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208686&action=edit Bug 41921: Add a Report jobs dashboard for librarians This commit adds a dedicated Report jobs dashboard requiring the same permissions as running a report. The is needed because the background jobs viewer may not be accesible to everyone who ran run reports. In addition, this page will let librarians cancel their own queued reports. Superlibrarian's can cancel any report. The ability to cancel running reports is planned for a future bug report. Note: Should we have a new permission for the ability to cancel any queued report? Test plan 1) Apply patch, run updatedatabase.pl, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t 3) Set ReportsRunInBackground=always 4) Run a saved SQL report from the staff client, something long running like "SELECT SLEEP(60)" 5) Confirm you land on the Report jobs dashboard with your new job highlighted 6) Click Cancel on the queued row, confirm the prompt, and confirm the row's status changes to 'Cancelled' on the next ajax reload 7) Run another report, let it finish, click 'View results' on the finished row, confirm the stored result renders in the standard report-results view. I've attempted to make the stored sql view match the "live results" view as much as I could. 8) Log in as a librarian with reports access but not superlibrarian, confirm you only see Cancel on your own queued rows, not on jobs owned by other librarians 9) Log in as superlibrarian, confirm Cancel is available on any queued row regardless of owner Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #178 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208687 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208687&action=edit Bug 41921: Add currently-running reports to the dashboard Test plan 1) Apply patch, restart all the things 2) prove t/db_dependent/api/v1/reports_jobs.t t/db_dependent/Koha/Reports.t 3) Browse to /cgi-bin/koha/reports/jobs.pl 4) Confirm the page shows 'No reports are running right now.' when nothing is in flight, and that the background report jobs table renders as before 5) Create an SQL report with body SELECT SLEEP(60), 6) Run it from the staff client in foreground mode 7) Confirm a row appears in the Currently running table 7) Refresh the view with the refresh button, note the data changes 8) Let the foreground report finish 9) Confirm the row disappears from the "Currently running" table on the next refresh 9) Run the same report as a background job 10) Confirm the row appears again with a Type of "background" while the worker is executing 11) Confirm the row disappears once the worker finishes from the running reports table when it has finished executing Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #179 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208688 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208688&action=edit Bug 41921: Update Schema files [DO NOT PUSH] Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #180 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208689 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208689&action=edit Bug 41921: (follow-up) Tidy Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #181 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208690 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208690&action=edit Bug 41921: (follow-up) Enforce permissions and system pref for background/foreground running Note: tidy is doing a lot here. please use 'git diff -w' to see my changes Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #182 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208691 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208691&action=edit Bug 41921: Add a unit test for can_run_foreground_background Signed-off-by: Rae Schumann <rschumann@utah.gov> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #183 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208692 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208692&action=edit Bug 41921: (follow-up) Make sure jobs.pl new_job_id only takes integer Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #184 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208693 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208693&action=edit Bug 41921: (follow-up) Make sure svc/convert uses the new permissions Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #185 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208694 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208694&action=edit Bug 41921: (follow-up) Don't render reports that a staff cant view based on LimitReportsByLibrary Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #186 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208695 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208695&action=edit Bug 41921: Fix error coding in run_report.inc Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #187 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208696 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208696&action=edit Bug 41921: (follow-up) Restore ability to run with template when in choose_run_mode Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #188 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208697 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208697&action=edit Bug 41921: (follow-up) Remove old limit handling code Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #189 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208698 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208698&action=edit Bug 41921: (follow-up) Swap template_code for template_id Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #190 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208699 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208699&action=edit Bug 41921: (QA follow-up) Fix report jobs list for deleted reports In Koha::REST::V1::Reports::Jobs::list calling can_access on an undefined report dies, GET /api/v1/reports/jobs returns 500, and the Report jobs dashboard blows up. This patch only checks can_access when the report still exists. Jobs for deleted reports stay in the list, where the dashboard shows them as "(report deleted)". Test plan: 1. Set ReportsRunInBackground to "let the user choose" 2. Go to Reports > Saved reports, run a report and choose "Queue as background job" 3. Wait for the job to finish on the Report jobs page 4. Delete that saved report 5. Go to Reports > Report jobs 6. Note the "Background jobs" table fails to load, and /api/v1/reports/jobs returns 500, an alert pops up 7. Apply patch and restart_all 8. Reload Reports > Report jobs 9. Note the table loads and the job shows "(report deleted)" 10. Run: prove t/db_dependent/api/v1/reports_jobs.t Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #191 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208700 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208700&action=edit Bug 41921: (QA follow-up) Handle missing stored report results format_results looks up stored results by joining saved_sql to saved_reports. Deleting a report does not delete its stored results, so for results whose report was deleted, or for an id that does not exist, the lookup finds no row and from_json(undef) dies. Following a "View results" link from the Report jobs page after the report was deleted would return 500. This patch: - Makes format_results return undef when no stored results are found - Shows a "results do not exist" message in view_stored_results instead of crashing - Adds tests for format_results, including results in the new headers/rows format and the older array format Test plan: 1. Go to: /cgi-bin/koha/reports/guided_reports.pl?op=view_stored_results&id=99999999 2. Boom. 500 error malformed JSON string 3. Set ReportsRunInBackground to "let the user choose" 4. Run a saved report and choose "Queue as background job" 5. When the job has finished, click "View results" on the Report jobs page and note the results display 6. Copy that page's URL, then delete the saved report 7. Open the copied URL and note the error page (500) 8. Apply patch and restart_all 9. Repeat steps 1 and 7 10. Note both now show "These saved report results do not exist, or the report they belong to has been deleted." 11. Run a report as a background job again and confirm "View results" still shows its results 12. Run: prove t/db_dependent/Reports/Guide Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #192 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208701 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208701&action=edit Bug 41921: (QA follow-up) Filter report jobs by library before paging When LimitReportsByLibrary is enabled, GET /api/v1/reports/jobs hid jobs for reports the user cannot access by checking can_access on each job after the page had been fetched. The pagination headers were already set from the unfiltered query, so X-Total-Count included the hidden jobs, and pages could come back short or empty. This patch filters the jobs in the query, before paging, using Koha::Reports->search_with_library_limits. Jobs are listed if their report has no library limits, is limited to the user's library, or has been deleted. Users who can manage report limits still see every job. X-Total-Count, paging and sorting now all count the same jobs. Test plan: 1. Enable LimitReportsByLibrary 2. Create two saved SQL reports, A and B. Limit report B to a library other than your test staff user's library 3. As a superlibrarian, run both reports and choose "Queue as background job". The jobs do not need to finish 4. Log in as a staff user with catalogue, execute_reports_foreground and execute_reports_background permissions, but not manage_report_limits 5. Go to Reports > Report jobs 6. Note only report A's job is shown, but the table says "Showing 1 to 1 of 2 entries" 7. Apply patch and restart_all 8. Reload Reports > Report jobs 9. Note the table now says "Showing 1 to 1 of 1 entries" 10. Log in as the superlibrarian and note both jobs are shown 11. Run: prove t/db_dependent/api/v1/reports_jobs.t Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #193 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208702 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208702&action=edit Bug 41921: (QA follow-up) Fix typos in run_report.inc, tidy jobs.pl and add POD - Fix typos in the run_report background job messages - In reports/jobs.pl, pass the already-checked $new_job_id to the template instead of reading the new_job_id parameter a second time. Only whole numbers are still accepted - Add POD coverage to satisfy qa script Sponsored-by: CLAMS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41921 --- Comment #194 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208703 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208703&action=edit Bug 41921: (QA follow-up) Fix test plan count in Guided.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org