Repository navigation
feat(feedback): land a post-event reader in the atlas, not a dead-end card - #181
Conversation
SahajCloud redirects a reader who answered the "did this class take place?" email to the class's canonical page carrying `?feedback=confirmed`, or to its region page carrying `?feedback=denied` (sydevs/SahajCloud#626). That parameter is on the HOST's real query string, not inside `?atlas=`, so no router of ours describes it — `useSearchParams` never sees it. It is read off `window.location` at the call site, exactly as `pageLocaleOverride` is. Two properties are load-bearing and both are pinned: - The answer is read in a `useState` initializer, not an effect, so a COLD load from an email client renders the acknowledgement on the first frame rather than one commit later. - The parameter is then removed with a surgical string edit rather than `URLSearchParams.delete()`. `delete()` re-serializes the whole query, which undoes `routeToParam`'s deliberate `/` and `,` — the part of a shared link that has to stay readable — and rewrites a HOST's own `a%20b` to `a+b`. Measured; the docblock carries the before/after. An unrecognised value is ignored and left in place: it is then presumably the host's own, and silently deleting somebody else's parameter is worse than doing nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JUN3Ckwmofq3UHPtwHFNxC
…and on A thank-you above the event they confirmed, or an acknowledgement above the region they were sent to after saying the class was not there. The denied copy is the one that needed care, and two decisions in it are deliberate. It never implies the listing was fake or has gone: one report is not a verdict — the listing only comes down at five denials with a Wilson upper bound below 0.5 — so it thanks them for the report and stops. And it promises nothing about what is underneath it. The ticket's suggested wording ended "Here are other classes near you", which is reachably false: the fifth denial unpublishes the event, so that region can legitimately have nothing left to list and the sentence would sit directly above an empty state. The onward rung is therefore asymmetric. `confirmed` lands on a single event page, so the way onward has to be offered explicitly and the banner carries a link to the event's own region. `denied` lands on the region page, whose list IS that onward step, so a link there would point at the page the reader is already on. Copy added across all ten locales — `common` is parity-enforced per locale. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JUN3Ckwmofq3UHPtwHFNxC
A host can observe this: links the CMS already sends now arrive on their pages carrying a parameter the widget reads and then removes from the address bar. Per CLAUDE.md that is not finished until `docs/embedding.md` and CHANGELOG.md say so, in the same PR. Also corrects a claim that has just become false. Both the guide and `locale-param.ts` said `?locale=` was "the second and last parameter the widget claims on your URL". It is still the last one it WRITES; `feedback` is a third it knows about, read once and removed. The distinction matters to a host, so the word "writes" is now doing that work explicitly in both places. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JUN3Ckwmofq3UHPtwHFNxC
Deferred until the number existed: `[#164]` is already taken in this file by PR #164 (`routing=path`), which is a different thing from issue #164, so the entry could not borrow it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JUN3Ckwmofq3UHPtwHFNxC
Deploying sahajatlas with
|
| Latest commit: |
2de5899
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c76da223.sahajatlas.pages.dev |
| Branch Preview URL: | https://claude-feat-post-event-feedb.sahajatlas.pages.dev |
Deploying sahajatlas-design with
|
| Latest commit: |
2de5899
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://50f267eb.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://claude-feat-post-event-feedb.sahajatlas-design.pages.dev |
Ardnived
left a comment
There was a problem hiding this comment.
@sydevs-bot Please review and fix this PR as per my comments. Push back if needed.
… be dismissed Applies the review on #181. - FeedbackBanner is gone. Each view renders `Alert` directly: EventView shows only `confirmed` and RegionView only `denied`, so neither call site branches and the component was one indirection over a single variant each. - The acknowledgement is dismissable, via Alert's own onClose/closeLabel. Dismissal is per-view state on `usePostEventFeedback`, which already owned the read-once-then-strip lifecycle. - EventView moves it below the details, beside the Register action, rather than above the class it acknowledges. - RegionView suppresses GeolocationSuggestion while it is up, and restores it on dismiss — two stacked prompts above the list is more than the screen carries. - Copy restates what the reader did, in all ten locales. - The Ladle story is gone with the component, which also removes the nested MemoryRouter that made it throw: .ladle/components.tsx already provides one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC
… when empty Follows the review decision on #181: copy-only normally, with a real search link as the fallback. The region's own list is the onward step, so the banner names it rather than linking to the page the reader is already on. A region with nothing left to list is the exception — the fifth denial unpublishes the event, so it is reachable — and there the sentence would sit directly above an empty state, so it becomes a link into the distance-ranked search instead. ⚠ That link is NOT centred on the region, and cannot be: `getRegion` derives `bounds`/`center` from the events under a region, so both are null in exactly the empty case (pinned by fetch.test.ts). SearchView already falls back to a snapshot of the map camera when `?center` is absent, which on this screen is the area the reader was looking at. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC
… banner in it Per the review on #181: the acknowledgement belongs beside the action it wants the reader to take, and Register lives inside EventDetails when it is inline — so the panel is the only thing that knows where that action sits. EventDetails takes `children` and renders them immediately above Register. A slot rather than another boolean beside `registerInline`: what goes there is a view's business, and the alternative was a new flag per addition. Where Register is not inline (the mobile map sheet mounts EventRegisterBar in the sticky footer), the slot still renders after the facts, which keeps it above the sticky bar in reading order. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC
|
This is green and finished except for one decision that is yours: keep the six-line query-string strip, or swap it for the built-in Everything else from your review is in. Seven of the eight threads are resolved — I closed the On the one still open ( That leaves a smaller, purely-stylistic question. The hand-rolled strip now buys exactly two things:
My recommendation is to keep it, mostly for (2) — rewriting a parameter on a page we don't own is the one thing here that could affect somebody else's site. But it is a judgement call about neighbourliness, not correctness, and if you'd rather have the shorter file, the swap is two lines with the built-in and I'll make it on request. No new dependency either way: State of the PR, and why
|
…angling the URL `feedback-param.ts` carried a hand-rolled query editor because `URLSearchParams.delete()` re-serializes every surviving pair — losing the `/` and `,` `routeToParam` restores, and rewriting a host's `%20` to `+`. That argument is not specific to `feedback`, so it moves to `lib/shape/query.ts` as `searchWith`/`searchWithout` + their href forms. Rewiring `localeHref` onto it fixes a live defect: it wrote `?locale=` with `searchParams.set` + `toString()`, so every language switch re-encoded a readable `?atlas=/gb/london` into `%2Fgb%2Flondon` and rewrote host parameters. Nothing broke (the readers percent-decode either way), which is why it went unnoticed — the existing spec handed in an already-encoded route and read back through `searchParams.get`, so it was vacuous in both directions. `routing.ts` is deliberately left on its private `readable()` pass; moving `hrefFor`/`pathHrefFor` over is a follow-up rather than part of this PR. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Ready for review — green on The last open thread was the query-parameter one, and The thing worth knowing before you read the diff: that refactor turned up a live defect rather than only tidying one. One follow-up I deliberately left out of this PR
They are the routing core with a round-trip suite of their own, so it is a separate change. Say the word and I'll open it; it is not blocking anything here. Checks on the current head: Lint/Typecheck/Build, Smoke, Dependency Audit and both Cloudflare Pages deploys all green. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
@sydevs-bot Go ahead and update routing.ts to use the new query.ts helpers. Look for opportunities to simplify and remove duplicate code. We want simple, robust, and easy to maintain code. |
…r for every parameter `hrefFor` and `pathHrefFor` wrote `?atlas=` with `searchParams.set` and then repaired the collateral damage with a private `readable()` pass over the whole query. That recovered `/` and `,` and never recovered a host's `%20`, which `set` had already turned into `+` — so the widget rewrote parameters on pages it does not own. Both now edit their pair through `searchWith`/`searchWithout` and leave every other pair byte-identical; `readable()` is gone. `routeToParam` was byte-identical to `query.ts`'s private value encoder, so that encoder is now exported as `encodeParamValue` and `routeToParam` delegates. One implementation, so the encoding `?atlas=` is written with and the encoding every other parameter is written with cannot drift. ⚠ `hrefFor` calls `searchWith` (the string editor), NOT `hrefWith` (the URL wrapper). `hrefWith` answers '' when the value is already present — right for `publishLocale`/`clearFeedback`, which both mean "leave the URL alone" by it, and catastrophic here: this feeds `createHref` for every <Link>, so a link to the route already on screen would render a blank href. Both properties were uncovered: reintroducing each defect left the whole 457-test shape suite green. Two assertions added, each verified failing against its defect and passing restored. `src/loader/` is deliberately left hand-rolled — a value import across that seam is what `pnpm size` fails the build for. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Done — I put it in this PR rather than a follow-up: The trap it had to avoid
Two coverage gaps, which is the part I'd want you to noticeI reintroduced each defect against the suite as it stood before this commit. The whole 457-test shape lane stayed green for both:
So the self-link trap would have shipped green if I'd reached for Simplification and duplication
One thing I found and did not act on, because it's beyond what you asked.
VerificationEvery CI gate reproduced locally, not just the lean one: lint · typecheck · 1491 unit · build · 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Resolves the CHANGELOG.md link-definition conflict left by #184's squash merge: both [#181] and [#184] definitions belong, in numeric order. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018oiV3fKDoPhKcjhX39LvWp
|
Unblocked — this was un-mergeable and is green again. Nothing here needs a decision from you; it is back to waiting on review. Merging #184 made The conflict was one hunk: both PRs appended a link definition to the same block at the foot of All five checks green on the merge commit. Re-validated locally before pushing rather than trusting the merge: lint · typecheck · 114 files / 1499 unit specs · 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
@sydevs-bot For
For
Make sure that all locales are updated with appropriate translations |
The whole sentence was in Alert's `title` slot — ~90 characters of bold in a `size="sm"` banner inside a 22rem drawer, which wrapped to three lines and read as a paragraph rather than a heading. Ardnived's review on #181 supplied the replacement copy; this is it, across all ten locales. `feedback.confirmed` / `feedback.denied` each become `{ title, body }`. The onward rung is now a block link on its own line, matching the layout the review drew, and the confirmed banner keeps its region link. The denied copy ends "You can find other nearby classes below." That clause is the existing `below` key rather than part of `body`, so the two join into the one paragraph the review asked for on the normal path, while an empty region — reachable, since the fifth denial unpublishes the event — substitutes the search link instead of making a claim above an empty state. `i18n-budgets.test.ts` gains a 40-character ceiling on both titles, per locale, so a retranslation cannot quietly restore the sentence-as-heading. Verified failing first: the old German title reads 98 chars against it, and a title that goes missing fails as "is missing" rather than passing vacuously. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC
|
Done —
One place I did not follow the copy literally, and it needs your call. Your denied text ends "You can find other nearby classes below." That clause is reachably false: the fifth denial unpublishes the event, so a denying reader can land on a region with nothing left to list, and the sentence would sit directly above an empty state. I kept it as the separate
If you'd rather it always read as one sentence, say so and I'll merge them — it's a one-line change, and the empty-region case just becomes a claim we don't stand behind. Two smaller notes. I kept the onward link's existing underline rather than rendering it italic as your markdown showed. Italic links are unusual and the I also added a 40-character ceiling on both titles, per locale, to Unrelated, found while doing this: the PR description is stale in two places. It lists Lean gate green locally: lint · typecheck · 114 files / 1509 unit specs (up 10, the new per-locale budget assertions). 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
?feedback=confirmedthanks them above the event;?feedback=deniedsits above the region list.Changes
src/lib/shape/feedback-param.ts— pure: read the answer, and the surgical query edit that removes itsrc/hooks/use-post-event-feedback.ts— the whole wiring: read once in auseStateinitializer, strip in an effectsrc/views/{EventView,RegionView}— one call each, rendering the acknowledgement through theAlertatom (title + body,primary/ticked for confirmed,neutral/unticked for denied);docs/embedding.md+CHANGELOG.mdcarry the host-facing halfsrc/config/i18n-budgets.test.ts— a 40-character per-locale ceiling on the two banner titlesPreview
Both Cloudflare Pages deploys for
2de5899, discovered from their check runs — these are per-deployment aliases, so they stay pinned to this commit (CI's own smoke lane ran against the first).Deep links, in the order worth clicking them:
deniedin the real app — the acknowledgement above Amsterdam's own class list, and?feedback=already gone from the address bar by the time you read it — https://c76da223.sahajatlas.pages.dev/nl/amsterdam?feedback=denied?keep=a%20b, not?keep=a+b— https://c76da223.sahajatlas.pages.dev/nl/amsterdam?feedback=denied&keep=a%20b?feedback=maybestill sitting in the address bar, because it is then presumably the host's — https://c76da223.sahajatlas.pages.dev/nl/amsterdam?feedback=maybeconfirmedin the real app — open any class from https://c76da223.sahajatlas.pages.dev/nl/amsterdam, then append?feedback=confirmedto that class's URL and reload⚠ That last one is the only two-step, and deliberately so: class ids come from the events feed, which I could not read while writing this, and a guessed id would land you on a not-found rather than on the banner. The preview carries the published atlas key itself, so no
?key=is needed.Contract impact
?feedback=is observable by every embedding host — links SahajCloud already sends now arrive on their pages carrying a parameter the widget reads and removes — sodocs/embedding.mdandCHANGELOG.mdchange in this PR, per CLAUDE.md.sydevs/WeMeditateWeb(/map/*) andsydevs/SahajAtlasWordpress. Neither needs a code change — the widget claims one more name on the query string but still writes onlyatlasandlocale.The guide also corrects a claim that just became false: both it and
locale-param.tssaid?locale=was "the second and last parameter the widget claims on your URL". Still the last it writes;feedbackis a third it reads once and removes.Neither doc quotes the banner's wording, so the review round below changed no part of the host-facing contract.
Test results
lint·typecheck·test:run— 114 files / 1509 specs passedfeedback-param.test.ts(14, node) ·use-post-event-feedback.test.tsx(6, jsdom) ·i18n-budgets.test.ts(+10, one title budget per locale)assert:css,assert:maps,size,ladle:build2de5899: all five checks green — Lint/Typecheck/Build, Dependency Audit, Smoke, and both Pages deploysManual verification
deniedlink. The banner sits above the region's list, and?feedback=deniedis already out of the address bar.replaceState, not a navigation, so there is no entry to go back to.&keep=a%20blink and read the address after the banner appears:keep=a%20b, unchanged.?feedback=maybelink: no banner, parameter untouched.confirmed, follow the two-step above. Check the onward rung goes to that class's own region.Review round 1 — the banner's copy (
2de5899)@Ardnived's review replaced the wording: the whole sentence had been sitting in
Alert's boldtitleslot, where it wrapped to three lines and read as a paragraph rather than a heading.feedback.confirmed/feedback.deniedare now{ title, body }in all ten locales, and the onward rung is a block link on its own line.One deliberate departure, still open for a decision. The supplied
deniedcopy ends "You can find other nearby classes below." That clause is reachably false — the fifth denial unpublishes the event, so a denying reader can land on a region with nothing left to list. It is therefore kept as the separatebelowkey: a normal region rendersbody+belowas exactly the paragraph written in review, and an empty region rendersbodyalone followed by a real link into the search. Merging them is a one-line change if the single sentence is preferred.The 40-character title ceiling in
i18n-budgets.test.tsis what stops a retranslation quietly restoring the sentence-as-heading. Verified failing first, per.claude/rules/tests.md: the previous German title measures 98 against it, and a title that goes missing fails as "is missing" rather than passing vacuously at length 0.Detail
The thing that shaped the implementation
?feedback=is on the host's real query string, and no router of ours describes it. In query mode the widget's route is the value of?atlas=; in path mode it is the pathname plus the query nested inside?atlas=(routeFromPathname). A parameter the CMS appended to a canonical URL is in neither, souseSearchParamsnever sees it. It is read offwindow.locationat the call site — the same thingpageLocaleOverridedoes, for the same reason, with the same one-line justification in the code.The read is a
useStateinitializer, not an effect. That is what makes the last acceptance criterion — a cold load from an email client — actually work. From an effect the banner would appear one commit after paint. There is a spec that fails if it moves.The strip is a hand-rolled string edit, not
URLSearchParams.delete(). This rewrites the host's URL, so exactly one pair may change and everything else must survive byte-for-byte..delete()re-serializes the whole query. Measured on a realistic URL:Two separate losses in that middle line: it undoes
routeToParam's deliberate restoration of/and,— the one thing that has to stay readable in a shared link — and it rewriteskeep=a%20b, which is a host's parameter we have no business touching. Both are equivalent to a parser and neither is what the page had. The second preview link above is that difference, live.That edit was later generalized into
src/lib/shape/query.ts, so every parameter the widget writes to a host's URL goes through one encoder — see the commits from68ba7ba, which also fixedlocaleHrefmangling the whole query on every language switch.Scope checklist
?feedback=confirmed?feedback=deniedfeedbackwithhistory.replaceStatehistory.statepassed through verbatim so the atlas history's__sy_atlasslice survivescommon.feedback.*, all ten locales (parity-enforced)useState-initializer read; speccedOn the canonical: it needed no code.
EventMetadataemitsevent.webUrlandRegionViewemitsvalidateWebUrl(region.webUrl)— both CMS-supplied, neither derived from the page URL — so afeedbackvariant could never have reached a canonical link. I deliberately did not add a test for it: nothing puts the parameter there, so the assertion would pass for reasons unrelated to the property, which is the vacuous-spec trap.claude/rules/tests.mdwarns about. Recording the reasoning here instead.Tests
Pure decisions in the node lane (
feedback-param.test.ts), the wiring in jsdom (use-post-event-feedback.test.tsx) — the split the testing rules ask for, with the DOM half justified becausewindow.location+history.replaceStateis an agreement a pure spec can only assume.Every new assertion was made to fail before being kept, per
.claude/rules/tests.md, at the site that would really cause it:URLSearchParams.delete()→ 4 redclearFeedback()call so the helper is never invoked (chore(build): make preview discovery survive a slow cloudflare deploy #132's exact shape) → 2 redAlso asserted:
history.statesurvives the rewrite (drop it and the next X climbs to the structural parent instead of going back — nothing else readslocation.key, so every other spec would stay green), and an unrecognised?feedback=is left in place rather than deleted.One wrinkle in the CHANGELOG entry, since it will recur
Entries reference the PR that landed them, and
[#164]was already taken in that file — by PR #164 (routing=path), which is a different object from issue #164, the ticket this closes. GitHub's shared numbering between issues and PRs makes that collision inevitable and silent. Handled by deferring the reference to its own commit once this PR had a number; the entry now reads([#181]).Closes #164