Skip to content

chore: bump gorm to 1.30.0 + fix dotted map-keyed Where regression#75

Merged
SyniRon merged 1 commit into
developfrom
chore/gorm-bump-with-fix
May 20, 2026
Merged

chore: bump gorm to 1.30.0 + fix dotted map-keyed Where regression#75
SyniRon merged 1 commit into
developfrom
chore/gorm-bump-with-fix

Conversation

@SyniRon

@SyniRon SyniRon commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bumps gorm + fixes a real regression the bump exposes.

Deps:

  • gorm.io/driver/mysql v1.5.7 → v1.6.0
  • gorm.io/gorm v1.25.12 → v1.30.0 (transitive via the driver bump — 5 minor versions)

Code fix: FindProfileByKeycloakID and FindProfileByDiscordID in datastores/mysql.go built their WHERE clauses with a map[string]interface{} keyed on xf_user_connected_account.provider / .provider_key. gorm 1.25 forwarded those dotted keys verbatim; gorm 1.26+ treats the whole map key as a column name and prefixes it with the current model's table, producing xf_nf_rosters_user.xf_user_connected_account.provider — a three-part qualifier MariaDB rejects with 1054 Unknown column ... in 'where clause'.

Without the fix, every Discord-ID and Keycloak-ID profile lookup returns 404 ("no user found"). Discovered when the user's Insomnia suite went 61/61 → 49/61 against the gorm-only build.

Fix swaps the dotted-key map for raw placeholder SQL so the joined-table column names stay unqualified through gorm's escape pass.

Test plan

  • go build ./... clean
  • go vet ./... clean
  • Local stack smoke against XF mirror: discord and keycloak lookups (Sypolt + Chance, both IDs) return 200 with the expected profile body
  • Canonical-jq diff of 11 other baseline endpoints (ranks, position-groups, awol, profile by id+username, full + lite rosters, s1-uniforms, tickets categories+list+single) — byte-for-byte identical content vs pre-bump develop
  • User re-runs Insomnia suite — expect 61/61

Supersedes #60 — that PR was dep-only and needs this code fix to pass.

🤖 Generated with Claude Code

Bumps:
- gorm.io/driver/mysql v1.5.7 → v1.6.0
- gorm.io/gorm v1.25.12 → v1.30.0 (transitive via the driver bump)

Code fix needed for the bump:

FindProfileByKeycloakID and FindProfileByDiscordID built their WHERE
clauses with a map[string]interface{} keyed on
"xf_user_connected_account.provider" / ".provider_key". gorm 1.25
forwarded such dotted keys verbatim. gorm 1.26+ (so 1.30 here)
treats the entire map key as a column name and prefixes it with
the current model's table, producing nonsense like
`xf_nf_rosters_user`.`xf_user_connected_account`.`provider`
in the rendered SQL — a three-part qualifier MariaDB rejects with
"Unknown column ... in 'where clause'".

Effect on develop: discord/keycloak ID lookups returned 404
("no user found") for every input. Insomnia suite went 61/61 → 49/61.

Fix: replace the dotted-key map with raw placeholder SQL on both
functions so the joined-table column names stay unqualified through
gorm's escape pass.

Smoked locally against a fresh XF DB mirror — both lookups return
200 with the expected profile, and the canonical-jq diff of the
other 11 baseline endpoints (ranks / position-groups / awol /
profile by id+username / full + lite rosters / s1 uniforms /
tickets categories+list+single) shows byte-for-byte identical
JSON content vs the pre-bump develop responses.

Supersedes #60.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@SyniRon
SyniRon merged commit ce7d22e into develop May 20, 2026
2 checks passed
@SyniRon
SyniRon deleted the chore/gorm-bump-with-fix branch May 20, 2026 00:19
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