Skip to content

fix(utils): return isValid:false in validationApi after all retries fail #60

Description

@tmdeveloper007

Summary of What Needs to be Done

src/utils/validationApi.js — after all retry attempts are exhausted (network errors, timeouts, or 5xx errors), requestValidation returns:

return createValidationResponse(true, "", { error: lastError, ... });

createValidationResponse(true, "") sets isValid: true and message: "". This incorrectly signals to form validators that the input is valid when the validation actually failed. The skippedDueToError: true flag in extras is insufficient — callers check isValid first.

Changes

Change the final return after all retries fail to createValidationResponse(false, networkMessage, { error: lastError, isTimeout, isNetworkError }). This correctly marks the validation as failed and surfaces the appropriate error message to the user.

Impact

  • Incorrect validation behavior: Users see a green success state even when the API was unreachable, timeouts occurred, or the server returned 5xx errors. This could allow invalid data to pass through form validation silently.
  • Security: Validation that appears to pass but actually failed could bypass security checks (e.g., username uniqueness validation on registration forms).

Please assign this task to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gssoc:approvedApproved for GSSoC contributionlevel:beginnerSmall, low-risk change (≤3 files, ≤50 lines)type:bugSomething is broken or incorrect

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions