Skip to content

Conversation

@Simon-Laux
Copy link
Contributor

@Simon-Laux Simon-Laux commented Oct 29, 2025

This is the branch for #7367
closes #7367

Currently removed tests

  • test_something.py::test_reaction_to_partially_fetched_msg
  • test_something.py::test_download_limit_chat_assignment
  • python/tests/test_1_online.py::test_webxdc_download_on_demand
  • src/calls/calls_tests.py::test_no_partial_calls
  • src/message/message_tests.rs::test_markseen_not_downloaded_msg
  • src/message/message_tests.rs::test_msg_seen_on_imap_when_downloaded
  • src/receive_imf/receive_imf_tests.rs::test_download_later
  • src/receive_imf/receive_imf_tests.rs::test_create_group_with_big_msg
  • src/receive_imf/receive_imf_tests.rs::test_partial_group_consistency
  • src/receive_imf/receive_imf_tests.rs::test_prefer_references_to_downloaded_msgs
  • src/receive_imf/receive_imf_tests.rs::test_partial_download_key_contact_lookup
  • src/webxdc/webxdc_tests.rs::test_webxdc_update_for_not_downloaded_instance
  • src/download.rs::test_download_limit
  • src/download.rs::test_partial_receive_imf
  • src/download.rs::test_partial_download_and_ephemeral
  • src/download.rs::test_status_update_expands_to_nothing
  • src/download.rs::test_mdn_expands_to_nothing
  • src/download.rs::test_partial_download_trashed
  • src/reaction.rs::test_partial_download_and_reaction

Progress of the tests

Overview about the recycled(♻️) and dropped(🗑️) tests of the tests that I removed in #7373

All the recycled tests were already recycled/re-made except for some which are still to do:

  • test_partial_group_consistency
  • test_msg_seen_on_imap_when_downloaded
  • test_download_limit_chat_assignment

Furthermore there need to be new tests to test the downloading/scheduling changes.


TODO Tests

  • sending pre-message, post-message
  • metadata in pre-message
  • process receiving
  • display attachment info in pre-message
  • test scheduler imap fetching
  • test failing download sets state to failed
  • test_download_limit_chat_assignment
  • multi device tests
  • deletion tests

postponed to do tests

  • rust: test_msg_seen_on_imap_when_downloaded (I guess this is for syncing seen state between devices)
  • rust: test_partial_group_consistency

discarded/ignored test ideas

maybe we should reconsider / discuss those?

  • test that full message, replacing pre-message does not work if the message encryption state is not the same for both messages (both full- and pre-message)
    • unencrypted pre- and full-message are not sent

@Simon-Laux Simon-Laux changed the title [Branch] Pre-messages / next version of download on demand [Branch] pre-messages / next version of download on demand Oct 29, 2025
@link2xt link2xt force-pushed the pre-messages branch 3 times, most recently from 2f1c383 to 6bcc795 Compare December 11, 2025 12:00
@link2xt link2xt force-pushed the pre-messages branch 6 times, most recently from 8443b17 to 702771f Compare December 11, 2025 21:24
- Remove partial downloads (remove creation of the stub messages) (#7373)
- Remove "Download maximum available until" and remove stock string `DC_STR_DOWNLOAD_AVAILABILITY` (#7369)
- Send pre-message on messages with large attachments (#7410)
- Pre messages can now get read receipts (#7433)

Co-authored-by: Hocuri <hocuri@gmx.de>
@link2xt link2xt changed the title [Branch] pre-messages / next version of download on demand feat: pre-messages / next version of download on demand Dec 14, 2025
Comment on lines +1475 to +1478
"CREATE TABLE download_new (
rfc724_mid TEXT NOT NULL DEFAULT '',
msg_id INTEGER NOT NULL DEFAULT 0
) STRICT;
Copy link
Collaborator

@Hocuri Hocuri Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@link2xt I'm wondering whether we should add UNIQUE(rfc724_mid) or UNIQUE(msg_id)? Or even both? I guess it doesn't really make sense to have the same message in there twice?

Copy link
Collaborator

@iequidoo iequidoo Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both msg_id and rfc724_mid in this table? rfc724_mid can be obtained from msg_id and there's even INDEX msgs_index1 ON msgs (rfc724_mid) if we need to do a reverse lookup

Previously, the uid_next wasn't advanced, which didn't create any
problems, but it also was inefficient, because another loop was done
trying to fetch the message again (and then finally skipping it, because
it's already known).
* - `download_limit` = Messages up to this number of bytes are downloaded automatically.
* For larger messages, only the header is downloaded and a placeholder is shown.
* For messages with large attachments, two messages are sent:
* a Pre-Message containing metadata and a Post-Message containing the attachment.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Full message" was a better term, "post-message" is literally "smth going after the message". And the full message should contain metadata as well, but the documentation doesn't say that

* Get the size of the file. Returns the size of the file associated with a
* message, if applicable.
* message, if applicable.
* If message is a pre-message, then this returns size of the to be downloaded file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If message is a pre-message, then this returns size of the to be downloaded file.
* If message is a pre-message, then this returns the size of the file to be downloaded.

file_mime: Option<String>,

/// The size of the file in bytes, if applicable.
/// If message is a pre-message, then this is the size of the to be downloaded file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// If message is a pre-message, then this is the size of the to be downloaded file.
/// If message is a pre-message, then this is the size of the file to be downloaded.

/// Pre-Message is a small message with metadata which announces a larger Post-Message.
/// Post-Messages are not downloaded in the background.
///
/// If pre-message is not nessesary this returns a normal message instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// If pre-message is not nessesary this returns a normal message instead.
/// If pre-message is not nessesary this returns `None` as the second value.

But i'd return the pre-message as the first value, this looks more natural to me.

if needs_pre_message {
info!(
context,
"Message is large and will be split into a pre- and a post-message.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Message is large and will be split into a pre- and a post-message.",
"Message {} is large and will be split into a pre- and a post-message.", msg.id,

}

Ok(())
async fn remove_from_download_table(context: &Context, rfc724_mid: &str) -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async fn remove_from_download_table(context: &Context, rfc724_mid: &str) -> Result<()> {
async fn delete_download_row(context: &Context, rfc724_mid: &str) -> Result<()> {

Comment on lines +259 to +260
// this is a dedicated method because it is used in multiple places.
pub(crate) async fn premessage_is_downloaded_for(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// this is a dedicated method because it is used in multiple places.
pub(crate) async fn premessage_is_downloaded_for(
pub(crate) async fn pre_message_is_downloaded_for(

for consistent naming. The comment isn't necessary, one can easily grep and see that

// This is probably a classical email that vanished before we could download it
warn!(
context,
"{rfc724_mid} is probably a classical email that vanished before we could download it"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe say what happened exactly? There's already a comment explaining the likely scenario. Logs are for developers mainly anyway

Ok(())
}

/// Download known post messages without pre_message
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Download known post messages without pre_message
/// Download known post-messages without pre-message

.await?;
for rfc724_mid in &rfc724_mids {
if !premessage_is_downloaded_for(context, rfc724_mid).await? {
// Download the Post-Message unconditionally,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we the same for non-deltachat messages, encrypted or unencrypted? They don't have pre-messages, but they are important as well, i.e. should be displayed in chats

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.

[Tracking Issue] Pre-Messages

5 participants