Repository navigation
fix(registration): say why a sign-up was refused, in the report form's words (#259) - #345
Conversation
…s words (#259) The sign-up form mapped one write-guard code, `captcha_failed`. Every other refusal SahajCloud's intake raises for a registration reached the visitor as "Something went wrong" over the server's English sentence: the address checks on `senderEmail`, the link scan on free-text answers, `captcha_unavailable`, and the gate's own `event_not_found`. `RegistrationErrorCode` now covers every code the registration create path can return, and the form maps each one: - invalid_email, disposable_email, urls_not_allowed take the report form's own keys from one shared table (`INPUT_REFUSAL_KEYS`), which both forms spread, so neither can reword them alone. They land on the field SahajCloud names in `errors[].data.field` (now carried through `asRefusal`), with aria-invalid, aria-describedby and focus, and clear when edited. - captcha_failed, captcha_unavailable, content_unscannable take the retry sentence, the registration twin of the report's captcha copy. - event_not_found takes the panel's "can't be joined right now" and, like the state refusals, refetches the event. - an uncoded failure keeps the generic title but adds the retry sentence, and never shows the thrown message. The challenge now resets on every failure, as the report form's does: a 500 after the guard ran has spent the token. Co-Authored-By: Claude Opus 5.5 <[email protected]>
From an adversarial review of the previous commit: - `data.field` parses with `.catch(undefined)`, so a malformed field costs only the field and never drops the refusal code beside it. - The token-reset comment said every failure spends the token; the address checks run before the captcha, so those cost only a fresh challenge. - The copy-map comment called `captcha_retry` the report's twin for all three retry codes; it is that only for `captcha_failed`. - The "Refused · on a field" story claimed editing clears the error. It does not there: nothing was submitted, so react-hook-form never re-validates. - `mutate.ts` now lists every code the registration path cannot earn. New specs pin the `name` field mapping, which refusals refetch the event (the old `!== 'captcha_failed'` condition fails it), and the malformed-field case (fails without the catch). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | b4408d8 | Oct 31 2026, 12:35 AM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The scope is right. #259's own build plan asked for exactly this — the refusal map widened past captcha_failed, reading errors[0].data.field — and the diff is that plus its tests. Nothing is smuggled in. I checked the code set against SahajCloud main and found no gap: urls_not_allowed can only name a submissionData key, so name and the question keys are the whole reachable set, and the four excluded codes are genuinely unreachable from this payload.
What the diff does not finish is the mechanism it starts. field is plumbed through asRefusal into both error classes, and only one form reads it.
Findings
should-fix—UserSubmissionError.fieldhas no reader; the report form is left outside the mechanism this diff builds (mutate.ts:273).consider— the story-only refusal costs three pieces of live machinery (RegistrationForm.tsx:260).consider—refusal-copy.tssits in a molecule folder that never uses it (refusal-copy.ts:14).consider— theREFUSAL_MESSAGE_KEYSdoc runs 24 lines, three of them about the other form (RegistrationForm.tsx:63).
What was checked
Read whole: RegistrationForm.tsx, mutate.ts, ReportIssueForm.tsx, refusal-copy.ts. Consumer side in SahajCloud main: antiSpamGuard.ts (checkNoUrls returns the scanned key as field), writeGuard/policies.ts (user-submissions.create lists no urlScanFields), submissionData.ts:221 (scans per key), prepareUserSubmission.ts:195 (refuse drops field for submission_data_invalid). Grepped src/ for every .field reader: lexical.ts and report-form.ts only. Reviewer profile read. The body carries no ## Preview link, and the sahajatlas-design deploy is the playground, so the two new stories were not opened.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The diff added `field` to both refusal classes, and only `RegistrationRefusedError` has a reader. The report form says a refusal in one form-level alert: its fields are authored by the operator and announce per keystroke (#102), so there is no field to carry a sentence. Making that form read `field` means reopening #102's announcement design, which this PR does not touch. So the member lives only where it is read, and the asymmetry is stated on the class. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWpunuLNgiuyGeP9RL
The story-only refusal held a `useState` inside the form so it could construct a `RegistrationRefusedError` there. Taking the error itself as the prop deletes that state: the story builds it, and the live path is left with the mount effect and one `??`. A Ladle story cannot reject the mutation the way the spec does. The playground has no SDK boundary to mock, and the submit button is gated on a solved Turnstile token it never gets, so the refusal has to arrive as a prop. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWpunuLNgiuyGeP9RL
The table sat in `molecules/FormField/`, which never imported it, and its two consumers are both organisms. The keys are `common.report_errors.*`, authored for the report form, so that form owns the file and the registration form borrows it — the direction the copy already runs. Also drops `InputRefusalCode`, which nothing read, and cuts the doc from eleven lines to four. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWpunuLNgiuyGeP9RL
Twenty-one lines for a six-entry table, three of them describing what the report form's copy reads and why this form cannot borrow it. The totality-split reason and the `event_not_found` choice are the parts a reader cannot re-derive; the captcha paragraph restated the table under it and the token reset the handler already explains. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWpunuLNgiuyGeP9RL
|
All four adversarial-review threads adopted, in
Not built: per-field refusals in the report form. Its fields announce per keystroke (#102), so a field sentence is never announced. That needs #102's design reopened. Security review clean. Lean gate green at 156 files and 1849 tests. Docs checked, nothing stale. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
The sign-up form used to explain only one refusal, the captcha one. Every other code SahajCloud's intake returns for a registration showed "Something went wrong" above the server's English sentence. This PR gives every code its own sentence, and a refusal the visitor can fix now lands on the field that caused it. This addresses one success line of #259: "When either form turns a visitor away, it tells them what to change, in the same words for both forms."
RegistrationErrorCodenow covers every code the registration create path can return, read from SahajCloudmain(d9698feb). The codes come from three places: the write guard,gateRegistrationandprepareUserSubmission.invalid_email(fieldsenderEmail)common.report_errors.email, on the Email fielddisposable_email(fieldsenderEmail)common.report_errors.disposable_email, on the Email fieldurls_not_allowed(fieldnameor a question key)common.report_errors.urls_not_allowed, on that fieldcaptcha_failedregistration.form.captcha_retry(unchanged)common.report_errors.captcha: the same sentence, with "send" where we say "register"captcha_unavailableregistration.form.captcha_retrycommon.report_errors.send_failedcontent_unscannable(unreachable today)registration.form.captcha_retrycommon.report_errors.send_failedevent_not_found(404)common.errors.unavailable, then the event is refetchedexternal_registration,event_ended,registration_closed,event_fullregistration.form.captcha_retry; the thrown message is never shownsend_failedINPUT_REFUSAL_KEYS(organisms/ReportIssueForm/refusal-copy.ts) holds the copy, and both forms spread it into their own maps. So those sentences cannot drift apart between the forms. The report form owns the file, because the keys are its owncommon.report_errors.*.setErrorwithshouldFocus. The visitor seesaria-invalid, the FormFieldrole="alert"andaria-describedby, and focus moves to the field. The error clears when they edit the field. The form-level alert is suppressed for these, so the sentence is announced once.asRefusalcarrieserrors[].data.fieldthrough toRegistrationRefusedError. A malformedfieldcosts only the field, never the code beside it.UserSubmissionErrordoes not carry it — the report form has no field to put a sentence on.event_not_found. It used to be refetched after every refusal except the captcha one.docs/embedding.mdandCHANGELOG.mdare untouched.Part of #259. It does not close it, because that goal has other open lines.
Translation gap (needs SahajCloud copy)
The words are now the same in both forms, but two shared sentences were written for the report form, and they are not quite right on sign-up:
common.report_errors.disposable_emailends "…or leave it blank". The registration email is required, so that half is false here. It is also false on a report form whose operator made email required.common.report_errors.urls_not_allowedsays "in the message … send again". On sign-up it appears under the name or a question answer.registration.errors.email), and the server refusal says "Enter a valid email address." on the same field.The honest fix is neutral wording in
sy-atlas-translations, or a registration-specific key. Either one is a SahajCloud copy change, so this PR uses the existing keys. No SahajCloud schema change is needed.Tests
RegistrationForm.submit.test.tsx(jsdom, SDK-boundary mock) covers:mutate.test.ts:fieldis carried for both refusal shapes, and a malformedfieldkeeps the code.ReportIssueForm.submit.test.tsx: the three shared codes render the same keys as the registration spec.check.sh) passes: lint, typecheck, and 156 files / 1849 tests.Local review
An adversarial review read the diff and SahajCloud
main. It found no missed codes, and the mechanics were sound.Fixed in
cc913c9e:fieldparse;namemapping and for which refusals refetch the event.Fixed in
b4408d8, from the PR's own adversarial review:UserSubmissionError.fieldis gone. OnlyRegistrationRefusedErrorhad a reader.molecules/FormField/, which never imported it, to the report form that owns the copy.InputRefusalCodewent with it — nothing read it.RegistrationRefusedErrorand passes it, so the live path keeps a mount effect and one??.REFUSAL_MESSAGE_KEYSdoc is eleven lines, down from twenty-one.A branch-level
/security-reviewran, because the diff touchessrc/config/api/. It found nothing.Left as-is:
announceError={false}and validates per keystroke (fix(ui): announce form errors, manage focus, respect reduced motion #102), so asetErrorsentence would never be announced, and the form-level alert is what speaks. Unifying the two forms means reopening that design.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjWpunuLNgiuyGeP9RL