test(gamification): pin aggregate level to #11604 XP-derived semantics - #11676
Merged
diegosouzapw merged 1 commit intoAug 26, 2026
Conversation
…ved semantics diegosouzapw#11604 changed getAggregateXp() to derive currentLevel from the summed XP (calculateLevel(SUM(total_xp))) instead of MAX(stored current_level), so the operator-wide profile level is consistent with the XP it displays. The diegosouzapw#3484 test still asserted the old semantics and used fixture levels that don't match the XP curve (100 XP -> level 2, 250 XP -> level 5 are impossible). Align the fixtures to the curve (both keys level 1) and assert the derived level (350 XP -> level 2).
Contributor
Author
diegosouzapw
merged commit Aug 26, 2026
146897d
into
diegosouzapw:release/v3.8.51
13 of 29 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ved semantics (diegosouzapw#11676) Merged via /merge-batch (2026-08-26, v3.8.51). Boarded no worktree combinado; validação única: typecheck/complexity/cognitive-complexity/file-size/changelog verdes, lint nos mesmos 228 achados pré-existentes confirmados contra o tip puro, testes focados passando. Obrigado pela contribuição.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was broken
tests/unit/gamification/aggregate-profile-3484.test.tsfailed onrelease/v3.8.51(and PR #11644's CI):Root cause
#11604 (
fix(dashboard): keep Profile XP and level consistent) deliberately changedgetAggregateXp()insrc/lib/db/gamification.ts:The aggregate level must be derived from the same summed XP the profile displays. The #3484 test still asserted the old
MAX(stored level)semantics — and its fixtures were off-curve anyway (100 XP → level 2and250 XP → level 5are impossible on the XP curve where level 2 requires 282 XP).Fix
tests/unit/gamification/aggregate-profile-3484.test.ts(lines 50–65):key-a: 100 XP / level 1,key-b: 250 XP / level 1(both individually level 1; sum 350 crosses the level-2 threshold of 282).currentLevel === 2(calculateLevel(350)), pinning the fix(dashboard): keep Profile XP and level consistent #11604 semantics.Green evidence (after)
Files:
tests/unit/gamification/aggregate-profile-3484.test.ts,changelog.d/fixes/11604-aggregate-profile-level-pin.md.