Skip to content

refactor(widget): the review asks on #318 — reuse, naming and file size - #340

Merged
Ardnived merged 15 commits into
claude/feat-147-submit-a-classfrom
claude/refactor-147-review-asks
Oct 28, 2026
Merged

Ardnived merged 15 commits into
claude/feat-147-submit-a-classfrom
claude/refactor-147-review-asks

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Change outline

Reuse — three things that did not need to exist

-src/components/molecules/AddClassLink/             # a <p> around one <Link>
+  the Link atom at its four call sites             # DynamicEventsList, CountriesView, RegionView, EventView
+    appearance="footnote"                          # the chrome, owned by the atom
+  src/views/add-class-entry.test.ts                # the wiring assertions, kept
 src/components/molecules/LanguageMultiSelect/   →  src/components/molecules/MultiSelect/
-  options: LanguageOption[]                        # { code, label }
+  options: readonly MultiSelectOption[]            # { value, label }; useLanguageOptions returns it
 src/config/api/proposal.ts
-  type PrivilegedEventField = … | 'images'         # SahajCloud's PRIVILEGED_FIELDS, restated
-  const noPrivilegedField: Extract<…> extends never # a compile-time tripwire, no runtime part

Ownership — one answer per question

 ProposalForm                                       src/components/organisms/ProposalForm/
-  reviewed = reviewedProp || seenReview || Boolean(correction)
+  reviewed                                         # useListingDraft owns it; harnesses carry its rule
 MapSearch                                          src/components/organisms/Mapbox/MapSearch.tsx
-  query?: 'url' | 'read-only' | { initial }        # the field read and wrote ?q itself
+  value / onChange                                 # the field renders and reports, nothing more
 SearchField                                        src/views/shared.tsx
+  query?: 'url' | 'read-only'                      # the header wrapper owns ?q beside the navigation
 WhereStep                                          # private PlaceField holds its text beside the draft
 EventView
-  {!livePreview.active && <correction link>}       # LivePreviewController already inerts it
 submitPanelLayout                               →  submitSheetChrome
 RegistrationForm offersMailingList              →  hasMailingList   # the API field keeps its name

The panel, by file

 src/components/organisms/ProposalForm/
 ProposalForm.tsx                                   # 676 → 212 lines: state and the step ladder
+WhereStep.tsx · WhenStep.tsx · ContactStep.tsx · AboutStep.tsx · MoreStep.tsx
+ReviewBar.tsx                                      # + REFUSAL_MESSAGE_KEYS
+fields.tsx                                         # StepProps, ValidatedInput, TITLE_MAX, CONTACT_MAX

lib/proposal.ts, audited part by part

Every part was checked for an owner that already exists. One had one; the rest each answer a
question nothing else does, so the file's size was the finding. It splits along the section
banners it already carried, re-exported from index.ts, so no call site moves.

-src/lib/proposal.ts                                # 700 lines
+src/lib/proposal/shared.ts                         # the field formats, and the leaf algebra
+src/lib/proposal/place.ts                          # a picked place: geocoder, and a stored address
+src/lib/proposal/draft.ts                          # the steps, the draft, what a filled one says
+src/lib/proposal/validate.ts                       # what stops a step, and where a submit lands
+src/lib/proposal/patch.ts                          # the Events patch, and a correction's diff
+src/lib/proposal/event.ts                          # a published class read back as a draft
+src/lib/proposal/preview.ts                        # the listing a draft previews as
+src/lib/proposal/timezone.ts                       # the nearest listed class's zone
 src/lib/shape/lexical.ts
+  plainTextToLexical                                # moved: the inverse of lexicalToText, with the
                                                     # round-trip assertion it never had

The step panel's own sheet

 src/views/DrawerStack/submit-panel.ts
-  submitSheetChrome(isWide, compact)                # full-height on wide until the review bar
+  submitSheetChrome(isWide)                         # docked to the corner for every step, ≤70%
 src/views/SubmitView/SubmitView.tsx
-  SubmitPanel onCompactChange                       # the panel reported its content to its sheet
 src/views/DrawerStack/DrawerStack.tsx
-  const [panelCompact, setPanelCompact]             # with no reader left

Preview

Preview pending — CI publishes the pr-<n> Workers alias for this PR once it runs.

Test results

  • Lean gate: ✓ lint, typecheck, 163 files / 1883 tests
  • pnpm build ✓, pnpm size ✓ — standalone 312.5 / embed 314.3 / loader 2.8 KiB, each inside budget and marginally under feat(widget): submit or correct a class, and opt into a mailing list #318's own figures: the split added nothing to the eager graph, and the dropped compact plumbing took a little out.
  • Security review: no findings. src/lib/shape/lexical.ts is a securityReview.triggerPattern path, and plainTextToLexical arrives there unchanged — it builds text nodes only, never a link node, so it cannot put an href into a document lexicalToHtml later serializes. Its sink path is the one feat(widget): submit or correct a class, and opt into a mailing list #318 reviewed. The new @/types import is import type, erased at build, which the size run confirms.
  • Four assertions were watched failing against the behaviour they replace: the correction link under a preview, SearchField writing ?q, plainTextToLexical's two, and the wide panel's docking.

Manual verification

  1. On a class page under a translations live preview, the "Suggest a correction" line shows and its link works. Under a document preview it shows and is inert.
  2. Type in the header search: ?q still tracks each keystroke, and the active filters, bbox and center survive.
  3. Open /add from a region: the address and city fields still seed from the draft after an Edit round trip.
  4. Open /add on a wide widget and walk every step. Each one now sits in the bottom-right corner at its own height rather than spanning the right edge, leaving the listing and the map's pin in view. A tall step (More details) scrolls inside the 70% bound.

Notes for reviewer

  • The submit panel already was its own vaul instance — portaled into the widget frame and measured against it, a sibling of the stack's drawer rather than an entry in it. What was still true of your note is the height, which commit 7c97a09 fixes. Thread left open for you.
  • One ask is answered with evidence rather than a commit, and its thread stays open: renaming Proposal to EventSubmission. EventSubmissions is SahajCloud's retired collection name — SahajCloud#800/#801 folded it into UserSubmissions, whose live type is 'proposal' and whose live modules are mergeProposal.ts and resolveProposalRegion.ts. Say the word and it lands next run, under whichever name you want.
  • One needs a SahajCloud copy key first: the Website field borrows submit.errors.online_url, the join-link key. There is no open translations ticket to ride on, and feat(widget): submit or correct a class, and opt into a mailing list #318's own notes already record a second gap of the same kind (submit.errors.first_date). Options are on that thread.
Detail

The audit's one real move. plainTextToLexical built a Lexical document by hand inside the proposal flow while lib/shape/lexical.ts owns that format in both directions — types/event.ts already points at it as the serializer. Nothing else failed the "another part of the code could do this" test: nearestTimeZone already delegates its arithmetic to @turf/distance through lib/geo, which is where this repo's lat/lng math lives by rule; previewSessions projects eight sessions before anything is saved, which SahajCloud cannot answer and rrule would cost more bundle than the loop it replaces; and compact turned out to be load-bearing where it looked redundant — ReviewBar counts the keys of location to decide a correction changed nothing, so leaving undefined ids in would break the no-changes message.

PrivilegedEventField emitted no runtime check — void noPrivilegedField is erased. What stops a privileged key reaching intake is sendProposal's filter against PROPOSABLE_EVENT_FIELDS, which is untouched, plus SahajCloud's own validateProposal.

The live-preview guard was wrong in one direction as well as redundant in the other: a translations session leaves links live on purpose, so the translator can reach the screen their string is on, and this guard hid the line carrying submit.chrome.correct_entry from them.

MapSearch's three query modes collapsed because two of the three were really "who owns the text". The header owns ?q because it already owns the navigation a pick causes; a form field owns its own.

A concurrent session pushed to this branch mid-run — three commits moving the foot-of-panel link chrome into the Link atom, renaming the picker option and updating DESIGN_SYSTEM.md. No file overlapped this run's, so 6b3967a is a clean merge commit and the gate above is the merged result.


Generated by Claude Code

