Skip to content

fix: address remaining CodeRabbit review issues in backend#25

Merged
naheel0 merged 2 commits intobackendfrom
copilot/sub-pr-22
Mar 15, 2026
Merged

fix: address remaining CodeRabbit review issues in backend#25
naheel0 merged 2 commits intobackendfrom
copilot/sub-pr-22

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

Four issues flagged by CodeRabbit remained unresolved: JWT encoding mismatch between Program.cs and AuthController, missing GitHubId unique index in the initial migration, and misleading success response when a user record is missing during quest submission.

Changes

  • Program.cs — Changed Encoding.ASCIIEncoding.UTF8 for JWT signing key bytes to match AuthController.cs. Mismatched encodings cause silent token validation failures for any key with non-ASCII characters.

  • InitialCreate.cs migration — Changed GitHubId column type from nvarchar(max) to nvarchar(450) and added IX_Users_GitHubId unique index directly in the initial schema. GitHubId is the stable external identity; GitHubUsername is mutable and insufficient as the sole uniqueness constraint.

  • AddUniqueConstraints.cs migration — Removed now-redundant AlterColumn for GitHubId and CreateIndex/DropIndex for IX_Users_GitHubId since these are handled in InitialCreate.

  • IssuesController.csSubmitQuest — Return 404 immediately when the user record is not found, rather than silently skipping XP/streak updates and returning a misleading "XP Awarded!" with totalXp: null.

var user = await _context.Users.FindAsync(userId);
if (user == null)
    return NotFound("User account not found.");

user.ExperiencePoints += issue.XPReward;
// ... streak logic ...
return Ok(new { message = $"{issue.XPReward} XP Awarded!", totalXp = user.ExperiencePoints });

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement core backend logic for improved authentication and database fix: address remaining CodeRabbit review issues in backend Mar 15, 2026
Copilot AI requested a review from jaseel0 March 15, 2026 14:03
@naheel0 naheel0 marked this pull request as ready for review March 15, 2026 14:21
@github-actions github-actions bot added the configuration Configuration file changes label Mar 15, 2026
@naheel0 naheel0 merged commit 17bceb5 into backend Mar 15, 2026
6 checks passed
@naheel0 naheel0 deleted the copilot/sub-pr-22 branch March 15, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Configuration file changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants