feat(addon): build & test the add-on locally as a system add-on#955
Merged
Conversation
Add a `:local` build path that produces the system/built-in add-on (system id, dev-mode bundle) wired to a locally running Send backend + client, so the system-add-on code path can be exercised end-to-end against localhost. - build:dev:system:local / sync:builtin:local / dev:builtin:local scripts set ADDON_ENV=local. - scripts/build.sh, on ADDON_ENV=local, builds in Vite development mode (import.meta.env.MODE === 'development' so the frontend probes the local backend for storage type and prod Sentry stays off) and forces localhost URLs (VITE_SEND_SERVER_URL/CLIENT_URL, stage OIDC) as exported VITE_* vars, which Vite's loadEnv prioritizes over the .env prod block. Each is overridable inline for different local ports. - README documents the workflow, that CORS already works (the backend auto-allows moz-extension:// origins), and three ways to get past the tls-dev-proxy self-signed cert (OS trust + enterprise roots, a persistent profile exception, or targeting the plain-HTTP backend on :8080). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
radishmouse
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Adds a supported workflow to build the add-on locally as the system / built-in add-on (the privileged form that ships vendored in comm-central as
thundermail), plus a:localvariant that wires that build to a locally running Send backend.WIP build locallycommit):build:dev:system,sync:builtin,dev:builtinscripts;scripts/build.shrewrites the builtdist/manifest.jsonto the system id (scripts/set-system-id.ts, with--allow-stagefor dev builds) andscripts/sync-to-builtin.shrsyncs the build into a comm-central checkout's built-in location. Unit tests forset-system-id.feat(addon): build the system add-on against a local backendcommit):build:dev:system:local/sync:builtin:local/dev:builtin:localsetADDON_ENV=local, which makesbuild.shbuild in Vite development mode (import.meta.env.MODE === 'development', so the frontend probes the local backend for its storage type and prod Sentry stays off) and force localhost URLs (VITE_SEND_SERVER_URL/CLIENT_URL, stage OIDC) as exportedVITE_*vars — which Vite'sloadEnvprioritizes over the.envprod block. Each is overridable inline for different local ports.moz-extension://origins, and the built-in add-on still runs under such an origin), and gives three ways to get past the tls-dev-proxy self-signed cert.AI disclosure: Written by an AI agent (Claude) working interactively with the author, who directed the approach, verified the build end-to-end (system id + baked localhost URLs), confirmed it runs in Thunderbird against the local Docker stack, and reviewed every change. The
WIP build locallybase commit is the author's prior work.Why?
Resolves the gap described in #947: the existing scripts (
build,build:dev,deploy-xpi) only emit an XPI for temporary/regular installation, so the system-add-on code path (different privileges, built-in location, system-id shadowing) couldn't be reproduced or debugged locally. The:localvariant additionally lets that system build talk to a local Send backend for full end-to-end testing.Limitations and Notes
https://localhost:8088via a self-signed cert. Thunderbird's extensionfetchcan't skip validation, so an untrusted cert surfaces as a misleadingCORS request did not succeed / Status: (null). The README covers three fixes: OS-level trust +security.enterprise_roots.enabled(recommended, survives--temp-profile), a persistent-profile cert exception, or targeting the plain-HTTP backend on:8080(works with--temp-profilebut breakswssuploads).auth-stage.tb.pro) since there's typically no local Keycloak; overrideVITE_OIDC_ROOT_URLif you run one.Applicable Issues
Closes #947
Screenshots
N/A — build tooling / developer workflow.