Files
inbuxa-server/tools/fork
jcoffey-dev cc6f1eb298
ci / fork-checks (pull_request) Successful in 16s
ci / build (pull_request) Successful in 7m53s
Rename the identifiers that carried the upstream name
Everything clients, users and operators meet now carries the fork's name,
with no aliases (SPEC.md §2.4, changed here from "protocol identifiers
stay"):

- JMAP: upstream's registry capability is urn:inbuxa:jmap:registry, beside
  the fork's own urn:inbuxa:jmap.
- WebDAV lock and sync tokens are urn:inbuxa:dav*; clients resync once.
- Sieve: vnd.inbuxa.while and vnd.inbuxa.expressions. sieve-rs spells these
  into its compiler, so it's vendored (vendor/sieve-rs, 0.7.3) and patched in;
  a unit test fails if Cargo.lock ever moves past the vendored copy. The
  trusted runtime now names itself too, rather than answering sieve-rs's
  default.
- The web interface's OAuth client is inbuxa-webui. On every start the old
  stalwart-webui client is removed and any application naming it is moved
  over.
- The spam filter's blobs are INBUXA_SPAM_*; every start moves any left
  under the old keys, so a trained model survives.
- SQL stores and log files default to inbuxa, in the code and in the
  schema served to the admin (checksum regenerated).
- Settings are INBUXA_* only. A STALWART_* variable that's set where its
  INBUXA_* one isn't stops the server at startup, naming it.
- The version-upgrade messages link docs.inbuxa.org's migration page, and
  the OpenAPI description, smtp crate metadata and web-push test fixtures
  lose the name.

Kept on purpose, allowlisted with reasons: the OAuth key-derivation
contexts (renaming them would end every session and invalidate every
sealed client id) and the hashed application prefix.

Also fixes a latent start-up failure: ensure_client updated an existing
first-party client with a revision of 0, which the registry's assertion
never matches, so adding a redirect URI or changing the webmail secret
failed start-up. And the principal session test now expects
legacyProtocols (C-1, added 2026-09-21), which it had missed.

Tested: the server builds without warnings; common's 106 unit tests,
including the vendoring check; a new integration test for the two
start-up migrations; and the webdav, jmap, imap and SMTP Sieve suites.
2026-09-22 19:33:02 -07:00
..

Fork tooling

strip.py

Makes an Enterprise-free snapshot of an upstream release. See the docstring and docs/spec/SPEC.md §2.2 for what it does and why.

git clone https://github.com/stalwartlabs/stalwart.git ~/src/stalwart-upstream   # outside this repo
git -C ~/src/stalwart-upstream fetch --tags
tools/fork/strip.py --upstream ~/src/stalwart-upstream --ref v0.16.22 --out /tmp/strip-v0.16.22

It writes OUT/tree (the stripped source) and OUT/STRIP-REPORT.md and .json. Exit 0 means verified clean. Exit 1 means malformed markers, or something Enterprise-only survived. Read the report's Problems section.

The report's Third-party code section lists upstream code under other licenses. Files marked new need their notice added to THIRD-PARTY.md at the repository root before the import is merged.

It needs Python 3.12+ (for tarfile's data filter), git and cargo.

Two passes run after the strip:

  • Renames. The upstream name is replaced where it's an identifier clients, users or operators meet: wire-protocol names, the web interface's client id, store keys, configuration defaults and the served schema, as renames.py lists them. main was renamed with the same module. A re-import arrives purged, so those lines never conflict. Copyright notices and prose are left alone. The report lists every substitution by file.
  • Build check. The stripped tree is compiled (cargo check --workspace --all-targets) into target/strip-check, which stays warm between imports. A file that survived the strip but calls code that didn't fails the run; the report names it. Handle it in the merge into main, never on upstream: upstream holds the strip's output and nothing else. Imports the strip left unused are listed without failing. --no-build-check skips the pass.

name-check.py

Fails when the upstream project's name appears in a Rust string literal that name-allowlist.txt doesn't list. CI runs it on every push and pull request, so an upstream merge can't bring the name back into what users and operators see. Comments, copyright headers and test directories aren't checked.

tools/fork/name-check.py          # exit 1 on anything new
tools/fork/name-check.py --list   # every finding, in allowlist format

Rename what it reports. If a string has to stay, such as a key-derivation context or a wire-protocol identifier, add its --list line to the allowlist under the reason it stays.

notice-check.py

Fails when an upstream file the fork changed doesn't carry the AGPL 5(a) notice, Modified by Coffey Labs in <year> for INBUXA., under upstream's license line. "Changed" means it differs from the upstream branch, so the list comes from the diff, not from memory. CI runs it beside the name check.

tools/fork/notice-check.py          # exit 1 on a missing notice
tools/fork/notice-check.py --fix    # add it where it's missing

Run --fix after resolving an upstream merge: a conflict resolved by taking upstream's side can drop a notice the file had.

record-compat.py

Records what the *_compat tests compare against, from the Enterprise server, while it is still running. Read-only: /get and /query only. See docs/spec/compat-tests.md.

tools/fork/record-compat.py --server https://mail.example.org \
    --admin '[email protected]:PASSWORD' --out ./compat \
    --tenant-admin '[email protected]:PASSWORD'

run-compat.sh

Runs the *_compat tests against a copy of INBUXA's RocksDB store, making a fresh copy for each one. See docs/spec/compat-tests.md.

tools/fork/run-compat.sh --store /srv/inbuxa-copy/rocks.db \
    --admin '[email protected]:PASSWORD' --recordings ~/compat