Some status update after trying to learn how bot/dashboard work and playing around with the code a bit.
This is what I would consider a dangerous change/refactor, since this tool is handling approval of updates to our customers and we currently donĀ“t have a staging environment.
Considering that, I propose to develop a module with the new feature, with 3 settings:
- dry run and log, to test out the new way of handling things, compare performance and make sure the same update requests are approved/rejected
- emergency shutoff: this quickly disables the new code, without need of PRs approval/fixes and minimizing impact on production
- enabled, switch over to the new system, eventually this would become default, the switch would go away and the old method removed from the code
Uploaded the WIP code https://github.com/michaelgrifalconi/qem-bot/commit/dc2ca5e9b03ad5f06ace62092512be00fd99b7fe but in the meantime found an issue.
It appears difficult to change the approver logic to only look at live real data.
This is the current flow for release request approvals:
(only looking at aggregate now)
- _approvable calls get_incidents_approver to query the dashboard about current update (inc and rr numbers)
- then
_approvable
gets get_aggregate_settings on qem to query dashboard on some data that do not come directly from openqa/smelt
- based on that data,
get_incident_result
will query the dashboard once again to get test results
In short, it's not a straight forward change since it's not just about reusing the same functions that feeds data to the dashboard and use directly that data.
I think it would be worth to separate what collects/process data, execute actions (bot) and the what visualizes that data (dashboard). I agree to query data in different way to better visualize but I personally don't like the bot to strongly rely on it and have the some data processing in the bot and some in the dashboard.
We could argue about the performance reasons to have the bot use cached dashboard data or not (or have one option with a fail over to the other one) but I would like to have the dashboard not be another business-critical component if we can avoid it and simply keep that burden/risk only on the bot script.