Commit b46628f
test(addon): add integration tests for stale-login-on-re-enable and the per-context init guard (#1044)
* test(addon): add integration specs for C2, D3 sync bugs
Adds the final two remaining Medium-priority specs (per
ADDON-BUG-REPORTS-2026-07-22.md) on top of the fake Thunderbird host
harness:
- C2: add-on re-enable trusts stale STORAGE_KEY_AUTH without backend
revalidation.
- D3: init.ts's single-flight guard only coordinates within a single
execution context, not across background/popup/web.
Together with the already-landed A-series, B-series, B5, and C1
specs, this completes the 13 confirmed sync/race bugs covered by
Tier 1 of the integration-test plan. Each asserts CONFIRMED BUG
behavior against the real production modules and is expected to
start failing once the corresponding fix lands (see harness README's
regression-test contract).
* docs(addon): add integration harness README and wire test:integration script (#1045)
- Adds src/test/integration/README.md: explains the Tier 1 fake-host
harness (what it simulates, what it deliberately stubs out,
the regression-test contract for CONFIRMED BUG specs, and current
coverage status/gaps).
- Adds packages/addon/package.json's test:integration script
(VITE_TESTING=true VITE_SEND_CLIENT_URL=... VITE_SEND_SERVER_URL=...
vitest run src/test/integration --silent) so the harness can be run
scoped, without needing the full addon .env.
- Adds the two source-of-truth e2e docs the harness/specs trace back
to: ADDON-BUG-REPORTS-2026-07-22.md (concise, spec-file-referenced
bug list) and ADDON-INTEGRATION-TEST-ENV-PLAN-2026-07-22.md (the
Tier 1/2/3 environment plan this harness implements Tier 1 of).
No CI changes in this PR -- see PR description / reviewer notes for
why the existing addon-changes job in .github/workflows/validate.yml
already covers this (it's path-filtered on packages/addon/** and
already runs `lerna run test --scope=addon`, i.e. `pnpm test`,
which picks up every spec under src/test/integration/ automatically
since vitest's default include glob is **/*.test.ts with no
directory exclusion). The new test:integration script is a
convenience for local/targeted runs; it does not need to be wired
into CI separately.
Co-authored-by: cagebot <cagebot@cagebots-Virtual-Machine.local>
* fix(addon): cross-context lock for init.ts default-folder recreate (#1046)
init.ts's single-flight guard (added for #930) is a module-scope
variable, so it only dedups concurrent calls within one JS context.
Background, popup, and any web-app tab each load their own copy of
the module, so none of them can see another context's in-flight
delete+recreate of the same account's default folder -- reintroducing
#930's race, just moved across contexts instead of within one.
Add a short-TTL lock in browser.storage.local (the one thing every
context actually shares) around just the delete+recreate branch,
keyed by account id. A context that can't acquire the lock re-syncs
and trusts whatever the lock holder leaves behind instead of racing
it. No-ops in any context without browser.storage.local (e.g. a plain
web-app tab with no sibling context to race against), so behavior
there is unchanged.
Updates the D3 integration test (packages/addon) to actually exercise
the fake host's shared browser.storage.local via two real fake-host
contexts, replacing the version that only proved the bug existed.
Adds a second spec asserting a racing context defers instead of
running its own delete+recreate while another context holds the lock
-- confirmed this fails against the pre-fix init.ts and passes with
the fix.
Fixes #1032
Co-authored-by: cagebot <cagebot@cagebots-Virtual-Machine.local>
---------
Co-authored-by: cagebot <cagebot@cagebots-Virtual-Machine.local>1 parent 872c2e8 commit b46628f
8 files changed
Lines changed: 1047 additions & 13 deletions
File tree
- packages
- addon
- src/test/integration
- send
- e2e
- frontend/src/lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
0 commit comments