Skip to content

feat(preview): render a user-submission proposal from postMessage - #212

Merged
sydevs-bot merged 13 commits into
mainfrom
claude/feat-163-submission-preview
Sep 18, 2026
Merged

sydevs-bot merged 13 commits into
mainfrom
claude/feat-163-submission-preview

Conversation

@sydevs-bot

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

Copy link
Copy Markdown
Contributor

Summary

  • /preview now renders a proposal. A manager reviewing one sees the event as accepting it would leave it, beside SahajCloud's own diff.
  • It renders from the payload-live-preview message and makes no request of its own — API clients hold create-only on user-submissions, so a populate round trip is a certain 403, and SahajCloud#816 populates the message's relationships instead.
  • It reads previewEvent and drops every other key, so no submitter email, note or screening result reaches the screen, a log, a report or the cache.

Changes

  • src/config/live-preview/protocol.ts — LIVE_PREVIEW_COLLECTION, one home for the slug. It was still event-submissions, so the /preview arm had matched nothing the CMS sent since SahajCloud#801. Since 3d046c8 nothing reads it off the URL: /preview serves one collection, so the slug is only what the message filter matches.
  • src/config/live-preview/boot.ts — the boot reader takes the token and the id, and no collection (3d046c8).
  • src/lib/live-preview/submission.ts — new, pure: the PII containment (readPreviewEvent), the tolerant parse, and the shaping into an event document.
  • src/components/live-preview/ — one file per arm since f9343dc. SubmissionLivePreview.tsx is this one (subscribe, resolve the region, seed the cache, pin the route). populate.ts and route-lock.ts hold the two seams all three arms sit on. LivePreviewController.tsx keeps the guards every session shares and the choice of arm.
  • src/types/event.ts — EventDoc.region becomes nullish. See Notes for reviewer.
  • src/types/payload/ — pnpm types:cms, its own commit. Generated only, and it introduced no type error of its own.

Preview

https://claude-feat-163-submission-p.sahajatlas.pages.dev — the branch alias. This route only renders inside SahajCloud's admin iframe, so a preview link cannot show it on its own; see Manual verification.

Contract impact

  • This branch expects SahajCloud#816 on main (39b7add). That PR populates previewEvent.images with image documents in the editor's order, and names the region Accept will write on a new-event proposal. So getImages, imagesQuery and EventImageDoc are deleted here, and the arm issues no read of its own. The dependency degrades rather than breaks: without #816 a bare id fails its own entry and drops out, so the preview shows no photographs rather than blanking.
  • Generated Payload types are refreshed to SahajCloud main (its #801 / #695 Phase 3): event-submissions, registrations and user-messages are gone, replaced by user-submissions. No other consumer reads this repo's copy.
  • Nothing in the feature depends on that resync, and it is not claimed to: it is this repo's contractStep (.claude/workflow.json), which the finalize pipeline runs on every PR, landed alone in 5c6b880 so it reverts alone. LIVE_PREVIEW_COLLECTION is a bare literal, mutate.ts addresses the retired endpoints by raw path, and registrationQuestions is identical across both revisions.
  • The boot URL's collection parameter is no longer read. SahajCloud keeps sending it (plugins/formBuilder/index.ts:185) and the widget ignores it, so this needs no upstream change and breaks no existing preview URL.
  • No host-observable change. No new origin, no CSP or Permissions-Policy change, no attribute, no URL-shape change — so docs/embedding.md and CHANGELOG.md are deliberately untouched.

Test results

  • Lean gate: ✓ pnpm lint && pnpm typecheck && pnpm test:run — 121 files, 1548 tests
  • Targeted specs: 50 across src/lib/live-preview/ and src/components/live-preview/
  • Build: ✓ pnpm build + pnpm size on 39b7add — standalone 295.0 / 308 KiB, embed 296.9 / 308 KiB, loader 2.6 / 3.5 KiB. 0.1 KiB smaller than 3d046c8, the deleted fetcher.

Manual verification

Everything below needs SahajCloud's admin, which no automated lane here reaches, and #816's branch for steps 3 and 4.

  1. Open a user-submissions row with type: 'proposal' in the admin. The Live Preview panel opens by itself; the atlas should show a spinner, then the merged event's drawer.
  2. Edit the proposal's proposed fields and confirm the drawer follows each keystroke — not just the first.
  3. Confirm the region name and the photographs render, and check DevTools → Network: no request to user-submissions and none to images.
  4. Open a new-event proposal (no event). It should name the region screening anchored, and render with no photographs rather than an error.
  5. Check the console and the Sentry breadcrumbs carry no senderEmail or submissionData.

Notes for reviewer

  • EventDoc.region is now nullish, and that is the one contract change. A proposal whose screening has not anchored a region names none, and SahajCloud's submissionRegionId returns null for it. Every fetched event still carries one, and src/types/event.test.ts pins both directions. One call site needed a guard (EventMetadata's JSON-LD Place).
  • The preview and Accept no longer disagree about the region. SahajCloud#816 makes computePreviewEvent mirror the write through submissionRegionId, the disagreement mergeProposal's own docblock called worse than no diff. §3 of Event submission preview — render a user-submission proposal from postMessage #163 still forbids reading the submission's own region off the message, and this repo does not.
  • The create-only grant is real and deliberate, checked against SahajCloud main (5c835b4). access/config/roles.ts:106-123 grants sahaj-atlas-client create alone, config/projects.ts:169 marks the collection restricted so no implicit project read rides along, and a verified preview token lifts drafts rather than permission (accessConfigs.ts:126). SahajCloud#814 took Option 1 — populate in computePreviewEvent — so the grant is untouched and the widget reads nothing back.
  • The controller is split one file per arm, answering the separation-of-concerns thread. Widget.standalone.test.ts pins the Payload hook's importers as a closed list, so the second importer is a decision, made in f9343dc: both files sit behind the one lazy seam App.tsx mounts the controller through.
  • Two questions are still yours to settle, both answered with evidence rather than a change: whether /preview should become a contained /proposal route (the controller is not proposal-only, and the literal is SahajCloud's), and the standing offer to drop useLivePreview and read the message directly — which removes the fake populate, the id trick, and the reach into Payload internals.
  • Two dismissed review findings, both out of scope and both pre-existing on main: createRegistration still POSTs /events/:id/register and sendReport still POSTs /user-messages, endpoints SahajCloud#801 deleted. feat(api): migrate widget intakes to unified form-submissions #195 owns both, and this PR's type resync only makes them legible. Nothing here calls either.
  • /security-review ran (the diff touches src/config/api/, src/types/event, src/lib/shape/path) and found nothing above threshold.
Detail

Why a reserved event id at /preview/0. A proposal is not an event: a new-event one has no id, and an update proposal's merged shape is not what events/<id> would answer, so seeding the real id would put an unsaved patch under the key the saved document reads. resolveStack already skips the reserved preview word and reads a digit segment as an event drawer, so /preview/0 opens one with no change to the router, the drawer stack or RESERVED_SLUGS.

Why the boot route names no collection. /preview serves exactly one, so the route already says which, and the parameter beside the id was a second unauthenticated claim about what is on screen — plus a literal that had to stay in step with the CMS's slug, and silently did not through SahajCloud#801's rename. The session drops the field, the arm opens on the boot id (read on /preview and nowhere else), and namesPreviewedDoc still matches the posted message against LIVE_PREVIEW_COLLECTION. A /preview/user-submissions path instead would need SahajCloud to compose it, and SahajCloud#723 owns retiring the route outright.

Why the populate handler answers locally, and keeps the submission's id. mergeData is only requestHandler(…).then(res => res.json()), so answering it in the browser turns the round trip into a pure read of what the panel already posted. It answers { id: <submission id>, previewEvent } rather than the event itself, because the library caches what it returns and addresses the next populate at <collection>/<that result's id> — returning the merged event would re-address message two at the event's id and namesPreviewedDoc would refuse every edit after the first. The transport spec pins that second edit.

What makes a refused message survivable. mergeData returns the handler's answer whole and merges nothing of its own, so every seed() reaches the call site as { id } with no previewEvent. The endpoint it gates on is built from the message's collection slug plus our id, so a message about any other document is refused by namesPreviewedDoc and arrives that way. The event arm gets stickiness free — its parse gates a cache write — while this arm's feeds render state, which is what the lastPreview ref is for.

Relationship hydration, and where the tolerance had to move. #163's scope said to confirm region / images still resolve from the pushed ids. images now arrive as documents (SahajCloud#816), so nothing resolves them here. region stays a bare id on purpose: raising the producer's depth is shared with computeProposedChanges, where a populated relationship renders by name instead of by row id and would change what the reviewer reads. The widget already holds the whole tree, so it costs no request.
The images array is therefore tolerant per entry, not as a whole. A CMS that has not shipped #816 posts bare ids, and one of those failing the array outright would cost the reviewer every photograph on the event, while one failing the parse would blank the preview — so an entry that does not read drops out, exactly as the producer drops an id whose row has gone.

Where the tolerance stops. eventType and languages are not relaxed: newEventDefaults supplies both on a new-event proposal and an update proposal inherits its target's, so a message missing one is a cleared required field — which Accept refuses to write too. The parse refuses it and the last good preview stays on screen, rather than a fallback showing a value nobody is going to get. id, title, region, registrationMode, the relationships and a half-typed schedule do stay tolerant.

Why the split is three files and not two. The submission arm shares exactly two things with the event and region arms: namesPreviewedDoc, the document filter that keeps one arm from rendering another's document, and the route lock. Everything else is disjoint — the other two populate against the CMS and overlay the drawer's own cache entry, while this one answers in the browser, has no saved document to fall back on, and renders its own waiting state. So the two shared pieces became their own modules rather than exports of an arm, and no arm imports another.

Every new assertion was watched failing. Each defect was reintroduced at the site that caused it, per docs/testing.md: the containment removed from readPreviewEvent (2 red), the real event id kept (1), the reserved id dropped from the path (1), the schedule tolerance removed (1), the region tree ignored (1), the submission dispatch removed from the controller (4), the handler answering with the merged event directly (4), the containment removed at the handler (3), and the sticky-preview ref removed (1). The first review round added four: the populated-region branch deleted from resolveRegion (1), the id filter dropped from previewImageIds (1), the nullish tolerance restored to the schema (1), and the sticky ref removed again against the new other-collection message (2). The second added one: the collection read restored to readLivePreviewParams (3). The third added two, at their own sites: the per-entry image tolerance narrowed back to a whole-array parse (2 red), and the null filter dropped from shapePreviewEvent (1).

The skeleton assertion needs a DOM, and the cache cannot stand in for it. A later message with no previewEvent leaves the cache entry untouched while covering it with the overlay, so a cache-only assertion passed with the defect reintroduced. It now asserts the portal's role="status".

Closes #163

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01LH37839ZoJfX1iJSQnPNha

`pnpm types:cms`. SahajCloud#801 (its #695 Phase 3) landed the unified intake:
`event-submissions`, `registrations` and `user-messages` are deleted, and one
`user-submissions` collection replaces all three.

Generated output only, and it introduced no type error of its own — every
error the refresh surfaced came from the region widening in the commit after
next, which is why this lands on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTRmrGNjcyhz3HidwWBoVH
`readLivePreviewParams` nulls any collection that is not the one literal, so
the `/preview` arm matched nothing the CMS sent from the moment SahajCloud#801
renamed `event-submissions`. Nothing broke visibly — the route has never
rendered a proposal — but the gate was dead rather than loud.

The literal now has one home, `LIVE_PREVIEW_COLLECTION`, so the reader and the
type cannot drift from each other again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTRmrGNjcyhz3HidwWBoVH
The `/preview` arm now renders. A manager reviewing a proposal sees the event
as accepting it would leave it, beside the diff SahajCloud shows them.

**It renders from the message, and fetches nothing.** API clients hold
create-only on `user-submissions`, so the populate round trip Payload's own
`mergeData` performs is a certain 403 — and a new-event proposal has no Event
id to fetch instead. `mergeData` is only `requestHandler(…).then(res =>
res.json())`, so answering that handler locally turns the round trip into a
pure read of what the panel already posted.

**It reads `previewEvent` and drops the rest.** The message is the whole
document form state: the submitter's address, their note, the `user`
relationship, the screening result, the activity log. `readPreviewEvent` is
the one door, so none of it can reach the screen, a log, a report or the
cache.

**The proposal renders under a reserved event id, at `/preview/0`.**
`resolveStack` already reads a digit segment as an event drawer and skips the
reserved `preview` word, so the whole drawer stack works unchanged. The
reserved id also keeps an unsaved patch out of the key the saved event reads.

**Relationships resolve by id, on our side.** The region comes off the
wholesale tree the widget already holds; images get their own read, since
`images` is readable where the submission is not. One that has not landed is
left out rather than blocking the rest.

`EventDoc.region` becomes nullish, and that is the one contract change here: a
new-event proposal genuinely has no region, because SahajCloud assigns one
from the submission row only when a manager accepts it. Every fetched event
still carries one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTRmrGNjcyhz3HidwWBoVH
Three findings from the review pass over this branch.

A message carrying no `previewEvent` — every message about a row that is not a
proposal, and any read the projection's access refuses — put the skeleton back
over an event the reviewer was reading. The event arm's parse gates a cache
WRITE, so a failure there is harmless; this one feeds render state, so it has
to be sticky.

`alt` is localized on SahajCloud's Images, so the image read needs the locale
in its key, exactly as `eventQuery` and `regionQuery` do. Without it a
mid-session language switch left every caption in the first-fetched language.

`JSON.stringify` throws on a cycle, and a structured clone can carry one. The
library's listener holds no catch, so that throw would have ended the
subscription rather than dropping one message.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTRmrGNjcyhz3HidwWBoVH
…tions

`getImages` is a new fetcher, so the data-layer rule names it and why it exists
where a populated event needs none. The testing guide's jsdom precedent for the
transport spec gains the submission arm's own reason: the waiting overlay is a
portal, and the cache cannot see it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FTRmrGNjcyhz3HidwWBoVH
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8991439
Status: ✅  Deploy successful!
Preview URL: https://e4e87c14.sahajatlas.pages.dev
Branch Preview URL: https://claude-feat-163-submission-p.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 16, 2026
@sydevs-bot

sydevs-bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 23:11Z resolve-conflicts · attempt 1 · session · done
  • 23:11Z resolve-conflicts · attempt 1 · session
  • 18:25Z address-review · attempt 1 · session · done
  • 18:25Z address-review · attempt 1 · session
  • 17:18Z 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 shape is right and tracks #163: the message is the only source, and readPreviewEvent is a real containment. The region widening is confined — the feed schema still requires one.

The resync is the shape question. 2256 of ~3000 lines are generated, and nothing in the feature needs them: mutate.ts addresses the dead endpoints by raw path, so the SDK's Config never gated them, and registrationQuestions is identical across both revisions. Say what depends on it, or land it alone.

Findings — should-fix: the sticky lastPreview ref defends a sequence with no producer. consider: two of shapePreviewEvent's five fallbacks duplicate newEventDefaults. consider: previewRegionId is exported for its spec alone.

Checked — #163, the hand-written diff, LivePreviewController.tsx, submission.ts. Consumer side: mergeProposal.ts, computeReviewFields.ts (loadTargetEvent is depth 0, so getImages answers a real gap), UserSubmissions/fields.ts, Events.ts. payload-types.ts diffed on both revisions.

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


Generated by Claude Code

Comment thread src/lib/live-preview/submission.ts Resolved
Comment thread src/lib/live-preview/submission.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 17, 2026
`resolveRegion` was its only real user; the export and the barrel
re-export existed for the spec alone, which is not a caller. The spec
now asserts the region through `shapePreviewEvent`, where it covers both
branches — a bare id looked up in the tree, and one the message already
populated — rather than the extractor in isolation.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017Top981CKVPvApH1t1EoUC
`shapePreviewEvent` stood in for `eventType` and `languages` as if it
were replacing `newEventDefaults`, which already sets both — and an
update proposal inherits its target's. So neither fallback fires for any
proposal the CMS can produce, and `languages ?? []` disagreed with the
`['en']` Accept would write.

The one message that would reach them is a cleared required field, and
Accept refuses to write that too. So the schema stops admitting it: the
parse refuses, the caller holds the last good preview, and the reviewer
is not shown a value nobody is going to get.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017Top981CKVPvApH1t1EoUC
The ref stays; the sequence it defends is not the one the comment named.
A row's `type` is immutable after create and the route opens only for a
proposal, so `computePreviewEvent` does return the merged event on every
read of it — and the access refusal the comment also named strips the
field from the first message too, which is not a sequence.

What does produce one is the handler's own seed. `mergeData` builds the
endpoint from the MESSAGE's collection slug and our id, and returns the
handler's answer whole, merging nothing — so a message about any other
document is refused by `namesPreviewedDoc` and arrives as `{ id }`. The
transport spec now drives that path, and fails without the ref.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017Top981CKVPvApH1t1EoUC
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Review round: two adopted, one answered. Pushed 08ec66c, lean gate green (120 files, 1541 tests).

  • The sticky lastPreview ref — kept, comment replaced (thread). The sequence it named has no producer. The handler's own seed does: mergeData builds the endpoint from the message's slug plus our id, so a message about any other document arrives as { id }. The transport spec drives that path now. Left open, since you asked for the ref to go.
  • Two unreachable fallbacks — dropped, and the schema no longer admits their absence (thread).
  • previewRegionId — folded into resolveRegion (thread).

The resync: nothing in the feature depends on it, as you found. It is this repo's contractStep in .claude/workflow.json, which finalize-pr runs on every PR, and it is already alone in 5c6b880.

🤖 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 17, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 17, 2026 00:19
@sydevs-bot
sydevs-bot requested a review from Ardnived September 17, 2026 00:19
Comment thread src/config/api/fetch.ts Resolved
Comment thread src/config/live-preview/boot.ts Resolved
Comment thread src/lib/live-preview/submission.ts Resolved
@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot Address my last review and also determine why that review was not automatically picked up and addressed. File a ticket on claude-workflow to fix it.

@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 17, 2026
Ardnived pushed a commit to sydevs/claude-workflow that referenced this pull request Sep 18, 2026
* test(dispatch): pin the review-comment path, red against main

Four cases the suite never had. All 76 existing tests pass with and without
the fix that follows, because nothing covered the mapping at all: a review
comment resolved to reason `issue_comment` and no test asserted otherwise.

Committed red on purpose, so the evidence the fix is load-bearing is in the
history rather than in a claim. Against this commit's parent:

    not ok 2  - resolve gives a review comment its own reason
    not ok 20 - a review comment on a bot PR re-derives the PR
    not ok 21 - a review comment from the bot, or from outside the allowlist
    not ok 22 - a review comment carrying a verb on a human PR

Two of them pin note text, not just action types. `types()` renders every
note as the bare string `note`, and an unhandled reason returns exactly one
note, so the bot and stranger cases would both stay green on shape alone.

Refs #109

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>

* fix(dispatch): a review comment is feedback, whatever its association

A CHANGES_REQUESTED review with four inline comments landed on
`sydevs/SahajAtlasWeb#212` and dispatched nothing. The PR sat untouched until
the reviewer asked why, eleven minutes later.

`resolve.mjs` mapped every review comment to reason `issue_comment`, whose row
gates on `hasAccess(association)` — OWNER | MEMBER | COLLABORATOR. GitHub sends
`CONTRIBUTOR` for a review comment by the same login it sends `MEMBER` for on
every issue comment, so both surviving runs logged `comment by Ardnived without
write access — not feedback` and returned a note. The gate is redundant where
it fired: the line above already requires `respondTo(author)`, an explicit
allowlist of three logins, and a payload-derived check over an allowlist can
only subtract.

The review's own event is the one path with no such gate, and it was cancelled.
Submitting a review with inline comments emits five events in one second, all
resolving to the same target and so to one concurrency group; three of the five
were cancelled, `pull_request_review.submitted` among them.

Cancelling is safe only because the decision is re-derived, which `dispatcher.yml`
says itself. The association gate is what broke that: the survivors returned
before reaching `evaluatePr`, so nothing re-derived anything.

So the reason, not the gate. A review comment resolves to `review_comment` and
delegates to `case 'review'`, which re-derives the PR through `evaluatePr` —
the invariant the concurrency block assumes, restored rather than replaced.
Whichever of the five survives now sees the thread the cancelled comment
created, since `gather.mjs` fetches review threads for any open PR.

Only the bot guard differs from `case 'review'`: that case's bot branch carries
the critic-header exception, which belongs to reviews alone. Everything after
it — the allowlist, bot PR to `evaluatePr`, human PR to `parseVerb` — is shared
rather than copied.

`association` leaves the review-comment facts with the reason; nothing on the
new path reads it. `triggerType` is untouched and still reaches the record, so
a handler still finds the comment it was woken for. The gate at `decide.mjs`
still guards `issue_comment` proper, where the author is not otherwise bounded,
and its test stays green. `dispatcher.yml` is unchanged.

Closes #109

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>

* refactor: simplify per /simplify pass

Comment volume, and one fixture that was not earning its place.

Three comment blocks restated the narrative that `docs/why.md` already carries
under the anchor each of them links — the `CONTRIBUTOR` stamp said in full in
three files, and the SahajAtlasWeb#212 incident twice. Each keeps its imperative
half and its breadcrumb; the story stays in one place, where it cannot drift.

The bot half of the ignore test is what this row's own guard buys, and its
fixture did not punish removing it: a body of `finding` fails the critic-header
test, so `case 'review'` would have noted it either way. The comment now opens
with the critic header on a bot PR with an unanswered own-rooted thread, which
is the case the guard exists for. Delete the guard and the test goes red on
address-review firing against the bot's own words. Checked by deleting it.

Kept, against the pass: the verb-on-a-human-PR test, which reaches
`case 'review'`'s verb tail that nothing covered before, and the inert
`association: 'CONTRIBUTOR'` in its fixture, because that is the stamp GitHub
really sends on that payload.

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>

* docs(dispatch): the restored invariant holds for bot PRs, not every PR

The review pass caught the comment and `why.md` claiming more than the code
does. Both said a surviving leg re-derives the PR's whole state, full stop.
That is true through `evaluatePr`, which only bot PRs reach. A human PR takes
`case 'review'`'s verb tail, which reads the body the event carried — so a verb
left in the review body is still lost when that leg is the cancelled one.

The gap predates this change and survives it. Closing it means widening what
`gather.mjs` collects, since the snapshot carries issue comments and not
review-comment bodies. Named rather than fixed, because it is nobody's surprise
the next time it fires.

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>

* docs(dispatch): the critic's own review is the one uncovered leg

The restored invariant was stated too broadly. On the loop's own critic
review every review-comment leg stops at the bot guard, so only the
`pull_request_review.submitted` leg re-derives, and cancelling it leaves
nothing behind it. The `unlock` the critic's own lock release fires is
what covers that case, not this row.

why.md now says which legs the claim holds for and names the mechanism
that covers the remaining one. The comment above `case 'review_comment'`
carried the same overclaim in one clause; it now reads "from a human on
a bot PR", which is what the guard two lines below already enforces.

Prose only. No behaviour changes: 80/80 specs unchanged.

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

---------

Co-authored-by: Claude <[email protected]>
@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 18, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Asked. Nothing adopted, nothing pushed — the one new thread turns on a decision only you can make.

  • The /proposal route — the controller is not proposal-only (LivePreviewController.tsx:231-243), and /preview is SahajCloud's own literal (formBuilder/index.ts:188), so the rename is a two-repo change. I offered the contained half instead: drop useLivePreview and read the message directly. That removes the fake populate, the id trick, and the reach into Payload internals you objected to.

Still waiting on you, both answered with evidence: the closed populate endpoint and that same offer.

🤖 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 18, 2026

@Ardnived Ardnived left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sydevs-bot Revise this PR to account for the changes being merged into SahajCloud via sydevs/SahajCloud#816

@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 18, 2026
SahajCloud#816 populates `previewEvent.images` with image documents, in
the editor's order, so the widget's own read of the `images` collection
has nothing left to do. `getImages`, `imagesQuery` and `EventImageDoc`
go with it, and the arm's second query goes with them: `region` is now
the only relationship arriving as a bare id, and it resolves off the
region tree the widget already holds.

The array stays tolerant per ENTRY rather than whole. A CMS that has not
shipped #816 yet still posts bare ids, and one of those costing the whole
array would cost the reviewer every photograph on the event, while one
costing the parse would blank the preview entirely. So an entry that does
not parse drops out — the same thing the producer does with an id whose
row has gone.

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

Copy link
Copy Markdown
Contributor Author

Adopted SahajCloud#816 and pushed — 39b7add. The widget now reads the proposal's images off the message.

  • getImages, imagesQuery, EventImageDoc and the arm's second query are deleted. region is the only bare id left, and it resolves off the region tree already in hand.
  • The closed populate endpoint — your finding, now fixed at the producer. Resolved.
  • This branch expects #816 on main. Without it a bare id drops out per entry, so the preview shows no photographs rather than blanking.
  • #816 also sends the region Accept will write, so the preview/Accept disagreement I flagged is gone.

Lean gate ✓ 121 files, 1548 tests. Build + pnpm size ✓, 0.1 KiB smaller.

Still open for you: the /proposal route and the offer to drop useLivePreview.

🤖 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 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 18, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 18, 2026
#215 landed the `scope` parameter and the `documentPreviewActive()` gate on
the same four files this branch rewrites. Both sides are kept.

`boot.ts` — the session keeps no `collection` (this branch) and gains `scope`,
read on every route (#215). `protocol.ts` merged clean and already carries that
shape.

`LivePreviewController.tsx` — both imports. The gate turns a scoped session
away, and the document arm below it still picks the submission arm on a boot
id.

`boot.test.ts` — #215's two scope cases join this branch's "reads no collection
off the boot URL", which subsumes #215's collection-nulling case: the field is
gone from the session, not narrowed.

`transport.test.tsx` — reset through `LIVE_PREVIEW_INACTIVE`, which is #215's
own fix for the `scope` leak this branch's spec would otherwise carry.

Lean gate green: lint, typecheck, 1559 tests across 122 files.

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

Copy link
Copy Markdown
Contributor Author

Merged main (#215) in — 8991439. Both sides kept. Lean gate green: lint, typecheck, 1559 tests.

Two hunks where the choice was not obvious:

The rest was additive: boot.ts keeps no collection and gains scope on every route, and LivePreviewController.tsx keeps both imports so the scoped-session gate sits above the arm choice.

🤖 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 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 18, 2026
Merged via the queue into main with commit 0be8771 Sep 18, 2026
11 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-163-submission-preview branch September 18, 2026 23:21
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 18, 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.

Event submission preview — render a user-submission proposal from postMessage

3 participants