`submitPanelLayout` and `submitPanelPlacement` read as two names for one
question. The placement helper answers sheet-versus-inline; this one answers
the vaul direction and classes once that is `sheet`, so it says so, and its
docblock names the question asked first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
`useListingDraft` already sets `reviewed` on `start` and on every `setStep`,
so the local `seenReview` flag and the `correction` fallback were two more
answers to a question the store owns. The panel now takes the prop alone, and
the story and spec harnesses carry the store's rule themselves.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
`offersMailingList` stays the name of SahajCloud's own virtual field, which
the event read returns. The form's prop is the answer to a plainer question,
so it reads `hasMailingList` from `RegistrationView` down.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
`LivePreviewController`'s capture-phase guard already inerts every link a
document session draws, so hiding this one was a second answer to the same
question. It was also the wrong answer for a translations session, which
leaves links live on purpose so the translator can reach the screen their
string is on — and that session hid the line carrying one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
`PROPOSABLE_EVENT_FIELDS` already decides what `sendProposal` sends, and
SahajCloud's `validateProposal` refuses the rest whatever this file says. The
second list only restated that collection's own `PRIVILEGED_FIELDS` so a type
could compare the two, which made an upstream rename this file's problem for
no gain the allowlist did not already give.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
One underlined line in a padded paragraph did not need a molecule of its own.
The four call sites render the `Link` atom directly, and the wiring assertions
that kept each list offering the flow move to `src/views/add-class-entry.test.ts`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
The checklist-behind-a-field was never about languages: it took a label, a
trigger label and a list of options, and both of its users happened to pass
language codes. It is `MultiSelect` over `{ value, label }` now, so the next
checklist reuses it instead of copying it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
`ProposalForm.tsx` held the panel, its five steps, the review bar and the
shared field wrapper in 676 lines, so reading any one of them meant scrolling
past the rest. The panel keeps the state and the step ladder at 212 lines;
each step, the review bar and the shared `ValidatedInput` sit beside it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWPVpmtgwRFo6diztM
The geocoder field also owned `?q` — it read it, mirrored every keystroke into
it, and carried three modes to say which. It takes `value` and `onChange` now
and holds nothing, so the header's `SearchField`, which already owned the
navigation a pick causes, owns the URL text too, and the add-a-class Where step
keeps its own beside the draft.

The `?q` spec moves with the behaviour, to `src/views/search-field.query.test.tsx`.

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

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b3967a
Status: ✅  Deploy successful!
Preview URL: https://367dbd74.sahajatlas.pages.dev
Branch Preview URL: https://claude-refactor-147-review-a.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 Oct 27, 2026
@sydevs-bot

sydevs-bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 23:14Z address-review · attempt 1 · session · done
  • 23:14Z address-review · attempt 1 · session
  • 23:06Z review-pr · attempt 1 · session · done
  • 23:06Z review-pr · attempt 1 · session

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

Nine commits, nine threads on #318, and nothing rides along — the diff is the asks and no more. The two it calls unbuilt are genuinely larger than one run, and the Proposal → EventSubmission rebuttal is evidenced rather than asserted.

The MapSearch split lands on the right seam: the field holds nothing, SearchField owns ?q beside the navigation a pick causes, and the Where step owns its own text. store.ts:328 and SubmitView.tsx:170 confirm the store is the only owner of reviewed, so dropping the two fallbacks changes no behaviour.

One ask landed as something other than reuse: AddClassLink went away, and its chrome went into four verbatim copies rather than a shared owner.

Findings

What was checked

  • The whole diff, 41 files, plus #147 and all 14 threads on #318, each traced to a commit or a rebuttal.
  • Read on the branch: config/store.ts, SubmitView.tsx, atoms/Link/Link.tsx, MapSearch.tsx, views/shared.tsx, and the five new ProposalForm/ files.
  • No contract surface moves: every renamed prop is internal, and SahajCloud keeps offersMailingList.
  • git grep: the footnote classes (4 hits), LanguageOption (declaration only), SearchField (8 sites — read-only survives at fallbacks.tsx:198).
  • Preview opened: the sy-atlas shell and embed.js both serve.

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


Generated by Claude Code

Comment thread src/hooks/use-language-options.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 Oct 27, 2026
Deleting `AddClassLink` left its wrapper paragraph copied verbatim at all four
call sites, so a padding tweak edited four files. The ask on #318 was to reuse
an existing component rather than add one, so the chrome becomes a `footnote`
appearance on the `Link` atom: the link owns the whole row and no caller wraps
it.

The variant must stay declared after `color` — both set a text colour, and
tailwind-merge keeps the last one, so the other order drops `text-gray-11` and
the line renders in the inherited colour. `Link.test.tsx` pins that, watched
failing against the swapped order.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZ8rbr929UcLqj8Haa
Every part of the 700-line `lib/proposal.ts` was checked against the rest of the
repo for an owner that already exists. One had one: building a Lexical document
from plain text is the inverse of `lexicalToText`, and `lib/shape/lexical.ts` is
the module that owns that format — `types/event.ts` already points at it as the
serializer. It moves there, with the round-trip assertion it never had.

