Skip to content

chore(madmail): port to v2 - #31

Merged
j4n merged 1 commit into
mainfrom
j4n/madmail-main
Aug 20, 2026
Merged

chore(madmail): port to v2#31
j4n merged 1 commit into
mainfrom
j4n/madmail-main

Conversation

@j4n

@j4n j4n commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This adds support for the v2 Rust-Version and adapt tests; opportunistically download binaries if available to skip the build process:

  • Pin MadmailDriver.DEFAULT_REF to v2.20.0
  • Fetch tags so RELAY_REF and --source can checkout release tags
  • Run madmail E2E tests from the deployed checkout, not the cached clone
  • Raise lxc-test job timeout to 60 minutes to fit potential madmail source build

Support for @latest split into separate PR #46.

@j4n
j4n requested a review from hpk42 July 29, 2026 08:50
@j4n
j4n marked this pull request as draft July 29, 2026 09:00
@j4n
j4n force-pushed the j4n/madmail-main branch from 4c4b4aa to cce9522 Compare July 29, 2026 13:33
@j4n j4n changed the title chore(madmail): default to @main, instead of ancient v0.47.1 chore(madmail): port to v2, support @latest source tag Jul 29, 2026
@j4n
j4n force-pushed the j4n/madmail-main branch 3 times, most recently from 7f281db to 54ec1b1 Compare July 29, 2026 16:31
@j4n
j4n marked this pull request as ready for review July 29, 2026 16:31
@j4n
j4n requested a review from missytake July 29, 2026 16:32
@j4n j4n self-assigned this Jul 31, 2026
@j4n
j4n force-pushed the j4n/madmail-main branch 3 times, most recently from 6c9a088 to d1f42b0 Compare August 5, 2026 11:57
@j4n
j4n changed the base branch from main to j4n/ci-pr-any-base August 5, 2026 12:01
@j4n
j4n force-pushed the j4n/ci-pr-any-base branch from b9238cc to a6ac8b6 Compare August 6, 2026 06:07
@j4n
j4n force-pushed the j4n/madmail-main branch from d1f42b0 to 38649de Compare August 6, 2026 06:07
@j4n
j4n force-pushed the j4n/ci-pr-any-base branch from a6ac8b6 to b647886 Compare August 6, 2026 11:23
@j4n
j4n force-pushed the j4n/madmail-main branch from 38649de to 3491696 Compare August 6, 2026 11:23
@j4n
j4n force-pushed the j4n/ci-pr-any-base branch from b647886 to cbd5c12 Compare August 6, 2026 11:35
@j4n
j4n force-pushed the j4n/madmail-main branch 2 times, most recently from 17fa180 to aa1e17d Compare August 11, 2026 10:39
@j4n
j4n force-pushed the j4n/ci-pr-any-base branch from cbd5c12 to 756c948 Compare August 11, 2026 10:39
@hpk42
hpk42 force-pushed the j4n/ci-pr-any-base branch from 756c948 to 8d3969e Compare August 11, 2026 12:36
@hpk42
hpk42 force-pushed the j4n/madmail-main branch from aa1e17d to a726488 Compare August 11, 2026 12:36
Base automatically changed from j4n/ci-pr-any-base to main August 11, 2026 12:53
@hpk42
hpk42 force-pushed the j4n/madmail-main branch from a726488 to 02a4d4d Compare August 11, 2026 12:53

@hpk42 hpk42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please

  1. drop the @latest dynamic git resolving logic (does network requests during CLI parsing and is orthogonal issue to madmail v2), just default to @main or latest release tag for now.

  2. Keep the go->rust madmail upgrade, and also support for downloading prebuilt binaries, the imap-test fix to work against madmail-v2 is fine as well.

  3. Prepare a draft themadorg/madmail PR that uses this branch here. If i am not mistaken you can pick up this PR branch here with something like

jobs:
  lxc-test:
    name: cmlxc deploy and run tests
    uses: chatmail/cmlxc/.github/workflows/lxc-test.yml@main
    with:
      cmlxc_version: j4n/madmail-main
      cmlxc_commands: |
        cmlxc init
        cmlxc deploy-madmail --source ./ mad0
        cmlxc deploy-cmdeploy --source @main relay0
        cmlxc test-mini mad0 relay0
        cmlxc test-mini relay0 mad0
        cmlxc test-madmail mad0

@j4n

j4n commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Thank you. I have addressed your feedback, and updated PR body text accordingly; madmail PR is themadorg/madmail#144.

@hpk42 hpk42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for addressing most of the feedback!

However, the v0.47.1 pin was intentional, not an oversight, so can not serve as a reason for adding @latest support. What we want i think is:

  • chatmail/relay tests its PR/main against a fixed madmail version. MadmailDriver.DEFAULT_REF can stay a fixed tag, just bump it to the current latest madmail v2 one. Relay-tests should automatically use it then, and they will use the already-compiled Rust binary (madmail has tags running ahead of releases, so downloads might more easily fail with @latest but not sure)

  • themadorg/madmail tests its PR/main against chatmail/relay @main (relays are often deployed from main anyway, so madmail should work against such relays, but pinning is also fine)

  • cmlxc's should test against latest pinned relay/madmail or latest main ones or both (but doesn't today, a separate issue)

Despite you fixing the CLI/network issue i still prefer @latest support to come in a separate PR (unstacked! :).

