Skip to content

feat(widget): render the SahajCloud-authored report-issue form from sy-atlas-config - #219

Merged
sydevs-bot merged 16 commits into
mainfrom
claude/feat-216-report-form
Sep 22, 2026
Merged

sydevs-bot merged 16 commits into
mainfrom
claude/feat-216-report-form

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠ Merge order

sydevs/SahajCloud#832 merges first. Round three (below) removed this branch's message workaround on the reviewer's instruction, so until #832 ships, a report whose textarea is not named message delivers an email with an empty body. Everything else in this PR is independent of it.

Summary

  • Report-an-issue works again: the row now names the authored form on sy-atlas-config.reportIssueForm, which is what the collection has been refusing it for.
  • The form's questions, submit label and confirmation copy are the operator's, read from GET /api/forms/:id. The widget keeps the Turnstile gate, the refusal copy and the honest thank-you screen.
  • With no form named, there is no report affordance anywhere — settings menu, error screens, compact card.

Changes

  • src/lib/report-form.ts — the pure derivation: which blocks render, the validation each implies, the answers they produce. Fields register by POSITION, because an operator-typed name may contain . or [], which react-hook-form reads as a path; reportAnswers re-attaches the authored name SahajCloud matches on.
  • src/types/report.ts — the form's wire shape, pinned to the generated SahajCloud types (PinnedToSahajCloud). Load-bearing here: renderableFields drops a block it cannot parse, so without the pin a renamed member would turn an operator's question into a field that silently stops rendering.
  • src/components/molecules/Fallbacks/Fallbacks.tsx — canReport, a new SurfaceLimits entry, so the gate lives in visibleActions with every other action decision.
  • src/hooks/use-report-form.ts — useReportForm (the non-suspending gate: formId plus enabled, and the read it keeps warm) and useReportFormDocument (the suspending read, for a caller inside a boundary).
  • src/components/organisms/ReportIssueForm/ReportIssueModal.tsx — the chrome plus two boundaries; ReportIssuePanel owns the form and its auto-attached context.
  • src/config/api/index.ts — both report-form query contracts, with every other factory.

Two fixes from the adversarial review

  • The value bound was keyed on the block type; the collection keys it on the NAME. Only message, note and error are raised to 5000 in VALUE_MAX_LENGTHS. A textarea named anything else offered 5000 characters and then lost the whole submission to a bare ValidationError — no code, no field named. userSubmissionValueMax now feeds the schema, the control's maxLength and the "too long" copy alike, and REPORT_MESSAGE_MAX is gone: the ceiling was never this form's to choose.
  • A pending form read rendered as a failure. The affordances gate on the config, which lands a round trip ahead of the form itself, so a viewer who opened the settings menu in that window saw a danger alert and then a working form. Round three replaced the isPending branch with a Suspense boundary.

A third finding — the email body was blank unless a field happened to be named message — was fixed here in edbfd87 and reverted in round three: it is SahajCloud#832's to own. Every fixture in src/mocks/report-form.ts names its textarea message, which is why the suite stayed green over both.

Review round two (dbc6ffc)

useReportForm returns enabled beside the form, and useReportEnabled is gone — the settings row and both fallback surfaces read one hook. The split saved no fetch, because the modal host mounts the form query for the widget's whole life.

Review round three (7347748, f25883a, ce201be) — three threads, one commit each

  • PinnedToCms → PinnedToSahajCloud, with SahajCloudFormField / SahajCloudBlock. The preference is codified where a later file gets read against it: src/AGENTS.md's naming list and docs/rules/data-layer.md's generated-types section, which loads on src/types/**. The three prose-default blocks now share one textInput shape. The Pick key lists stay written out — folding the shared 'name' | 'label' | 'required' needs Extract<keyof …> to type-check, and Extract DROPS a renamed member instead of failing on it, which is the one drift the pin exists to catch.
  • reportMessage is gone, with the message field on ReportPayload, the pair in sendReport and their three specs. feat(email): render an authored form's answers in the contact email SahajCloud#832 renders a named form's own question/answer pairs into the delivered email, and this branch now assumes it lands as specified. See the merge-order warning above.
  • The pending read falls to a boundary. The mount moves inside the app's <Suspense> and stays outside its ERROR boundary, since the error CTAs must still open the modal while ErrorFallback is on screen. isPending and reportFormPending are both gone. Both new boundaries sit INSIDE ModalContent: a Suspense fallback renders the spinner, an ErrorBoundary renders the alert. At the mount instead, the app's own LoadingFallback would stand in for one modal's read, and a viewer who pressed the button would lose the dialog. useReportForm keeps its non-suspending reads on purpose — two of its three callers are error fallbacks, where a suspending gate would blank the screen and a throwing one would take it down — and it keeps the form read mounted for the widget's life, so useReportFormDocument resolves from cache.

Review round four (96eef22) — one thread

Both report-form query factories move to src/config/api/index.ts, where clientQuery, eventQuery, regionQuery, eventsQuery and regionsQuery already live. Three factories are declared in fetch.ts instead, and each has the same excuse: fetch.ts itself calls it — eventTitlesQuery in loadTitles, atlasConfigQuery and translationsQuery in the bootstrap warm-ups — so declaring it in the barrel would close a cycle against the import already there. Nothing in fetch.ts calls either report-form factory, so neither had that excuse; they had inherited the neighbouring one.

Two things fell out of the move. reportFormSuspenseQuery was never re-exported, so use-report-form.ts reached into fetch.ts for it while importing its twin from the barrel — the split the barrel exists to prevent. And the docblock describing reportFormQuery had been stranded above reportFormSuspenseQuery's own since round three, where TypeScript attaches neither to it; it is back on the function it describes.

docs/rules/data-layer.md gains the placement rule, since it was prose nowhere and the test for it — does fetch.ts call this factory? — is not guessable from the file.

Preview

The branch aliases follow the branch, so they carry 96eef22.

What Link
App (branch alias) https://claude-feat-216-report-form.sahajatlas.pages.dev
Ladle story (branch alias) https://claude-feat-216-report-form.sahajatlas-design.pages.dev/?story=organisms--report-issue-form

Start with the Ladle story. It renders the whole form off fixtures, with no SahajCloud involved: the Authored fields section shows prose, a required select, a consent box and a dropped block type in one form.

⚠ The app preview shows no report control at all right now, and that is the feature. sy-atlas-config.reportIssueForm is unset today — read back over the API at depth=0 with a select, which returns defaultMapCenter and no reportIssueForm. So the settings menu, the error screens and the compact card all correctly offer nothing, which is the third summary bullet above rather than a broken preview.

To see the form in the app: name a form on /admin/globals/sy-atlas-config, then reload the preview and open the settings menu → Report an issue. SahajCloud already holds Contact Form (id 1: name, email, a required message textarea, submit label "Submit"), so no authoring is needed for a first look. Setting the field is safe for production — main does not read it yet.

⚠ That form's textarea is named message, the same bias the review pass found. Manual verification step 2 below is the one that matters, and it is the one SahajCloud#832 now owns.

Contract impact

  • src/types/payload/payload-types.ts refreshed from SahajCloud main (feat(sy-atlas-config): name the atlas report-issue form on the config global SahajCloud#823 → its #813). The new field is SyAtlasConfig.reportIssueForm.
  • CHANGELOG.md carries the host-visible half: the form is SahajCloud-managed, and the affordance disappears where no form is named. No new parameter, no new origin, no CSP change — docs/embedding.md only gains the caveat that the form may be absent. None of the four review rounds adds anything a host can observe.

Test results

  • Lean gate: ✓ pnpm lint && pnpm typecheck && pnpm test:run — 1582 tests, 123 files, green on 96eef22. The count fell from 1590/124 in round three, which deleted specs with the code they covered: the three message-pair assertions and all four of reportFormPending's. Round four changes no count.
  • Build and pnpm size measured on 96eef22: standalone 301.6 / embed 303.5 / loader 2.6 KiB against 308 / 308 / 3.5 — byte-identical to 3adac32, which is the check that matters for a move between two modules both already in the eager graph.
  • Each new assertion was watched FAIL against its own defect first (docs/testing.md): the form id removed from the body, the pin against a renamed member, reportAnswers counting only answerable fields, the schema passing recipient through, the copy fallback overriding an authored label, the report gate removed, the schema and then the control bounding by the block type again.
  • Rounds three and four add no assertion, and that is a gap worth naming. The boundary pair replaces a branch that never had a spec of its own — an open Radix portal throws under renderToStaticMarkup, so only jsdom can reach it — and reportFormPending, the pure half that carried the decision, no longer exists. Round four is a declaration move with no behaviour to assert, though the typecheck does prove the barrel resolves. What a spec could still cover is that reportFormQuery and reportFormSuspenseQuery share one query key; say so and I will add it.

Manual verification

This needs a SahajCloud the reviewer can author in — none of it is reachable from a unit lane.

  1. Author a contact form with a recipient, name it on /admin/globals/sy-atlas-config, open Report an issue on the preview and submit. Expect POST /api/user-submissions → 201 with form in the body, a row in /admin/collections/user-submissions, and mail to that form's recipient.
  2. Name the textarea something other than message and submit again. ⚠ This one fails until SahajCloud#832 ships: the row carries the prose under the authored name, and the email body is empty. The control must still stop at 2000 characters.
  3. Check the GET /api/forms/<id> response in the network tab: no recipient, no client key.
  4. Clear reportIssueForm, reload, and confirm the settings menu and the error fallbacks offer no report control.
  5. Author a form with a select and a checkbox and submit: each answer should appear in the row under its authored name.
  6. Open Report an issue immediately after a cold load, before the form read lands: expect the spinner inside the dialog, never the danger alert.

Notes for reviewer

  • The form stays in the eager graph, deliberately. It brings Radix Select and Checkbox with it. Lazy-loading it would trade a few KiB for a chunk fetched at the moment a viewer is reporting a failure that is often the network itself — the same reasoning App.tsx already records for not splitting the modal.
  • Where the operator authors no label, the widget supplies its own copy for the two blocks it has words for. This is not only cosmetic: those five keys are SahajCloud-owned and would otherwise be dead in the snapshot, which translations.test.ts fails on in both directions.
  • A required textarea keeps REPORT_MESSAGE_MIN. A reviewer may disagree — it is the widget imposing a floor on an authored question — but it is what keeps "at least %{min} characters" describing something real. Its ceiling is no longer ours at all.
  • A required checkbox authored with defaultValue: true opens pre-ticked. That is the operator's choice to make, but worth knowing before someone authors a consent that way.
  • Authored labels are not localized upstream, so a non-English viewer sees English labels. That is a SahajCloud concern and worth a ticket there — not filed, since #832 was the one you asked for.
  • Dismissed earlier: lazy-loading the form (above); dropping the label fallback (the translation-snapshot gate above); skipToken in place of enabled on the form query (React Query's exported skipToken widens to symbol through a ternary here and the factory stopped type-checking — the key carries the real id or null instead).
Detail

Fixture pre-mortem. src/mocks/report-form.ts assumes SahajCloud's form-builder block shapes — name/label/required/defaultValue, options as {label, value}, prose as a Lexical root. Verified against export interface Form in src/types/payload/payload-types.ts, and now pinned there by PinnedToSahajCloud so the check survives the next resync. Its textareas are all named message, which is the bias that hid two findings.

Why the answers go first in submissionData. Both sets are allowed keys, so an operator authoring a field called locale would otherwise replace the locale the widget is actually running in. Authored values are not clamped — they are prose a person wrote, and the controls bound them instead, which is the rule createRegistration already follows.

Country and state render as text inputs. The widget has no authored option list for either, and the answer travels as a string whichever control collects it. Dropping them would lose a question the operator asked, silently.

Prose renders as text, not HTML. lexicalToHtml would need the DOMPurify pass that goes with it, and this form is in the eager graph. lexicalToText is already there.

Reviewed at branch level by four quality lenses plus the security sweep (src/config/api/ matches securityReview.triggerPattern). The security pass came back clean, having checked the authored-content sinks, the recipient/client exposure, the collision ordering above, and the Turnstile handling.

Closes #216

🤖 Written by the sydevs autonomous loop — see what this is

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEMbghy1kqLiDQaXoVghFb

`pnpm types:cms`. SahajCloud#823 (its #813) added `reportIssueForm` to the
`sy-atlas-config` global: the `contact` form the widget's report-issue path
renders and posts against.

Generated output only.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
`sendReport` posted a `contact` row that named no form, and the collection
refuses one: `form: This field is required.`, a `ValidationError` carrying no
code, so every report reached the viewer as the generic failure. SahajCloud#823
settled the contract the other way — the atlas names an authored contact form on
`sy-atlas-config.reportIssueForm`, and that form owns the questions and the
recipient.

So `getAtlasConfig` now selects the id at `depth: 0`, `getReportForm` reads the
form behind `reportFormQuery`, and `sendReport` sends `form` plus the answers as
pairs under the names the operator authored.

Three guards keep `recipient` out of the browser, since it is a relationship to
a manager and a populated read would publish a name and an address on every host
page: the read is `depth: 0`, its `select` names neither `recipient` nor
`client`, and `ReportFormSchema` carries neither.

`lib/report-form.ts` holds the derivation — which blocks render, the validation
each one implies, and the answers they produce. Authored names never reach
react-hook-form: a name is operator-typed and RHF reads `.` and `[]` as a path,
so fields register by position and `reportAnswers` re-attaches the name.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
The form hard-coded an optional email, a message, and `ReportSchema`. It now
renders the authored blocks of the form named on `sy-atlas-config` — text,
textarea, email, select, checkbox, number, country, state and prose — with the
validation each block implies and the operator's own submit label and
confirmation copy.

Where the operator left a field unlabelled, the widget falls back to its own
copy for the two blocks it has words for, label and placeholder together: under
a question they DID write, our hint would describe a different question.

A block type this build cannot render is dropped rather than thrown on, and the
modal host degrades to a failure panel when the form cannot be read at all. This
path is reached BECAUSE something already failed, so it must not be the second
thing to fail — which is also why the host reads the form for the widget's whole
life rather than on open.

Authored prose renders as TEXT, not HTML: the serializer's HTML form needs the
DOMPurify pass that goes with it, and this form sits in the eager graph.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
The CMS field says an empty value hides report-issue entirely, and a `contact`
row naming no form is refused anyway — so an affordance offered without one
leads to a send that cannot succeed. The settings row and the error fallbacks'
report button now both gate on the config.

The fallbacks read the cache imperatively, the way `currentLocales` does, for a
sharper reason: `FallbackActions` renders where the app is already broken, with
no query provider guaranteed above it, so a hook there would throw inside the
error fallback.

An unreadable config answers "no" for the same reason a missing id does.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
`data-layer.md` described `sendReport` as naming no form, and carried
SahajCloud#813 as an open blocker. Both are settled: the row names the authored
form, and the `forms` read must never select `recipient` or `client`.

The CHANGELOG entry is for the hosts: the questions, the submit label and the
confirmation message are managed in SahajCloud now, and where no form is named
the widget shows no report affordance at all. No new parameter, no new origin.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
Four findings from the branch review, each a real one:

The report gate moves out of `FallbackActions` and into `visibleActions`' new `canReport`
limit — the function that already arbitrates policy against surface, and whose last-resort
rule (restore the report CTA when narrowing deleted every other way out) my renderer-level
`&&` was silently voiding. With the gate there, the imperative cache read goes too: every
production render of `FallbackActions` is inside the query provider, so the hook subscribes
and the button appears when the config lands, instead of staying hidden for the life of a
screen that mounted first.

`ReportFormSchema` is pinned to the generated CMS types. This matters more here than in the
usual case: `renderableFields` DROPS a block it cannot parse, so a renamed member would turn
an operator's question into a field that silently stops rendering, with every gate green.

`AuthoredField` picks its control with a `switch` over the union, so a block type added to
the schema cannot render a labelled field with nothing inside it, and is memoized — the form
validates on every keystroke, and each one re-walked every prose block's Lexical tree. The
schema, the resolver and the defaults are memoized for the same reason.

The rest is wording: one bound per zod chain instead of one per arm, a copy table with an
optional `help`, and the error sentence behind its own guard.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
The embedding guide pointed hosts at a form that may not exist, and the fallback rules
described a restore-the-report-CTA guarantee that `canReport` can now withhold.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014mb9orTUt9wn78RSzKQMZU
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1fa06bd
Status: ✅  Deploy successful!
Preview URL: https://8666d35c.sahajatlas.pages.dev
Branch Preview URL: https://claude-feat-216-report-form.sahajatlas.pages.dev

View logs

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 21, 2026
@sydevs-bot

sydevs-bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 00:45Z resolve-conflicts · attempt 1 · session · done
  • 00:45Z resolve-conflicts · attempt 1 · session
  • 00:35Z address-review · attempt 1 · session · done
  • 00:35Z address-review · attempt 1 · session
  • 23:38Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The diff matches the ticket step for step, and nothing is smuggled in. recipient and client are absent from the select and manager-locked on the CMS side, and every report affordance routes through visibleActions' canReport.

The gap is the other half of the contract. This PR makes the questions the operator's, but SahajCloud's delivery job still understands one key — message. Two findings are that gap; the third is a loading state rendered as a failure.

Findings

  • blocker — the emailed report is blank unless a field is named message (mutate.ts:316).
  • should-fix — a textarea gets a 5000 bound only message is allowed (report-form.ts:66).
  • should-fix — a pending form read shows an error (use-report-form.ts:42).

What was checked

grep openReport finds only SettingsMenu and Fallbacks, and DrawerErrorFallback reaches visibleActions through FallbackPanel, so the unset-form gate is complete. Read on SahajCloud main: submissionData.ts, deliverContact.ts, submissionContext.ts.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/config/api/mutate.ts Resolved
Comment thread src/lib/report-form.ts Resolved
Comment thread src/hooks/use-report-form.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 21, 2026
SahajCloud's delivery job renders the email body from one key — `deliverContact.ts`
reads `readSubmissionValue(submissionData, 'message')` — and rebuilds its context block
from five fixed names. Every other authored answer reaches the row and stops there.

Since #216 the operator names their own fields, and nothing on either side pins
`message`. So a form whose textarea is called anything else delivered an empty email
while the sender was shown the thank-you screen — the exact failure this form exists to
prevent. Every fixture in `src/mocks/report-form.ts` happens to name its textarea
`message`, which is why the suite stayed green over it.

The first textarea now also travels as `message`, and the authored copy wins the
collision so a form that did name one keeps its own answer. The answer still reaches the
row under the question the operator asked.

Rendering the authored pairs into the email instead is SahajCloud's half, and would let
this pair go.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016UK7FkyZWpCTU5pYgK11ib
The collection keys `VALUE_MAX_LENGTHS` on the submission KEY: only `message`, `note` and
`error` are raised to 5000, and every other name takes the 2000 default. This form bounded
by the block type instead, so a textarea the operator named anything else offered 5000 in
the control and accepted 5000 in the schema, then lost the whole submission to a bare
`ValidationError` — no code, no field named, everything the viewer typed gone. That is the
loss the bound exists to prevent.

`userSubmissionValueMax` mirrors the raised keys beside `USER_SUBMISSION_VALUE_MAX`, and
the schema, the control's `maxLength` and the "too long" copy all read it, so the three
cannot disagree about where the viewer is stopped.

`REPORT_MESSAGE_MAX` goes with it: the ceiling was never this form's to choose.

Every fixture in `src/mocks/report-form.ts` names its textarea `message`, which is why the
suite stayed green over this. Both new specs pin a renamed one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016UK7FkyZWpCTU5pYgK11ib
The modal had only `data` to go on, so `undefined` meant both "still reading" and "could
not be read", and it rendered the second — a danger alert. The report affordances gate on
the CONFIG, which resolves a round trip ahead of the form itself, so a viewer who opened
the settings menu in that window was told something went wrong and handed a working form a
moment later. On the one screen reached because something already failed, a false alarm is
the worst available guess.

`useReportForm` now returns `isPending` beside the form, and the modal renders a spinner
for it. `reportFormPending` holds the decision, because the trap is not the ternary: a
DISABLED query stays pending forever in React Query, so "this atlas names no form" has to
read as settled or the modal waits on a read that will never run.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016UK7FkyZWpCTU5pYgK11ib
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three findings, all adopted, pushed as 3adac32.

Gates: lint, typecheck, 1590 tests, build, pnpm size (301.6 / 303.5 / 2.6 KiB), ladle:build. Nine new assertions, each watched fail against its own defect first.

One thing needs you: rendering the authored pairs into the email is SahajCloud's half, and would retire the message pair. Opening an issue there needs your say-so.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 21, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 21, 2026 19:06
@sydevs-bot
sydevs-bot requested a review from Ardnived September 21, 2026 19:06
@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot The PR description contains no actual preview links for me to review. Find and create appropriate links

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 21, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Preview links are now in the description.

Both deploys are green on 3adac32. The description also carries the per-commit aliases.

Start with Ladle. It renders the whole form off fixtures, with no CMS involved.

⚠ The app preview offers no report control at all, and that is the feature. sy-atlas-config.reportIssueForm is unset on the CMS — I read the global back and got defaultMapCenter and no reportIssueForm. Name a form on /admin/globals/sy-atlas-config to see the form itself. Contact Form (id 1) is already there, and main does not read the field, so setting it is safe for production.

No code changed, so nothing was pushed.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

`PinnedToCms` named a category where the producer has a name, and `CmsFormField` /
`CmsBlock` carried the same habit into the helpers. The pin reads against SahajCloud's own
generated types, so it now says so: `PinnedToSahajCloud`, `SahajCloudFormField`,
`SahajCloudBlock`.

The preference is codified where a later file will be read against it — `src/AGENTS.md`'s
naming list and `docs/rules/data-layer.md`'s generated-types section, which loads on
`src/types/**`.

Two reductions in the same file: the three blocks whose authored default is prose share one
`textInput` shape, and the checkbox block fits one line.

The key lists in the tuple stay written out. Folding the shared `'name' | 'label' |
'required'` into a generic helper needs `Extract<keyof …>` to type-check, and `Extract`
DROPS a renamed member instead of failing on it — the one drift this pin exists to catch,
since `renderableFields` swallows an unparseable block by design. That is now a `⚠` in the
docblock rather than a thing to re-derive.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018vGoYUvXqhy2BB4y9AeMSk
`reportMessage` copied the first authored textarea answer under a second key, `message`,
because `deliverContact.ts:23` builds the whole email body from that one key and
`submissionContext.ts` rebuilds the context block from five more. Every other authored
answer reached the row and stopped there.

That workaround belongs upstream, and now has a ticket: sydevs/SahajCloud#832 renders a
named form's own question/answer pairs into the delivered email, in authoring order, under
the labels the operator wrote. This branch assumes it lands as specified — the helper, the
`message` field on `ReportPayload`, the pair in `sendReport` and their three specs are all
gone, and the answers travel only under the names the operator authored.

⚠ **SahajCloud#832 merges first.** Until it does, a report whose textarea is not named
`message` delivers an email with an empty body.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018vGoYUvXqhy2BB4y9AeMSk
The modal branched on `isPending` itself, and `reportFormPending` existed to tell that
state apart from a failed read. Both are gone. The two states now reach the mechanism built
for each: a Suspense fallback renders the spinner, and an ErrorBoundary renders the alert.

The mount moves inside the app's Suspense boundary, and stays outside its ERROR boundary —
the error CTAs must still open this modal while `ErrorFallback` is on screen.

Both new boundaries sit INSIDE `ModalContent`, not at the mount. A viewer who pressed
"Report an issue" keeps a titled, dismissable dialog either way, and the app's own
`LoadingFallback` never stands in for one modal's read.

`useReportForm` keeps its non-suspending reads and now answers `formId` beside `enabled`.
Two of its three callers are error fallbacks: a gate that suspended would blank the screen a
viewer reached because something already failed, and one that threw would take it down. It
also keeps the form read mounted for the widget's whole life, so the read still happens
while the page is healthy and `useReportFormDocument` resolves it from cache — the report
path is mostly reached FROM a failure, often the network.

`reportFormSuspenseQuery` is `reportFormQuery` minus `enabled`, since a suspending read
cannot be switched off. One query key, so the warm read and the suspending one cannot drift.

`use-report-form.test.ts` goes with `reportFormPending`: the four states it pinned are no
longer a decision this code makes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018vGoYUvXqhy2BB4y9AeMSk
@sydevs-bot sydevs-bot changed the title feat(widget): render the CMS-authored report-issue form from sy-atlas-config feat(widget): render the SahajCloud-authored report-issue form from sy-atlas-config Sep 21, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three threads, three commits, all resolved — lint, typecheck and 1582 tests green on ce201be.

Round three adds no assertion, and the body says so rather than implying coverage.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 21, 2026
Comment thread src/config/api/fetch.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 22, 2026
Query factories live in `config/api/index.ts`. Three are declared in `fetch.ts`
instead — `eventTitlesQuery`, `atlasConfigQuery`, `translationsQuery` — and each
has the same excuse: `fetch.ts` itself calls it, in `loadTitles` or a bootstrap
warm-up, so declaring it in `index.ts` would close a cycle against the import
already there.

Nothing in `fetch.ts` calls either report-form factory. They had no excuse, only
the neighbouring one, so they move to `index.ts` with `clientQuery`,
`eventQuery`, `regionQuery` and the rest.

`reportFormSuspenseQuery` was never re-exported, so `use-report-form.ts` reached
into `fetch.ts` for it while importing its twin from the barrel — the split the
barrel exists to prevent. Both now come from one place.

The docblock describing `reportFormQuery` had been stranded above
`reportFormSuspenseQuery`'s own, where TypeScript attaches neither to it. It is
back on the function it describes, and says why the cast is unreachable.

`docs/rules/data-layer.md` gains the rule, since the placement was prose nowhere
and the test for it — does `fetch.ts` call this factory? — is not guessable.

No behaviour change: same keys, same windows, same eager graph. Lint, typecheck
and 1582 tests green, and the build measures 301.6 / 303.5 / 2.6 KiB, unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VEMbghy1kqLiDQaXoVghFb
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One thread, one commit — 96eef22. Lint, typecheck and 1582 tests green, and the build measures 301.6 / 303.5 / 2.6 KiB, byte-identical to before.

Adopted

The three that stay in fetch.ts are the three fetch.ts itself calls, so the barrel would close a cycle. Neither of these two is called there — they had inherited the neighbours' excuse.

Two things fell out of the move: reportFormSuspenseQuery was never re-exported, so the hook reached past the barrel for one twin, and round three's docblock for reportFormQuery had been stranded above the other's.

The placement rule is now in docs/rules/data-layer.md. It was prose nowhere, which is why your question had no answer in the file.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 22, 2026
One conflict, in `CHANGELOG.md`: both sides appended a link definition to the
same block. Both entries stay, in number order — #216 is this branch's, #220
came with `main`.

Everything else merged on its own. `src/config/api/fetch.ts` took both sides:
`main`'s `verificationStage` select and unverified-last partition, and this
branch's `getReportForm` plus the `reportIssueForm` key on the config select.
The two touch no shared line and no shared contract.

Lint, typecheck and 1612 tests green on the merge.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ier5QxJARVCvn1PfGQHw9
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in (1fa06bd). One conflict, in CHANGELOG.md: both sides appended a link definition to the same block. Both stay, in number order.

src/config/api/fetch.ts merged on its own and took both sides — main's verificationStage select and unverified-last partition, this branch's getReportForm and the reportIssueForm config key. No shared line, no shared contract.

Lint, typecheck and 1612 tests green on the merge.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 22, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit d69b28a Sep 22, 2026
17 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-216-report-form branch September 22, 2026 03:56
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(widget): render the CMS-authored report-issue form from sy-atlas-config

3 participants