Skip to content

Conversation

@tudddorrr
Copy link
Collaborator

No description provided.

@tudddorrr tudddorrr added the fix This pull request contains a fix label Dec 1, 2025
@claude
Copy link

claude bot commented Dec 1, 2025

🔴 Code Quality & Best Practices

Missing service trim for Steam identifiers

In PlayerAlias.resolveIdentifier() (src/entities/player-alias.ts:50-68), the service parameter is only trimmed for non-Steam services:

if (service.trim() === PlayerAliasService.STEAM) {
  // Steam processing
}
return identifier.trim()

However, if service has leading/trailing whitespace and is NOT Steam, it will be passed untrimmed to the final return statement. The identifier gets trimmed, but service does not consistently get trimmed in all code paths. This could cause issues if the service string has whitespace but doesn't match PlayerAliasService.STEAM after trimming.

Suggested fix:

static async resolveIdentifier(
  req: Request,
  game: Game,
  service: string,
  identifier: string
): Promise<string> {
  const trimmedService = service.trim()
  const trimmedIdentifier = identifier.trim()
  
  if (trimmedService === PlayerAliasService.STEAM) {
    const em = req.ctx.em as EntityManager
    const integration = await em.repo(Integration).findOne({
      game,
      type: IntegrationType.STEAMWORKS
    })

    if (integration) {
      return integration.getPlayerIdentifier(req, trimmedIdentifier)
    }
  }

  return trimmedIdentifier
}

✅ Other Categories

Potential bugs or issues

No issues found - the refactoring correctly eliminates duplicate Steam API calls.

Performance considerations

No issues found - this PR successfully improves performance by preventing duplicate API calls.

Security concerns

No issues found - the authentication flow remains unchanged.

Test coverage

No issues found - tests correctly verify that Steam API methods are called only once instead of twice.

@tudddorrr tudddorrr force-pushed the stop-double-steam-identity-fetch branch from a2aafba to 605418c Compare December 1, 2025 01:37
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.21%. Comparing base (5571071) to head (b0c82fe).
⚠️ Report is 11 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #707   +/-   ##
========================================
  Coverage    99.21%   99.21%           
========================================
  Files          225      225           
  Lines        16608    16612    +4     
  Branches      1538     1538           
========================================
+ Hits         16477    16481    +4     
  Misses         128      128           
  Partials         3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tudddorrr tudddorrr force-pushed the stop-double-steam-identity-fetch branch 2 times, most recently from ccf5e92 to f330519 Compare December 1, 2025 17:23
@tudddorrr tudddorrr force-pushed the stop-double-steam-identity-fetch branch from f330519 to b0c82fe Compare December 1, 2025 17:45
@tudddorrr tudddorrr enabled auto-merge December 1, 2025 17:45
@tudddorrr tudddorrr merged commit 5f3cef7 into develop Dec 1, 2025
4 checks passed
@tudddorrr tudddorrr deleted the stop-double-steam-identity-fetch branch December 1, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix This pull request contains a fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants