Re: mailing list redirect for bug numbers? - Mailing list pgsql-www

From Magnus Hagander
Subject Re: mailing list redirect for bug numbers?
Date
Msg-id CABUevEyOCL4JN6=Qc-dP96bhx292e7_qAKfC56wZe-RWu6snAQ@mail.gmail.com
Whole thread Raw
In response to Re: mailing list redirect for bug numbers?  ("Jonathan S. Katz" <jkatz@postgresql.org>)
Responses Re: mailing list redirect for bug numbers?  (Magnus Hagander <magnus@hagander.net>)
Re: mailing list redirect for bug numbers?  (Andres Freund <andres@anarazel.de>)
List pgsql-www
On Tue, Jan 15, 2019 at 11:43 AM Jonathan S. Katz <jkatz@postgresql.org> wrote:
Hi Andres,

On 1/14/19 5:18 PM, Andres Freund wrote:
> Hi,
>
> How hard would it be to have a redirect similar to
> https://www.postgresql.org/message-id/<id>
>
> that accepted bug numbers instead of message ids?  I don't know the
> precise database schema of the archives, but I assume it could be done
> with a prefix query that filters the sender to @postgresql.org, the list
> to pgsql-bugs, and the prefix to "BUG #<bugno>" or such.

The bug ID numbers are generated from pgweb using:

        SELECT nextval('bug_id_seq')

And then prefixed to the email thread as per the above.

Worth noticing is that it's also prefixed to the message-id, but that's a fairly new thing.


More on this in a second.

> Or perhaps
> there's a database table with bugs -> messageid mappings somewhere? Or
> could be created using a query like the above?

IMV that would be an excellent suggestion. My guess is in order to make
that work, we would create the mapping when the initial bug report makes
it into the archives. 

> It'd be neat to link to bugs from commit messages in a clearer format
> (i.e. to the bug number, rather than it being one of potentially
> multiple message ids), and it also makes manual lookup nicer.

Agreed, that sounds like a nicer UX.

The only big catch I see is that if someone emails -bugs directly, no
number is assigned, so we would have to leave that be.

Yeah, those would be entirely out of scope.


I don't know if we would want to use "/message-id/" as the parent URL,
just in case someone sent a message with an ID of just digits (for
whatever reason). Dare I suggest something like "/bugs/<id>/?

Or would we perhaps want tp use the postgr.es urls-shorterner with just a /b/ (like we have /m/ for messageids)? 

 
Assuming buy-in, what would need to be done is:

- Adjust the message import script to parse inbound messages with above
message beginning to -bugs. Determine if it is the first message to the
thread / bug ID is already registered. If it does not exist, record the
bug ID, message ID combo in a new table

That would suddenly put a very hard coded assumption into the archives code about this format, which I think is a bad idea in general since the archives code is not specific to the pgsql list usage *at all* today....


- Write a one time script to map old bug id to first message id in the
thread.

- Update the urls.py in pgarchives to handle said route and fail
gracefully if bug ID does not exist

- Note in pgweb where the email is generated that any changes to email
subject could break things.

And that should be that.

I think it would be easier to just have a simple piece of lookup code that has access to the archives db. When fed a bug number, it first looks for a messageid according to the new format messageid, and if its found (and just one) then redirect to that. If not, then to a subject prefix search and validate that the messageid is one that does match what it should do (e.g. that it comes from the correct servers -- there haven't been many so far, so it's easy to construct a whitelist) and returns exactly one, then redirect to that, otherwise 404.

The difficulty in all those is we don't currently index the subject other than as part of the full text. But that can probably be added pretty cheaply.
 
--

pgsql-www by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: mailing list redirect for bug numbers?
Next
From: Magnus Hagander
Date:
Subject: Re: mailing list redirect for bug numbers?