Skip to content

Preserve WoW card metadata when Blizzard sends blank fields - #41

Merged
Lucrona merged 1 commit into
wow-playedfrom
fix/wow-profile-nonempty-guards
Nov 11, 2026
Merged

Lucrona merged 1 commit into
wow-playedfrom
fix/wow-profile-nonempty-guards

Conversation

@Lucrona

@Lucrona Lucrona commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Treat empty and whitespace-only Blizzard names and gender as missing; preserve saved class, race, gender and specialization when metadata is absent.
  • Accept only positive, representable levels and positive new Battle.net IDs. Existing non-NULL Battle.net IDs remain immutable.
  • Keep the write set limited to card metadata and refresh timestamps; no changes to hours, sessions, uploads, verification, ownership, visibility, guild or media caches.

Regression coverage

  • Separate Retail and Forever integration tests cover missing, NULL, empty, ASCII-whitespace and Unicode-whitespace metadata, localized names, zero/negative/overflow levels, immutable IDs, valid updates and older login timestamps.
  • Full-row snapshots preserve all unrelated character fields; related snapshots preserve /played history, hours, sessions and cached guild/avatar/media.

Validation

  • CI run 43089661255: both Linux and Windows jobs succeeded, verified at head 8da63578e41162e66428f54b8f3aa540a21876a3.
  • CI passed formatting, whole-workspace clippy with -D warnings, whole-workspace tests, UI regression tests and the simulation smoke run.
  • Local cargo fmt --all -- --check: passed.
  • Local UI regression tests: 34 passed.
  • Local server/core/sync clippy with -D warnings: passed.
  • Local server/core/sync tests: 350 passed, 0 failed, 3 ignored, including both new Retail and Forever integration tests. Used a freshly initialized, isolated local PostgreSQL cluster, now stopped; no user data.
  • Full local workspace clippy/tests were attempted but could not build desktop dependencies because pkg-config/GTK/WebKit are absent and the package mirror is blocked. The full workspace checks subsequently passed in CI.

Complete refresh write set

  • bnet_level: positive i32 only; missing, zero, negative or overflow preserves saved value.
  • bnet_last_login: valid integer-millisecond timestamp only; missing/invalid preserves, greatest prevents regression.
  • class: trimmed nonblank name, normalized to uppercase ASCII letters; empty result becomes NULL, coalesce preserves saved value.
  • race: trimmed nonblank name (plain or en_US), capped at 40 characters; missing/blank preserves.
  • gender: trimmed nonblank type, lowercased; missing/blank preserves.
  • bnet_spec: same guarded name handling as race; missing/blank preserves.
  • faction: exact Blizzard stable HORDE/ALLIANCE enum only; missing/blank/unknown preserves.
  • bnet_id: existing non-NULL ID always wins; only a positive integer can fill NULL.
  • bnet_checked_at: set to now() as the refresh bookkeeping timestamp.

Guild/avatar/media are not written by this function. No migration, merge, deployment or live server access. No user data touched.

@Lucrona
Lucrona merged commit 54f8201 into wow-played Nov 11, 2026
2 checks passed
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.

1 participant