Prompt Details
Model
(gemini-3.1-pro)
Token size
973
Example input
[INSERT TASK OR FEATURE]: build a login form with client-side validation and error messages
[INSERT CODE OR OUTPUT TO VERIFY]: React component generated by an AI coding assistant
[INSERT EXPECTED BEHAVIOR]: validates email and password, shows clear errors, prevents invalid submission, and handles loading state
[INSERT TECH CONTEXT]: React, TypeScript, frontend web app
[INSERT MAIN CONCERN OR QUALITY STANDARD]: correctness, edge-case handling, and clean user experience
Example output
# **QA Coding Agent Verifier**
## **1\) Verification Snapshot**
This verification evaluates a React TypeScript login form implementation focused on client-side validation, error messaging, and submission logic. The output appears **partially correct but risky** for production. The strongest sign of sound implementation is the likely use of controlled components or a form library (like React Hook Form) to manage state. However, the biggest reason for potential failure is the high probability of "shallow" validation (e.g., checking for any string instead of valid email patterns) and a lack of robust handling for the transition between the loading state and server-side error feedback.
## **2\) Requirement Alignment Check**
* **Requirements:** A login form requiring email/password validation, error UI, submission prevention for invalid data, and loading states.
* **Alignment:** The output aligns with basic UI requirements but often lacks "round-trip" reliability.
* **Covered:** Basic state management (useState), form submission event handling, and conditional rendering for error strings.
* **Missing/Under-implemented:** Accessible error messages (ARIA live regions), "dirty" state tracking (showing errors only after interaction), and password visibility toggles.
* **Assumptions:** We assume a standard regex for email validation is used and that the loading state disables the submit button.
## **3\) Correctness Review**
* **Logic:** High-level logic likely follows handleEmailChange \-\> validate \-\> setError.
* **Potential Breaks:** The implementation may break if validation is only triggered on onSubmit, allowing a "bad" UX where users type into an invalid form without feedback.
* **Omissions:** Lack of debounce on validation or failing to clear previous errors when the user starts re-typing.
* **Closest Inspection:** The useEffect or validation function triggers; circular re-renders are common in manual React form implementations.
* **Status:** **Prototype-level**. It likely functions but lacks the polish required for a high-traffic production app.
## **4\) Failure and Bug Risk Scan**
1. **The "Stuck Loading" Bug:** If the submission promise fails and the setLoading(false) isn't in a finally block.
2. **The "Zombie Error" Bug:** Error messages persisting after a user has corrected the field but before they hit submit again.
3. **Regex Inefficiency:** A complex email regex that causes ReDoS (Regular Expression Denial of Service) or incorrectly rejects valid alias emails (e.g., user+extra@domain.com).
4. **Input Sanitization:** Failure to trim whitespace, causing valid logins to fail because of a trailing space.
5. **Double Submission:** A user clicking "Login" twice rapidly before the loading state disables the button.
* **Matters most now:** Double submission prevention.
* **Most likely overlooked:** Whitespace trimming.
* **Most damage:** The "Stuck Loading" bug (kills user conversion).
* **Easiest fix:** Adding a trim() call to inputs.
## **5\) Edge Case Review**
* **Top Edge Cases:**
1. Paste behavior (does validation fire when text is pasted?).
2. Auto-fill (browsers filling fields without onChange events firing correctly).
3. Extremely long inputs (buffer/UI overflow).
4. Submission while offline.
5. Disabling JS (not applicable for React, but worth noting for SSR/Hydration).
* **Likely Missing:** Handling of auto-fill and paste-triggered validation.
* **Breakage Factor:** Interrupted network during the "Loading" state.
## **6\) Code Quality and Reliability Review**
* **Readability:** Likely uses standard React patterns, but if logic is inline in the JSX, maintainability is low.
* **Structure:** Best practice suggests a separate useLoginForm hook or a validation schema (Zod/Yup). If everything is in one component, it is fragile.
* **Reliability:** Fragile under "abnormal" use (e.g., hammering the enter key).
* **Error Gaps:** Often fails to distinguish between *validation* errors (client-side) and *auth* errors (server-side).
## **7\) Tech Context Fit**
* **Appropriateness:** React/TS is perfect for this. TS ensures the Error state isn't accidentally assigned a number or object.
* **Idiomaticity:** If the agent used any types for events or state, it is non-idiomatic TS.
* **Mismatch Risk:** Using document.getElementById instead of React refs or state—a common mistake for lower-tier agents.
## **8\) Testing Priorities**
* **5 High-Priority Tests:**
1. Valid Email/Password \-\> Submit \-\> Verify Loading State.
2. Invalid Email Format \-\> Verify Error Message appears.
3. Empty Submission \-\> Verify Prevention.
4. Password \< Minimum Length \-\> Verify Error Message.
5. Rapid Double Click \-\> Verify only one API call.
* **3 Smoke Tests:** (1) Form renders, (2) Typing works, (3) Button exists.
* **3 Deeper Validations:** (1) TS Type safety check, (2) Accessibility/Tab-order check, (3) Paste-event validation.
* **3 Negative Tests:** (1) SQL Injection strings, (2) Script tags in inputs, (3) 1MB string input.
* **First Test:** **Empty Submission Prevention**. If this fails, the client-side validation requirement is fundamentally unmet.
## **9\) Revision Guidance**
* **Fix First:** Ensure loading state is properly reset in a catch or finally block.
* **Clarify:** Are we using a library (Formik/RHF) or raw state? If raw, refactor to a hook.
* **Prototype vs Production:** Prototype is fine with basic regex; Production needs internationalized error strings and ARIA labels.
* **Simplify:** Remove redundant state variables; use a single form object state instead of individual strings.
* **Decision:** **Revise**. The "Stuck Loading" and "Double Submission" risks are too high for immediate approval.
## **10\) Approval Decision View**
* **Strict QA:** **Reject**. Fails to account for race conditions and accessibility standards required for login portals.
* **Balanced Engineering:** **Approve with Revisions**. The core logic is likely there, but the edge cases (trimming, loading reset) need a second pass.
* **Speed-Focused Prototype:** **Approve**. It meets the visual and functional requirements for a demo.
## **11\) Priority Action Plan**
* **Top 5 Actions:**
1. Implement whitespace trimming.
2. Wrap submission in try/catch/finally.
3. Add disabled={loading} to the submit button.
4. Add aria-invalid and role="alert" for errors.
5. Unit test the validation regex.
* **Immediate (3):** trim(), disabled button, and finally block for loading.
* **Wait:** Multi-language support and advanced animation for error messages.
* **Don't Ignore:** Accessibility. Login forms are the most critical entry point for all users.
**Final Summary:** Confidence is **Moderate (6/10)**. The agent likely built a form that "looks" right, but the "hidden" logic for robustness—specifically around network failure and user input quirks—requires manual hardening.
By purchasing this prompt, you agree to our terms of service
GEMINI-3.1-PRO
Turn code, requirements, and expected behavior into a structured QA review that checks correctness, gaps, risks, and likely failure points.
...more
Added 2 weeks ago
