Skip to content

fix(user): migrate lastReultHashes typo to lastResultHashes safely (@mukundangopalachary)#7830

Open
mukundangopalachary wants to merge 1 commit intomonkeytypegame:masterfrom
mukundangopalachary:fix/lastreulthashes-typo
Open

fix(user): migrate lastReultHashes typo to lastResultHashes safely (@mukundangopalachary)#7830
mukundangopalachary wants to merge 1 commit intomonkeytypegame:masterfrom
mukundangopalachary:fix/lastreulthashes-typo

Conversation

@mukundangopalachary
Copy link
Copy Markdown

Description

This PR fixes a typo in the user hashes field used for duplicate-result detection.

Problem:

  • The codebase used a misspelled key: lastReultHashes.
  • This creates long-term schema/DB inconsistency and makes future updates risky.

Repro (before this change):

  1. Inspect user schema and backend result logic.
  2. Notice reads/writes use lastReultHashes (typo) instead of lastResultHashes.
  3. Any new code using the correct key would not align with existing data shape.

Approach:

  • Read from both keys for backward compatibility:
    • lastResultHashes ?? lastReultHashes ?? []
  • Write to the corrected key lastResultHashes.
  • Unset legacy key lastReultHashes during updates.
  • Keep both keys in schema for compatibility during migration.
  • Exclude both keys from relevant user response shaping.

Checks

  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.
    Closes #
    Suggested PR title format (per their rule):
  • fix(user): migrate lastReultHashes to lastResultHashes safely (@mukundangopalachary)

Copilot AI review requested due to automatic review settings April 15, 2026 05:04
@monkeytypegeorge monkeytypegeorge added backend Server stuff packages Changes in local packages labels Apr 15, 2026
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a long-standing typo in the user document field used for duplicate-result detection, while keeping backward compatibility with existing MongoDB data.

Changes:

  • Add correct lastResultHashes alongside legacy lastReultHashes in the shared UserSchema.
  • Update backend write-path to write lastResultHashes and unset lastReultHashes.
  • Update backend read-path to fallback lastResultHashes ?? lastReultHashes ?? [] and exclude both from user response shaping.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/schemas/src/users.ts Adds lastResultHashes while retaining legacy lastReultHashes for compatibility.
backend/src/dal/user.ts Migrates writes to lastResultHashes and unsets legacy key during updates.
backend/src/api/controllers/user.ts Ensures neither hash field is included in “relevant user info” responses.
backend/src/api/controllers/result.ts Reads from corrected key first, then legacy, for duplicate detection.

@mukundangopalachary mukundangopalachary changed the title fix: migrate lastReultHashes typo to lastResultHashes safely fix(user): migrate lastReultHashes typo to lastResultHashes safely (@mukundangopalachary) Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Server stuff packages Changes in local packages waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants