Cygnus issueshttps://gitlab.wmflabs.org/Cygnus/Cygnus/-/issues2018-03-30T22:40:05Zhttps://gitlab.wmflabs.org/Cygnus/Cygnus/-/issues/88Offer of reimplementation2018-03-30T22:40:05ZMGCheckerOffer of reimplementationI want to offer you the reimplementation of party of my patch from a few months ago, if you're intrerested in that:
* A clearer, more flexible setting architecture with JSON
* An Autoloading functionality for classes in combination with namespaces, maybe in combination with a CygUtility file. Personally, I think this centralized functionality is the only way to reduce duplicated code at (for instance) printing warnings and loading JSON files. Note: Autoloading is only useful if we choose a slightly more object oriented approach with at least some Exception classes.
* An improved engine for api requests with lower suspectibility to errors. This would decrease duplicate code, while increasing the simplicity of handling api requests and using Cygnus in general. The user wouldn't have to care about most api errors and should be able to to submit it's api params as array.
* Encapsulating BotCore. People shouldn't mess mit BotCore, but use it.
* Long-ranging: An object oriented handling of results of api requests instead of abusing arrays for these complex objects. This would be the first step, the goal could be to have a fully object-oriented framework with distinct frameworks for wiki communication, loggers, etc. Such a model would depend highly on Composition. An object-oriented framework would make maintenance easiser and improve flexibility. Furthermore, it puts more structure into the code, it is more like a human would group functionality. However, this is nothing you can build over the course of a few days, I think it'll take at least 80 hours of work to build the second part. (Note that the first part is coded already in many parts).
I'll split this stuff in multiple patches, making it easier to handle for everyone.
I've got some time to spare in March and I'll take some days of that and spend it to reimplement (and test) my patch, if you're interested. However, this is just an feer, you don't have to take it. I still think these are really useful improvals if done the right way, but I'm looking forward to a producitve debate what's useful for Cygnus and what isn't. I want to offer you the reimplementation of party of my patch from a few months ago, if you're intrerested in that:
* A clearer, more flexible setting architecture with JSON
* An Autoloading functionality for classes in combination with namespaces, maybe in combination with a CygUtility file. Personally, I think this centralized functionality is the only way to reduce duplicated code at (for instance) printing warnings and loading JSON files. Note: Autoloading is only useful if we choose a slightly more object oriented approach with at least some Exception classes.
* An improved engine for api requests with lower suspectibility to errors. This would decrease duplicate code, while increasing the simplicity of handling api requests and using Cygnus in general. The user wouldn't have to care about most api errors and should be able to to submit it's api params as array.
* Encapsulating BotCore. People shouldn't mess mit BotCore, but use it.
* Long-ranging: An object oriented handling of results of api requests instead of abusing arrays for these complex objects. This would be the first step, the goal could be to have a fully object-oriented framework with distinct frameworks for wiki communication, loggers, etc. Such a model would depend highly on Composition. An object-oriented framework would make maintenance easiser and improve flexibility. Furthermore, it puts more structure into the code, it is more like a human would group functionality. However, this is nothing you can build over the course of a few days, I think it'll take at least 80 hours of work to build the second part. (Note that the first part is coded already in many parts).
I'll split this stuff in multiple patches, making it easier to handle for everyone.
I've got some time to spare in March and I'll take some days of that and spend it to reimplement (and test) my patch, if you're interested. However, this is just an feer, you don't have to take it. I still think these are really useful improvals if done the right way, but I'm looking forward to a producitve debate what's useful for Cygnus and what isn't. https://gitlab.wmflabs.org/Cygnus/Cygnus/-/issues/73Write a generic query continue2018-01-09T19:41:46ZLuke081515luke081515@tools.wmflabs.orgWrite a generic query continue!77 inspired me. What do you think of:
**A generic query continue!**
The concept itself is simple and nice, implementation may be not.
# What the function does
## Conditions for using
Query functions often have more results then the limit allows, so continue is needed. Currently the functions are doing this until all results are fetched. This may be useless if the user only needs 7000 for example.
## Calling it
Functions are reciving the continue. This continue has a name as well (if using rawcontinue, we may switch to the other continue), so the continue engine can get called, with the params `continuename `and `api-call url` at least. The function will start fetching everything then. It would be useful to implement that recursive, but PHP allows only 50 levels of recursive functions IIRC
# Nice additional features
The user can specify a limit, and the function tries to fetch as much as possible data, if [limit] > [limit of data to fetch in one request]. Then, the function will continue, until the limit is reached.
Please share your opinion on this proposal with me.!77 inspired me. What do you think of:
**A generic query continue!**
The concept itself is simple and nice, implementation may be not.
# What the function does
## Conditions for using
Query functions often have more results then the limit allows, so continue is needed. Currently the functions are doing this until all results are fetched. This may be useless if the user only needs 7000 for example.
## Calling it
Functions are reciving the continue. This continue has a name as well (if using rawcontinue, we may switch to the other continue), so the continue engine can get called, with the params `continuename `and `api-call url` at least. The function will start fetching everything then. It would be useful to implement that recursive, but PHP allows only 50 levels of recursive functions IIRC
# Nice additional features
The user can specify a limit, and the function tries to fetch as much as possible data, if [limit] > [limit of data to fetch in one request]. Then, the function will continue, until the limit is reached.
Please share your opinion on this proposal with me.Version 2.2https://gitlab.wmflabs.org/Cygnus/Cygnus/-/issues/7Get a uniform format for API-Urls2017-12-19T00:04:54ZLuke081515luke081515@tools.wmflabs.orgGet a uniform format for API-UrlsWhen formatting an API URL there are several ways at the moment, one is putting all the extra rubish in one line. That's not that readable, additionally phpcs freaks out when it sees that. So we need a good way to format all these URLs. What format do you prefer?
I prefer something like:
```
$data = 'action=watch'
. '&format=json'
. '&unwatch=' . $unwatch
. '&titles=' . urlencode($title)
. '&token=' . urlencode($token)
. '&assert=' . $this->assert
. '&maxlag=' . $this->maxlag;
```
(From merge request 5)
Easy to read, but tends to get long.When formatting an API URL there are several ways at the moment, one is putting all the extra rubish in one line. That's not that readable, additionally phpcs freaks out when it sees that. So we need a good way to format all these URLs. What format do you prefer?
I prefer something like:
```
$data = 'action=watch'
. '&format=json'
. '&unwatch=' . $unwatch
. '&titles=' . urlencode($title)
. '&token=' . urlencode($token)
. '&assert=' . $this->assert
. '&maxlag=' . $this->maxlag;
```
(From merge request 5)
Easy to read, but tends to get long.Version 2.2https://gitlab.wmflabs.org/Cygnus/Cygnus/-/issues/32General handling for warnings2017-11-09T14:27:53ZLuke081515luke081515@tools.wmflabs.orgGeneral handling for warningsAs seen in #31 it would be nice if we can display or log warnings. In this case I discovered that problem only because I ran debug with the new verbose-debug mode. That is optimal, as warnings may useful as well for the developers. Additionally, if we are handling warnings better, we can make unit tests fail as well.
What's better, displaying or logging warnings? And at which place to we want to catch them? Each function or maybe httpRequest? httpRequest has the problem of different formats, if old functions are using format=php, httpRequest can't search for the json part. Or implement an extra function for that?
@freddy2001 Your thoughts?As seen in #31 it would be nice if we can display or log warnings. In this case I discovered that problem only because I ran debug with the new verbose-debug mode. That is optimal, as warnings may useful as well for the developers. Additionally, if we are handling warnings better, we can make unit tests fail as well.
What's better, displaying or logging warnings? And at which place to we want to catch them? Each function or maybe httpRequest? httpRequest has the problem of different formats, if old functions are using format=php, httpRequest can't search for the json part. Or implement an extra function for that?
@freddy2001 Your thoughts?Version 2.2FreddyFreddy