Validate helloAction input on the server before constructing a greeting
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Start with the unvalidated argument in src/actions/hello-action.ts, then read the existing minimum-length Zod check in src/components/form.tsx to see how the client currently handles failure. Add server-side validation that rejects non-strings and strings under three characters before any greeting is built, and return a documented error result the form can display. Done means focused Jest tests call the action directly for valid names, empty, short, null and non-string inputs, and the form shows the error without a success toast.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
Current main still accepts the client-controlled argument in helloAction without runtime validation. src/actions/hello-action.ts:1–4 interpolates its argument directly; the TypeScript string annotation does not validate network input. The minimum-three-character Zod check exists only in the client component (src/components/form.tsx:15–17). Direct action invocations bypass that check.
Related history: #368 recorded this finding but was closed as a run-owned QA fixture. Its cleanup comment says implementation PR #369 was closed unmerged. This is a durable follow-up for the still-present gap on main, not a request to reopen the disposable fixture. No matching open issue was found.
Reproduction
Call the action directly with a string shorter than three characters; it constructs a successful greeting despite the form's minimum-length rule. Non-string values are not checked at runtime either. This is source-confirmed; no requests or tests were executed during discovery.
Scope / implementation surface
Validate input at the server boundary in src/actions/hello-action.ts; update src/components/form.tsx only as needed to handle the chosen validation result. Consider sharing the existing schema to prevent client/server drift. Add focused action tests using existing Jest conventions. Keep valid greeting output unchanged; do not add authentication requirements or unrelated form redesign.
Acceptance criteria
- Direct calls reject non-string input and strings shorter than three characters before constructing a greeting.
- Valid names retain the existing successful greeting contract.
- Invalid input produces a deliberate, documented error/result contract, and the form handles it without an unhandled rejection or a success toast.
- Focused tests call the action directly, covering valid names, empty/short strings, null, and representative non-string values rather than relying on client validation.
Validation and dependencies
Run focused Jest coverage, the full unit suite, and the configured typecheck. Use no live services or credentials. No external blocker is known. Coordinate schema/result changes with the form caller.
created by polka.codes
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 12m
- PR unite (30g)
- 6
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di polka-codes/test
-
Return an explicit error response from the Stripe webhook outer catchForse già presa @xlc l’ha presa 13 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
polka-codes/test#382 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
polka-codes/test#361 ·
I maintainer di solito rispondono entro 1 giorno
-
Expand homepage browser coverage beyond the document titleForse già presa @xlc l’ha presa 13 giorni fa. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
polka-codes/test#349 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 1/100
polka-codes/test#366 ·
I maintainer di solito rispondono entro 1 giorno
-
Add focused tests for Stripe webhook validation and subscription handlingForse già presa @xlc l’ha presa 13 giorni fa. Apertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
polka-codes/test#348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di polka-codes/test
Issue simili
-
e2e-failure ready-to-code
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
redhat-developer/rhdh-plugin-export-overlays#4616 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
ai-handle
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nextlevelbuilder/dewee-web-v2#73 ·
I maintainer di solito rispondono entro 1 giorno
-
backend bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
PoCInnovation/Distribox#255 ·
I maintainer di solito rispondono entro 1 giorno