[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#780020: [UDD] bugs.cgi: YAML contains raw HTML and "ruby objects"



Hi Niels,

bugs.cgi started as a huge amount of spaghetti code, and is slightly
become better.

On 08/03/15 at 10:36 +0100, Niels Thykier wrote:
> Package: qa.debian.org
> Severity: minor
> 
> Hi,
> 
> The generated YAML contains raw HTML and Ruby specific objects, example
> (from the query in [1]):
> 
> """
> - id: 644047
>   package: gdm3
>   [...]
>   title: ! 'gdm3: /etc/default/locale ignored, locale set to C, breaks gnome-terminal'
>   last_modified: !ruby/object:DateTime 2015-03-05 22:36:21.000000000 +00:00
>   [...]
>   chints: ! '<a href="http://release.debian.org/britney/hints/nthykier"; title="3.14.1-4
>     nthykier #2015-03-06
> 
>     # #644047, #774889">unblock</a> '
>   [...]
>   caffected: (<abbr title='affects testing'>T</abbr>)
> """
> 
> At least, chints and caffected is basically just raw HTML dumped in a
> YAML stream.  The last_modified is a seriraled Ruby object.  The rest
> of the fields are just there fore reference and to make it easier to
> find the example (as long as it lasts).
> 
> For me the issue with:
>  * Raw HTML is that it is a poor machine parsable representation of the data.
>    - For caffected, a list of the distribution names would be better (e.g. ["testing"]).
>    - For chints, it would probably need to be split into a list of dictionaries with the following fields:
>      - hinter => "nthykier" in this example
>      - hint (or hint name/type) => "unblock" in this example
>      - hinter_comment => The contents of the "title" attribute
>  * Ruby objects is that the client may not be written in Ruby.  In such cases, we have "massage" the
>    data to parse it with conventional parsers of other languages.
>    - Note, I certainly do not mind that the YAML uses Ruby objects in addition to regular values.
>      Alternatively, it could be an "opt-in"/"opt-out" feature to get ruby objects.
> 
> NB: Feel free to apply a healthy amount of bikeshedding to the above.
> The proposed formats are only meant as a suggestion.

For last_modified, I've added a new 'last_modified_string' field that
shows the date as text. Should be easily parsable by about everything.

For caffected, the raw data is already available:
  affects_stable: false
  affects_testing: true
  affects_unstable: false
  affects_experimental: true

For cdeferred, it's probably easy enough to parse right now.

For chints, I did not manage to output something clean, for strange
reasons.

bugs.cgi needs a fall rewrite (with a design similar to DMD). In the
meantime, it's not possible to fix this properly.

Lucas


Reply to: