test(migrator): resolve latest exported AccountDatabase schema dynamically #478

Merged
JMR-dev merged 1 commits from test-477-migrator-latest-schema into main 2026-07-10 05:18:47 +00:00
JMR-dev commented 2026-07-10 04:52:11 +00:00 (Migrated from github.com)

Fixes issue #477.

migratorDdlMatchesExportedAccountDatabaseSchema in AccountDataMigratorTest hardcoded the schema-version asset filename it validates the migrator's DDL against (.../AccountDatabase/2.json). Every future AccountDatabase schema bump would have to remember to bump this filename too, or the guard would silently keep validating against a stale schema version — the footgun that let PR #472's authError/v3 drift slip past this guard while breaking E2E.

This change resolves the highest-versioned exported schema JSON dynamically from the androidTest assets at runtime (AssetManager.list("org.libremail.data.local.AccountDatabase")), and fails loudly via assertNotNull if no schema asset is found (e.g. if schemas/ stops being wired as an androidTest asset srcDir).

Test-only change, no product code or schema files touched. On main (AccountDatabase at v2), the resolved path is still org.libremail.data.local.AccountDatabase/2.json — identical behavior to before, just computed instead of hardcoded.

Closes #477

Fixes issue #477. `migratorDdlMatchesExportedAccountDatabaseSchema` in `AccountDataMigratorTest` hardcoded the schema-version asset filename it validates the migrator's DDL against (`.../AccountDatabase/2.json`). Every future `AccountDatabase` schema bump would have to remember to bump this filename too, or the guard would silently keep validating against a stale schema version — the footgun that let PR #472's `authError`/v3 drift slip past this guard while breaking E2E. This change resolves the **highest-versioned** exported schema JSON dynamically from the androidTest assets at runtime (`AssetManager.list("org.libremail.data.local.AccountDatabase")`), and fails loudly via `assertNotNull` if no schema asset is found (e.g. if `schemas/` stops being wired as an androidTest asset srcDir). Test-only change, no product code or schema files touched. On `main` (`AccountDatabase` at v2), the resolved path is still `org.libremail.data.local.AccountDatabase/2.json` — identical behavior to before, just computed instead of hardcoded. Closes #477
mergify[bot] commented 2026-07-10 05:13:11 +00:00 (Migrated from github.com)

Merge Queue Status

  • ✅ Entered queue — 2026-07-10 05:13 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-07-10 05:18 UTC · at 17985cb04c1a06fbbf6abab053978570dadc56e3 · merge

This pull request spent 5 minutes 39 seconds in the queue, including 1 second running CI.

Required conditions to merge
<!--- DO NOT EDIT -*- Mergify Payload -*- {"version": 1, "state": "merged", "queue_rule_name": "default", "queued_at": "2026-07-10T05:13:08.916205+00:00", "estimated_time_of_merge": null, "speculative_check_pr": null, "required_conditions": []} -*- Mergify Payload End -*- --> # Merge Queue Status - ✅ **Entered queue** — `2026-07-10 05:13 UTC` · Rule: `default` · triggered by merge protections - ✅ **Checks skipped** · PR is already up-to-date - ✅ **Merged** — `2026-07-10 05:18 UTC` · at `17985cb04c1a06fbbf6abab053978570dadc56e3` · merge This pull request spent **5 minutes 39 seconds** in the queue, including **1 second** running CI. <details> <summary>Required conditions to merge</summary> - `-conflict` - [X] #478 - `-draft` - [X] #478 - [X] `base = main` - [X] `check-success = CI passed` - `github-review-approved` [🛡 GitHub repository ruleset rule `main`] - [X] #478 - `label != broken` - [X] #478 - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = Debug build` - [ ] `check-neutral = Debug build` - [ ] `check-skipped = Debug build` - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = Unit tests` - [ ] `check-neutral = Unit tests` - [ ] `check-skipped = Unit tests` - [X] any of [🛡 GitHub branch protection]: - [X] `check-success = CI passed` - [ ] `check-neutral = CI passed` - [ ] `check-skipped = CI passed` - [X] any of [🛡 GitHub repository ruleset rule `main`]: - [X] `check-success = @github-actions/CI passed` - [ ] `check-neutral = @github-actions/CI passed` - [ ] `check-skipped = @github-actions/CI passed` </details>
Sign in to join this conversation.