Comment thread src/cmlxc/driver_madmail.py Outdated
Comment thread src/cmlxc/driver_base.py Outdated
@j4n

j4n commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

However, the v0.47.1 pin was intentional, not an oversight, so can not serve as a reason for adding @latest support.
* chatmail/relay tests its PR/main against a fixed madmail version. MadmailDriver.DEFAULT_REF can stay a fixed tag, just bump it to the current latest madmail v2 one. Relay-tests should automatically use it then, and they will use the already-compiled Rust binary (madmail has tags running ahead of releases, so downloads might more easily fail with @latest but not sure)

Brought back, pinned to 2.20.0, indeed 2.23.0 is latest tag; thats why I did the HTTP-query; but maybe we can just cache the build somehow at a later point.

* themadorg/madmail tests its PR/main against chatmail/relay @main (relays are often deployed from main anyway, so madmail should work against such relays, but pinning is also fine)
* cmlxc's should test against latest pinned relay/madmail or latest main ones or both (but doesn't today, a separate issue)

Leaving for subsequent edits.

Despite you fixing the CLI/network issue i still prefer @latest support to come in a separate PR (unstacked! :).

I split it out now, coming up.
Before after for this round: git range-diff origin/main..0f158e5 origin/main..HEAD

@j4n
j4n force-pushed the j4n/madmail-main branch from 0f158e5 to 4f8695d Compare August 13, 2026 13:41
@j4n j4n changed the title chore(madmail): port to v2, support @latest source tag chore(madmail): port to v2 Aug 13, 2026
@j4n
j4n force-pushed the j4n/madmail-main branch 5 times, most recently from d03252f to 7e15c5a Compare August 17, 2026 12:43
@j4n
j4n requested a review from hpk42 August 17, 2026 13:03

@hpk42 hpk42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks and sorry for taking a while.

  1. PR failed because i had existing (madmail Go) containers.
    I think it's better to try to detect and remove the Go-version early on. There aren't too many users of cmlxc but still some, and it will give a weird traceback. I think there should be Driver.cached_checkout_is_stale classmethod that checks REQUIRED_SOURCE_PATH. This can then be used from get_git_main_path to discard the old checkout.

  2. PR description says "Fetch tags so RELAY_REF and --source can checkout release tags" but i think you can still just do "git fetch origin" and it autofollows the tags (madmail tags from main)

It' helpful for review if all lines in a PR are neccessary.

Comment thread .github/workflows/lxc-test.yml Outdated
Comment thread src/cmlxc/driver_base.py Outdated
Comment thread src/cmlxc/driver_madmail.py Outdated
@j4n
j4n force-pushed the j4n/madmail-main branch 2 times, most recently from 881fead to 2faa771 Compare August 19, 2026 14:57
@j4n

j4n commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for re-reviewing.

I applied your suggestions, they were correct.

  1. PR failed because i had existing (madmail Go) containers.
    I think it's better to try to detect and remove the Go-version early on. There aren't too many users of cmlxc but still some, and it will give a weird traceback. I think there should be Driver.cached_checkout_is_stale classmethod that checks REQUIRED_SOURCE_PATH. This can then be used from get_git_main_path to discard the old checkout.

Ah, good point. I added a commit that addresses this, separatly, for easier review, with a simple test to check it but I haven't tested with stale go containers yet.

  1. PR description says "Fetch tags so RELAY_REF and --source can checkout release tags" but i think you can still just do "git fetch origin" and it autofollows the tags (madmail tags from main)
    It' helpful for review if all lines in a PR are neccessary.

Indeed, apologies.

@j4n
j4n requested a review from hpk42 August 19, 2026 15:14
@j4n
j4n force-pushed the j4n/madmail-main branch from 2faa771 to bee86a1 Compare August 19, 2026 15:52
@hpk42

hpk42 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

i think the timeout 30 -> 60 was really about allowing CI to finish, and you removed it in force-push. please also squash everything to a single commit, and make sure CI passes. It's getting ready for merge.

- Drop v1 support entirely rather, set DEFAULT_REF to v2.23.2, latest release.
- Replace Go toolchain block with rustup, installed if missing or below
  Cargo.toml's requirement.
- Web admin UI build is handled by the main build process now
- driver_base.py: pass tag through on_init_relay() for driver consumption
- madmail's on_init_relay now tries a download first for a semver release tags,
  falls back to the source build.
- align minitest suite's assertions with madmail v2's behaviour:
  - test_delivery_port_blocked: extend grep patterns to current madmail variants.
  - test_hide_senders_ip_address: Use FETCH instead of UID SEARCH
    unsupported in madmail and scan through all fetched messages.
- run E2E tests from the deployed checkout, not the cached clone
- refactor(driver_base): discard stale checkout from get_git_main_path
@j4n
j4n force-pushed the j4n/madmail-main branch from bee86a1 to 6bb72c2 Compare August 20, 2026 11:23
@j4n

j4n commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

i think the timeout 30 -> 60 was really about allowing CI to finish, and you removed it in force-push. please also squash everything to a single commit, and make sure CI passes. It's getting ready for merge.

Yes, as I wrote in the reply to your question, I checked the times and decided that 10 minutes headroom with the current 30min limit for runs with source-build are enough, so I removed it. Pushed the squashed single commit now.

@j4n
j4n merged commit c50efd0 into main Aug 20, 2026
2 checks passed
@j4n
j4n deleted the j4n/madmail-main branch August 20, 2026 12:54
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.

2 participants