The rest each answer a question nothing else does, so the file's size was the
real finding. It splits along the section banners it already carried, one module
per concern, re-exported from `index.ts` so no call site moves:

  shared    the two field formats, and the leaf algebra patch and preview share
  place     a picked place, in both directions: geocoder, and a stored address
  draft     the steps, the draft, and what a filled one says about itself
  validate  what stops a step, and where a refused submit lands
  patch     the Events patch, and a correction's diff
  event     a published class read back as a draft
  preview   the listing a draft previews as
  timezone  the nearest listed class's zone

No behaviour changes. `nearestTimeZone` keeps calling `@turf/distance` through
`lib/geo`, which is where this repo's lat/lng arithmetic already lives.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYYy9uHc2vP99LuLjd
`LanguageOption` and `MultiSelectOption` had become the same shape, and nothing
imported the alias. The hook returns the component's own type instead, so one
word names a picker option.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZ8rbr929UcLqj8Haa
The panel already was its own vaul instance, portaled into the widget frame and
measured against it, beside the stack rather than inside it. What was still
true of it is the height: on a wide widget only the review bar docked to the
bottom corner, and every step before it spanned the full right edge — over the
map, and over the pin the class is being added at.

It docks for every step now, sized to its content and bounded at 70% of the
frame, which is what the narrow sheet has always done with the same steps.

That leaves `compact` with no reader, so the panel stops reporting its own
content back up to the sheet: the `onCompactChange` prop, the layout effect
pair behind it and DrawerStack's `panelCompact` state all go, and the chrome
reads the container signal alone.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYYy9uHc2vP99LuLjd
The molecules table still carried `AddClassLink/`, which this branch deleted.
Its description moves to the `Link/` row, where the chrome now lives, with the
declaration-order constraint beside it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZ8rbr929UcLqj8Haa
A concurrent session pushed three commits to this branch — the foot-of-panel
link chrome, the picker-option rename and the design-system row. No file
overlaps this run's, so the merge is clean.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design 6b3967a Oct 27 2026, 11:28 PM

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Base merge: none needed, the branch was already level with claude/feat-147-submit-a-class.

Also aa69ac3: the molecules table still listed AddClassLink/, so its description moved to the Link/ row.

Lean gate ✓ 163 files / 1883 tests. Security review: no findings — src/components/atoms/Link/ is a trigger path.

🤖 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 Oct 27, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 27, 2026 23:31
@sydevs-bot
sydevs-bot requested a review from Ardnived October 27, 2026 23:31
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

I could not arm auto-merge here, so this is the step left for you.

  • arm auto-merge — GitHub said: Request failed due to following response errors: - Pull request Protected branch rules not configured for this branch

🤖 sydevs dispatcher

@Ardnived
Ardnived merged commit 6d76d87 into claude/feat-147-submit-a-class Oct 28, 2026
24 of 25 checks passed
@Ardnived
Ardnived deleted the claude/refactor-147-review-asks branch October 28, 2026 16:32
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Oct 28, 2026
Ardnived pushed a commit to sydevs/claude-workflow that referenced this pull request Nov 1, 2026
* fix(review-pr): name how to read a file as the branch has it

Step 4 told the critic to "Read/Grep the touched files whole" and did not
say how. Three sessions on three distinct days reached for a checkout,
had it refused as irreversible local destruction, and each independently
recovered with `git show <ref>:<path>`:

- 2026-10-27 sydevs/SahajAtlasWeb#340 review-pr, which named the gap:
  "review-pr step 4 says read the touched files whole and does not say
  how, and a routine clone sits on a detached HEAD"
- 2026-10-28 sydevs/WeMeditateWeb#13 revise
- 2026-10-31 sydevs/WeMeditateWeb#218 review-pr, which added the reason
  the refusal costs nothing: "A critic must not touch the branch anyway,
  so no work was lost"

The refusal is harmless and the recovery is one call, so this buys back a
refused call and a rediscovery on each of the week's 50 review-pr
dispatches, not a lost run.

It lands in step 4 because step 3 already names its own git invocation
and its own trap ("Never `FETCH_HEAD`"), so the shape is established and
the clause needs no new paragraph. Nothing in workflow/skills or
docs/why.md mentioned `git show` or `git checkout` before this.

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

* chore(loop): bump the plugin cache key to 5.3.0

An installed plugin's cache directory is named after `version` and never
revisits the commit it recorded, so the skill change above reaches no
installed consumer until this string moves. The routines read `main`
fresh and do not need it.

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

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants