mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Adv 2.0 L4f-prep: flip DisplayName readers to loadDisplayName
Swap all char.DisplayName / c.DisplayName reader sites in internal/plugin/ to loadDisplayName(userID). Touches 12 files across combat (combat_bridge, dnd_zone_combat, dnd_zone_cmd, dnd_expedition_combat), arena, hospital, events, render, masterwork, robbie, scheduler, and adventure.go. Only intentional char.DisplayName references remaining are in adventure_character.go (scan + save + dual-write) and the player_meta.go doc comment. go vet + go test ./internal/plugin/... clean. Unblocks deferred L2 step 9 (arena AdvCharacter import drop) once L4 hospital/pets/render also lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -314,9 +314,11 @@ This is also the right shape because zone-boss plumbing (bestiary, mood events,
|
||||
- `player_meta.display_name` column added via column migration in `internal/db/db.go`.
|
||||
- `backfillPlayerMetaDisplayName` runs on every Init: idempotent (`UPDATE ... WHERE display_name = ''` only touches empty rows, so dual-writes layered on top survive re-runs).
|
||||
- `upsertPlayerMetaDisplayName(userID, name)` dual-writes from `createAdvCharacter` (inside the same tx, atomic with the AdvCharacter INSERT) and `saveAdvCharacter` (post-commit, error-logged but non-fatal).
|
||||
- `loadDisplayName(userID)` reads `player_meta` → falls back to `adventure_characters.display_name` → empty string if neither exists. Helper exists but **readers are NOT flipped yet** — soak week begins now; per-call-site flip happens in a follow-up session once we've confirmed dual-write doesn't drift.
|
||||
- `loadDisplayName(userID)` reads `player_meta` → falls back to `adventure_characters.display_name` → empty string if neither exists.
|
||||
- Tests: `TestPlayerMetaDisplayNameBackfill_Idempotent`, `TestLoadDisplayName_FallsBackToAdvCharacter`, `TestCreateAdvCharacter_DualWritesDisplayName`.
|
||||
|
||||
**Reader flip SHIPPED (2026-05-09).** All `char.DisplayName` / `c.DisplayName` reader sites in `internal/plugin/` were swapped to `loadDisplayName(userID)` (or pass-through equivalents) across: `combat_bridge.go`, `dnd_zone_cmd.go`, `dnd_expedition_combat.go`, `dnd_zone_combat.go`, `adventure_robbie.go`, `adventure_scheduler.go`, `adventure_hospital.go`, `adventure_events.go`, `adventure_render.go`, `adventure_masterwork.go`, `adventure.go`, `adventure_arena.go`. The only remaining `char.DisplayName` references are in `adventure_character.go` itself (scan into struct + `saveAdvCharacter` SQL + dual-write to `player_meta`) and the `player_meta.go` doc comment. `go vet` + `go test ./internal/plugin/...` clean.
|
||||
|
||||
**Pre-conditions:**
|
||||
- L1–L4 all shipped.
|
||||
- DisplayName migrated to `player_meta` (see above).
|
||||
|
||||
Reference in New Issue
Block a user