Skip to content

fix(profile): expose LongestStreak on GET /api/profile for free-tier streak - #213

Merged
thomasluizon merged 1 commit into
mainfrom
fix/streak-free-tier
Jun 22, 2026
Merged

thomasluizon merged 1 commit into
mainfrom
fix/streak-free-tier

Conversation

@thomasluizon

@thomasluizon thomasluizon commented Jun 22, 2026 •

Copy link
Copy Markdown
Owner

What

Free users saw 0 for their longest streak ("Maior") because the streak detail page read the Pro-gated GET /api/gamification/streak. This exposes the already-stored user.LongestStreak on the ungated GET /api/profile, so free users get their real longest streak.

Why

Per #186 / #196, streak (current + longest) is intended to be a free feature; only the freeze/insights system stays Pro. currentStreak was already on /api/profile; longestStreak was not. Additive and backward-compatible (new response field).

Changes

  • ProfileResponse gains LongestStreak (from user.LongestStreak).
  • New GetProfileQueryHandler test asserting current + longest.
  • MCP ProfileTools test constructor updated.

Tests

Orbit.Application.Tests (126) + Orbit.Infrastructure.Tests (17) pass; builds clean.

Deploy order

Merge/deploy this before the client depends on the field. Clients read it defensively (?? 0), so an early client deploy degrades to 0 rather than crashing.

Paired PR

Frontend: thomasluizon/orbit-ui-mobile#248

Partial pull-forward of #186.

🤖 Generated with Claude Code

…streak

The streak detail page's "longest" stat read the Pro-gated
GET /api/gamification/streak, so free users always saw 0. Expose the
already-stored user.LongestStreak on the ungated /api/profile endpoint.
Additive and backward-compatible (new response field).

- ProfileResponse gains LongestStreak.
- Add GetProfileQueryHandler test; update MCP ProfileTools test ctor.

Partial pull-forward of #186 (free-tier entitlement rebalance).
Paired with orbit-ui-mobile fix/streak-free-tier.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, minimal fix. LongestStreak is already stored on User and maintained by streak logic — this PR simply plumbs it through ProfileResponse so free-tier clients get the real value from the ungated GET /api/profile endpoint instead of reading the Pro-gated gamification route. The change is purely additive (new response field), the new handler test exercises both streak values end-to-end, and the MCP test constructor is correctly updated. No correctness, security, or contract issues found.

@sonarqubecloud

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit 98cd587 into main Jun 22, 2026
6 checks passed
@thomasluizon
thomasluizon deleted the fix/streak-free-tier branch June 22, 2026 15:48
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