Repository navigation
Description
Summary
The report-issue form validates, passes a real Turnstile challenge, then window.alert(JSON.stringify(payload, null, 2)) and shows the localized "sent" confirmation (src/components/organisms/ReportIssueForm/ReportIssueForm.tsx:118-121, the TODO(#80)). Nothing reaches any server — yet ERROR_POLICY routes viewers to this CTA as the designated last resort on four of six failure kinds (server/config/contract/unknown). When the widget breaks on a host page, the "report" is a JSON alert dialog, and the UI claims success anyway. Ship-blocker 4 in the release-readiness review (§9: "zero production error signal").
Status check (2026-08-06): the backend has landed. sydevs/SahajCloud#602 ("feat(api): add a captcha-gated contact-admin endpoint") closed 2026-08-04. The shared POST /api/contact-admin is client-key gated, Turnstile-verified server-side, and emails [email protected] with the sender's address as Reply-To; the body contract is { message (10..5000), email?, subject? (<=200), turnstileToken, context? { path, hostUrl, locale, error, userAgent } }. So the primary path here is the real mutation. Open issue #80 already sketches exactly this wiring and remains the reference plan — this ticket carries it as a release blocker, and the implementing PR should close both (Closes #80 in the PR body).
Proposed changes
- Confirm the endpoint is deployed on the target backend (
VITE_SAHAJCLOUD_URL, defaulthttps://cloud.sydevelopers.com) — #602 is merged; deployment is the remaining unknown. - If deployed (expected): wire the real mutation per feat(widget): submit issue reports to the SahajCloud endpoint #80's plan —
contactAdmininsrc/config/api/mutate.tsvia therequestJsonhelper (custom non-CRUD endpoint, same shape ascreateRegistration), sendingsubject: 'Issue report'; parse the response through a zod schema per.claude/rules/data-layer.md.- Replace the alert with a TanStack
useMutation: pending / error / thank-you states mirroringRegistrationForm. On failure show an inlineAlertand keep the typed message so nothing is lost; on a 403 (captcha rejection) reset the Turnstile widget in place so the viewer can retry without reopening the modal.
- If NOT deployed: ship the interim instead — route submission through the existing mailto fallback (the Turnstile-
blockedbranch already rendersmailto:[email protected];ReportIssueForm.tsx:187-191, degraded-state contract documented insrc/hooks/use-turnstile.ts:80-85) so a submission ALWAYS goes somewhere real. Never show the "sent" confirmation for something that wasn't delivered. - Security note (carry forward from commit 368e1f7):
ReportContext.erroris the thrown message — attacker-influenceable text, capped at 500 chars (src/lib/report.ts:233MAX_ERROR_LENGTH, applied at:255). Anywhere it is forwarded, ENCODE it: the onward email template must not interpolate it raw (coordinate with SahajCloud's template if needed), and any client-builtmailto:URL mustencodeURIComponentevery interpolated field.
Acceptance criteria
- Submitting the form POSTs to
/api/contact-adminwith the client API key attached by the shared request context (no ad-hoc auth handling), and the response is parsed through a zod schema — OR, if the endpoint is confirmed undeployed, the submit path degrades to the mailto route and says so honestly - The
window.alertand itsTODO(#80)are gone; no code path shows the "sent" state without a real delivery - Failure keeps the typed message and allows retry; a 403 resets the Turnstile widget without reopening the modal
- The thrown message (
ReportContext.error) is encoded, never raw-interpolated, in anything mailed onward or built into amailto:URL - New user-facing strings exist in every locale (via
pnpm i18n:add) - A unit test covers the submit path with the request layer mocked at the boundary (
vi.mock+vi.hoisted, per.claude/rules/tests.md) -
pnpm lint && pnpm typecheck && pnpm test:runpass - The implementing PR closes feat(widget): submit issue reports to the SahajCloud endpoint #80 alongside this issue
- Write an implementation report to
.claude/reports/<issue-number>-<short-slug>.md— in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.
Files affected
src/components/organisms/ReportIssueForm/ReportIssueForm.tsx(the only owned file)- Strictly additive only: a new
contactAdminexport insrc/config/api/mutate.ts, a new response schema insrc/types/, new locale keys underpublic/locales/*/ src/lib/report.tsis owned by a sibling ticket — if a type tweak there is unavoidable, keep it strictly additive
Parallel implementation: this ticket OWNS ReportIssueForm.tsx; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones. (The pnpm lockfile is shared between two sibling tickets; conflicts there are expected and resolved by re-running pnpm install — this ticket should not need to touch it.)
References
.claude/reports/RELEASE_READINESS.md§9 (monitoring & support) — ship-blocker 4 (repo-local, gitignored)- feat(widget): submit issue reports to the SahajCloud endpoint #80 (the wiring plan this ticket adopts and closes), feat(widget): add a report-issue modal with turnstile captcha #79 (the modal), feat(api): add a captcha-gated contact-admin endpoint SahajCloud#602 (the endpoint — CLOSED 2026-08-04)
- Commit 368e1f7 (report-context capture hardening — query/fragment stripping, message cap)
.claude/rules/data-layer.md(zod-parsed responses;requestJsonfor custom endpoints)
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity