Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public_inbox: Fix email threads without an available root message #369

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mripard
Copy link
Contributor

@mripard mripard commented Jul 15, 2024

Hi,

@stefano-garzarella and @javierm have been reporting on the public-inbox plugin #329 that they were having crashes.

It turns out that lore doesn't always manage to archive all the messages and we might find emails with a valid in-reply-to header, but can't retrieve the message from the ML archive.

This was partly due to an improper type annotation, so this PR fixes both the type annotations and the actual bug they were both facing.

Some type hints were set to return a given type, while the function was
actually returning that type, or a None object.

Fix the type hints when relevant.

Signed-off-by: Maxime Ripard <[email protected]>
Some messages will not be perfect, and will have inconsistent or missing
headers.

We were mostly handling them fine, but didn't log anything when that was
happening, making debugging issues fairly difficult. Let's improve the
logging a bit.

Signed-off-by: Maxime Ripard <[email protected]>
The PublicInbox.__fetch_thread_root method returns None implicitly at
the end of the function.

Let's use an explicit return statement to make it more obvious.

Signed-off-by: Maxime Ripard <[email protected]>
A message can have an In-Reply-To header but the message it points to
might not be available for some reason.

In such a case, the Message.parent_id() method will return a proper
value, but __fetch_thread_root() on that message might not and would
return None.

Let's handle that case by returning the latest message we found as the
root message.

Signed-off-by: Maxime Ripard <[email protected]>
@stefano-garzarella
Copy link

Thanks! Tested with my setup and this PR fixes the issue!

@javierm
Copy link

javierm commented Jul 16, 2024

Hi, @mripard 😄.

I'm afraid I haven't reported anything; don't even know this project 🤔. Wrong username, maybe?

@mripard
Copy link
Contributor Author

mripard commented Jul 17, 2024

Yeah, sorry, I meant @martinezjavier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants