Skip to content

feat(api): let an admin block a submitter, and purge spam sign-ups - #1060

Merged
sydevs-bot merged 24 commits into
mainfrom
claude/feat-630-block-submitter
Nov 4, 2026
Merged

sydevs-bot merged 24 commits into
mainfrom
claude/feat-630-block-submitter

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • An admin blocks a sender from either side — the Registrant record or any submission they sent. Screening then refuses everything that sender submits, silently, and the nightly sweep keeps their record.
  • A machine-refused registration or subscription now ages out at 90 days instead of being kept for ever — it records no attendance and no consent.
  • Joined, not listed on the ticket: senderEmail stops being a column and reads back off the Registrant, the submission edit view gets one status banner and a Context summary for all four intakes, and docs/rules/admin-ui.md named Users as a hidden: true collection, which this branch makes false.
  • Joined, found on the way: both reminder jobs carried a comment arguing that the stored senderEmail column was authoritative and a users join would be derived. Dropping the column inverted that, so the comments now state what is true and why the select needs no user.

Change outline

Contract — users gains two columns and a route, user_submissions loses one

blockedAt closes create and update to every caller, and no role grants users a write at all — so the endpoint's overrideAccess write is the only writer, and a hand-set date cannot block without also refusing the sender's open submissions.

 users                                             src/collections/Users/Users.ts
   admin
-    defaultColumns  name, email
+    defaultColumns  email, name, blockedAt
-    useAsTitle      name
+    useAsTitle      email                         # the name is often guessed from the address
-    hidden: true                                  # also unregisters the routes
+    (no hidden key)                               # accessPlugin derives it
+    beforeDocumentControls  + BlockUserButton     # clientProps.source: 'users'
+  endpoints      + blockUser
+  hooks.beforeDelete  + refuseDeletingSender      # Users/hooks/ — a sender with submissions stays
   fields
     name, email, submissions, submittedEvents
+    email.beforeValidate  normalizeEmail          # every writer, not only the public upsert
+    blockedAt      date      read-only, create and update closed
+                             "Set by the Block button. Nothing this sender submits is delivered while set."
+    blockedReason  textarea  "… Kept when the block is lifted."

 user-submissions                        src/collections/UserSubmissions/fields.ts
-  senderEmail    email    stored, indexed
+  senderEmail    email    virtual: 'user.email'   # still the create input both frontends post
+  user           relationship → users, "Submitted By"   # the only stored sender of record
+  submissionData, form, event, startingAt, eventFeedback  → update refused at the API
-- src/migrations/20261101_202242_block_submitter.ts
ALTER TABLE "users" ADD COLUMN "blocked_at" timestamp(3) with time zone;
ALTER TABLE "users" ADD COLUMN "blocked_reason" varchar;

-- src/migrations/20261103_215150_submitter_identity.ts
DROP INDEX "user_submissions_sender_email_idx";
ALTER TABLE "user_submissions" DROP COLUMN "sender_email";

Dropping the hidden key rather than writing a predicate is the one deviation from the ticket's approach: createHidden('users') already answers what !isAdminManager(user) would. Why that is the better answer, and not merely the shorter one, now lives in docs/rules/admin-ui.md — the copy that outlives this diff.

Contract — POST /api/users/:id/block

A new collection endpoint, gated on users: update, which no role grants — so only the admin bypass passes. Absent from the OpenAPI shim for the same reason users is: it sits in no project.

POST /api/users/:id/block
  body   { blocked: boolean, reason?: string (≤2000), submission?: number }
  200    { blockedAt, blockedReason, markedSpam }
  400    invalid id, or a body the schema refuses
  403    "Only an admin may block a sender."
  404    "No such registrant."

Flow — screening reads the block first

 screen(submission)                        src/jobs/ScreenSubmissions/ScreenSubmissions.ts
+  userId = relationId(submission.user)    # anonymous → no user → not blockable
+  findByID users, select { blockedAt }
+    set → settle('blocked_sender')        # before the MX lookup: a PK read is cheaper
   senderEmail?
     checkEmailAllowed  → disposable_email | invalid_email
     hasMxRecords       → no_mx_records
   type === 'proposal' → content_rejected
   loadSenderHistory  → repeat_sender | duplicate_body
   settle('ok')

The refusal is the existing spam path, so the create still answers 201, nothing is delivered or emailed, and the row drops out of fullness, reminders and votes with every other refusal. The subscribe row a registration spawns carries the same user and is screened on its own, so it is refused too.

Flow — what Block does, in one transaction

blockUser(id, { blocked, reason, submission })   src/collections/Users/endpoints/block.ts
  requireManagerPermission users:update → 403
  parseBody(bodySchema) → 400
  systemReq = createLocalReq({})          # reviewMove reads req.user; this IS the decision
  initTransaction
    blocked
      update users  { blockedAt: now, blockedReason: reason ?? null }
      refuseOpenSubmissions(userId)
        find user-submissions where user = id AND status = 'pending'
        each → status 'spam', verdict 'blocked_sender', note, activity-log 'block'
    else
      update users  { blockedAt: null }   # the reason stays as history
      logOnSubmission(submission)         # one activity-log 'unblock', when the row is theirs
  commitTransaction

status is the whole selection: the row the button sat on gets no exemption from it. Refusing that row at any status moved an accepted registration to spam, which INACTIVE_STATUSES drops out of fullness and reminders — against the modal's promise that delivered history is left alone.

Behaviour — retention

One window loses a special case; the sweep gains one.

 PURGE_WINDOWS                             src/plugins/formBuilder/index.ts
   machineSpam (90d)
-    type: { not_in: DURABLE_TYPES }       # kept a refused sign-up for ever
     status: 'spam'
   contactAccepted (7d), proposals (30d)   unchanged
-
-DURABLE_TYPES                             # nothing composed it any more
 sweepOrphanedUsers(touchedUsers)          src/collections/UserSubmissions/orphanedUsers.ts
-  for each touched user
+  find users where id in touched AND blockedAt NOT set   # the rows to sweep
+  for each of those
     count its remaining submissions
     dry run → subtract what the windows selected
     else → delete when none remain

Asking for the unblocked rows rather than the blocked ones means "blocked" is spelled once, as a where, and both branches read it — so the dry-run count stays a prediction of what the real sweep does.

Components — one submission edit view for four intakes

 user-submissions edit view
+  SubmissionStatus          # the status as a Banner heading, then what screening concluded,
+                            # its notes, and what the status means for THIS type
+  SubmissionChanges         # the proposed diff, directly under the banner
+  SubmissionData            # the answers as a key/value table, labelled from the form
   sidebar
+    SubmissionSummary       # Context: type (a Pill), Submitted By, Submitted Via, Form, Event —
+                            # a server component, each document a drawer link under the viewer's access
+    LogTable                # the activity log
+  BlockUserButton           # beside Save, admins only, hidden on an anonymous row
+  System (collapsible)      # subject, type, status, user, client, form, event, uuid — the same
+                            # five the summary presents, as ordinary read-only fields, so the
+                            # list columns and form state are unchanged
   previewTargetField
+    closedPreviewTargetField # the inverse of autoOpen: contact, subscribe and registration
                              # close the panel; proposal still opens it

Every table here is Payload's own <Table appearance="condensed"> — the same one its join fields render — with one width rule per consumer in that component's styles.css. LogTable, ImportResultsTable, SubmissionData and SubmissionSummary share no wrapper of ours.

Preview

  • Registrants list — the new Blocked At column, and the route itself, which 404'd for everyone before this branch
  • Submissions list — a blocked sender's row lands as Spam, and the Submitted By column replaces Sender Email
  • Any submission's editor — the status banner, the Context summary and Block / Unblock beside Save

Data: not seeded. The preview seed this branch carried was reverted in 2f55cc8 as a separate ticket's work, so these links open on an empty list until someone adds rows by hand. The flow was exercised on a local dev server instead, against a real Postgres: blocking [email protected] and submitting again gave status: spam, verdict: blocked_sender, the note "This sender is blocked, so nothing they send is delivered…", and an activity-log row reading Screening refused: blocked_sender.

Contract impact

src/payload-types.ts changes, so both type-mirroring consumers re-sync after this merges (contractSync in sydevs/claude-workflow): WeMeditateWeb/server/payload-types.ts and SahajAtlasWeb/src/types/payload/payload-types.ts. All three changes are additive or read-position-only — blockedAt/blockedReason on User, blocked_sender widening the screeningResult.verdict union, and senderEmail on UserSubmission keeping its type while becoming virtual. The rest of the diff there is field order, which the System group moved. No client role grants users, so blockedReason reaches no client, and a client's create response no longer echoes senderEmail because the virtual resolves under the reader's access. No consumer work needs an issue.

Migration

Two migrations, and the second is not reversible without data loss.

  • src/migrations/20261101_202242_block_submitter.ts — two nullable columns on users. No data transformed, no backfill. Reversible: yes, down drops exactly the two columns it adds.
  • src/migrations/20261103_215150_submitter_identity.ts — drops user_submissions.sender_email and its index. Reversible: schema only. down re-adds the column and the index; it cannot re-add the addresses.

Measured against production: 0 rows have sender_email set and no user_id (reviewer, 2026-11-04). The drop therefore loses nothing, and it ships as it stands rather than behind a backfill.

That matches the structural argument. user_submissions was created with user_id and with prepareUserSubmission in the same commit (6c1e9c2), and that hook has always written user from the same posted senderEmail, through the same upsertUserByEmail — so the pair was written together or not at all, and no migration has ever inserted or updated a row in this table. The one residue the tree does not settle is a users row deleted while its submissions remained: ON DELETE SET NULL would have nulled user_id and left sender_email behind. The count above says that never happened, and refuseDeletingSender, which arrives in this branch, is what keeps it from happening again.

Test results

  • Lean gate: ✓ lint, format, typecheck, typecheck:tests, 3045 unit tests in 235 files (189 s)
  • Targeted specs: block-user.int (8) and session-reminders.int (7), plus screen-submissions.int (24), retention-submissions.int (16), user-submissions-access.int (11) and user-submissions-create.int from the earlier pushes
  • Build: N/A — Railway builds it

Every new assertion was watched failing against the real defect before it was kept: the window with its type exclusion restored, the sweep with the block clause removed, screening with the block read removed, the route with hidden: true back, Block on an accepted row with the pressed-on exemption restored, and the stale blockedReason with the conditional write back. The one exception is the refusal of a non-admin's write, which is an invariant rather than a reproduction — no role has ever held users write — so it is asserted beside the read grant that makes it meaningful.

Manual verification

  1. As a non-admin manager, confirm Registrants is absent from the sidebar and /admin/collections/users 404s. Asserted in the int spec against the composed config, but worth one look in a browser.
  2. Block a sender from a submission's own editor, then submit the four intakes from that address and confirm each answers 201 and lands as Spam.
  3. Block a sender whose only submission is accepted, and confirm that row stays Accepted and the toast reports no rows marked.
  4. Clear the block and confirm the next submission is delivered.
  5. Open one row of each of the four types and confirm the status banner, the Context summary and the preview panel's open/closed state each read correctly for that type.

Notes for reviewer

  • Who reaches a Registrant now. Only an admin. I asked the booted config directly, for every principal: anonymous, atlas-manager, web-translator, an inactive manager and both client kinds all stay hidden, and access.read is unchanged — atlas-manager already read users through the registrations join.
  • Security review of the branch: no findings. It read the access layer, both guards, the new endpoint and every senderEmail consumer. Three things it checked and cleared, worth knowing: unhiding users moves no server-side gate (the REST surface was always registered, and createHidden admits only a write-holder, which is nobody but an admin); the endpoint's overrideAccess writes take no caller-derived field, collection or where key; and senderEmail becoming virtual is strictly narrower, since it now resolves under the reader's own access.
  • Scope the ticket did not name. The Block button on a submission, the status banner and the Context summary were all built here rather than ticketed. Say the word if any of them should have been its own ticket.
  • Dismissed, with reasons. Reading the block after the free in-memory disposable-list check would save one PK read in the rare case where that list moved between create and screening — not worth splitting the if (senderEmail) block for. Running the block read and the MX lookup under Promise.all would cut one serialized wait on the clean path, but makes a blocked sender pay for the DNS lookup this feature exists to avoid. Carrying blockedAt out of upsertUserByEmail at create time would read it too early: an admin can block between the create and the screen, which is exactly the race the fresh read wins. Running the dry run's two counts concurrently shares one req, which src/collections/CLAUDE.md warns against.
  • Exposure worth your call, not fixed here. touchedUsers is unbounded, so the new id: { in: [...] } read is too, and this branch grows the set it reads — the first nightly run after deploy sweeps 90 days of backlog in one go. Postgres caps a statement at 65535 bind parameters, and this is the first read here whose bind-parameter count scales with that set; noteSenders is unbounded in rows, which is a different limit. What bounds the cost is CleanupCollections.ts:113 — it catches the throw, the submission deletes stand, and the next night's set is small. So leaving it unchunked costs one logged sweep, not a stuck one, which is why no chunking is added against a harm nobody has measured.
  • Pre-existing, found on the way. The handler's own findByID of the submission passes depth: 0 but no select, so on a proposal both virtual-field afterRead hooks run — each loading the target event, its images and its manager — and the payload.update on the response pays them again. A select naming the fields the handler reads would skip both. Out of scope here; say the word and I will file it.
  • No open threads. The sender_email drop was the last one, and your count settled it.
Detail

DURABLE_TYPES is gone. Once machineSpam stopped composing it, nothing in src/ read it, and its docblock described a rule no window enforced. The rule now sits in the window that applies it; the two type names sit in the spec that asserts the invariant. The ticket said to rewrite the docblock — this goes further, because a production export whose only reader is the test that pins it is a layer that does not pay rent.

The spec that pinned "no window may reach a durable type" now asserts both directions. A second window naming no type would delete a real attendance record; an exclusion back on machineSpam would keep refused sign-ups for ever. Only the first of those is a failure anything else would notice.

The block endpoint writes as a system request, deliberately. reviewMove refuses any status move a manager makes on a non-proposal row, and it reads req.user to decide. This endpoint is the decision, already gated on the admin bypass; a system request is how every other machine writer (screening, delivery) reaches spam, and sharing one transaction keeps the block and its refusals together.

Rejected while building: an admin.condition hiding blockedReason until blockedAt is set (nobody asked, and the field is one row); a blockedAmong helper, folded into its one caller once inverting the query removed the set and the in-loop test; an isBlocked helper around the findByID, folded in for the same reason; a relationValue walk in BlockUserButton, replaced by relationId, which three other admin client components already import. A shared BLOCKED_WHERE constant plus an isBlocked predicate would give the sweep's where and screening's value check one owner, but they are different kinds of expression and each would have exactly one consumer, which tests/unit/lib-boundary.spec.ts treats as not-shared; the typed select: { blockedAt: true } two lines above the where is what catches a rename.

Known limit, marked shortcut: in orphanedUsers.ts. Lifting a block leaves the Registrant row behind for good, because touchedUsers is only ever filled from submissions being deleted, so nothing revisits a sender who has none left. An admin deletes it by hand.

Closes #630

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjXHir3nSxpuvaZaLC3

A sender we never want to hear from again could keep submitting, with the
24-hour `repeat_sender` rule as the only brake. `blockedAt` on the
Registrant record is the lasting half of that brake, set by a person.

Screening reads it first, before the MX lookup: a primary-key read is
cheaper than a DNS round trip, and a blocked sender should cost neither.
The refusal is the ordinary `spam` path, so the create still answers 201,
nothing is delivered, and a blocked sender's registration drops out of
fullness, reminders and votes with every other refusal.

`users` could not carry the field until the collection was openable.
`admin.hidden: true` unregisters a collection's routes as well as hiding
its nav entry, so a Registrant was reachable by nobody and the docblock
claiming admins see them was wrong. The function form fixes both.

The orphan sweep now keeps a blocked Registrant whatever its count says,
in the real and the dry-run branch alike, or a block would expire the
night the sender's last submission aged out.

And `machineSpam` drops its type exclusion: a `spam` registration or
subscription records no attendance and no consent, so it is evidence like
every other refusal and ages out at 90 days with them.

Refs #630

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

Each new assertion was watched failing against the real defect before it
was kept:

- the machine-spam window reaching a durable type, with the old type
  exclusion restored;
- the orphan sweep deleting a blocked sender, in both branches, with the
  block guard removed;
- screening passing a blocked sender on contact, proposal, registration
  and the subscribe row a registration spawns, with the block read
  removed;
- the Registrant route, with `admin.hidden` back at `true`.

The refusal for a non-admin is an invariant rather than a reproduction:
no role has ever held `users` write. It is asserted beside the read grant
that makes it meaningful, so a future grant cannot open the block
quietly.

Fixtures checked against the real config: `atlas-manager` holds
`users: ['read']` and no write (`src/plugins/access/config/roles.ts:81`,
the only `users` grant in the file), and `accessPlugin` composes a
hand-written `hidden` function rather than replacing it
(`src/plugins/access/accessPlugin.ts:121`), with a collection in no
project visible to all (`config/projects.ts:341`).

docs/architecture.md described a pipeline with no block in it and an
orphan sweep that only submissions could pin.

Refs #630

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

`Users.admin.hidden` is gone entirely rather than rewritten. `accessPlugin`
derives it, and for this collection the derivation already answers what a
hand-written `!isAdminManager(user)` would: no role grants `users` a write,
so only the admin bypass clears `hasAnyPermission`, and `users` is in no
project, so project visibility never narrows it. The hand-written form was
a second spelling of the role table — and the worse one, since a role
granted `users: ['update']` later is admitted by the derivation and would
have been refused by the predicate.

`DURABLE_TYPES` is gone. Once `machineSpam` stopped composing it, nothing
in `src/` read it; the list and its docblock described a rule no window
enforced. The rule now sits in the window that applies it, and the two
type names sit in the spec that asserts the invariant.

`blockedAmong` is folded into its one caller and inverted: asking `users`
for the rows with no block returns the set to sweep directly, so the
helper, the second Set and the in-loop test all go, and "blocked" is
spelled once, as a `where`.

Also: the orphan sweep said a registration or subscription is one "which
no window selects", which the window change had just made false.

Refs #630

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXHir3nSxpuvaZaLC3
…rite no key

The project-visibility section named `Users` as a collection hiding itself
with `hidden: true`, which this branch made false, and offered only the two
hand-written forms. The third option is the one `users` wanted: write no
key and let the derivation answer, wherever the role table already decides.

Refs #630

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

railway-app Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1060 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Nov 4, 2026 at 5:48 pm UTC
1 service not affected by this PR
  • mailpit

@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.

1 question for the reviewer, one per thread.

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


Generated by Claude Code

Comment thread src/collections/Users/Users.ts Resolved
@sydevs-bot

sydevs-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 17:44Z address-review · attempt 1 · session · done
  • 17:44Z address-review · attempt 1 · session
  • 17:06Z address-review · attempt 1 · session · done
  • 17:06Z address-review · attempt 1 · session
  • 16:57Z review-pr · attempt 1 · session · done

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

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 1, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 1, 2026

@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

This matches #630's shape, and in one place is smaller than it: DURABLE_TYPES is deleted rather than re-documented, because the spec pinning it was its only reader. Both heavy lenses pass. No new module, helper or type — the two reads reuse relationId and Payload's own select/exists. The contract change is additive, and nothing downstream reads it.

I checked the admin-only claim rather than took it. createHidden gates on write permission, and roles.ts:81 is the only users grant and is read — so deleting the hidden key leaves admins alone, and the new spec asserts that against an atlas-manager, the one role holding that grant.

Every finding is prose. Nothing here asks for a design change.

Findings

  • should-fix — Users.ts:21: one argument, stated three times in this diff.
  • consider — ScreenSubmissions.ts:181: says what line 197 already says.
  • consider — orphanedUsers.ts:95: the body cites the wrong precedent for an exposure it is right to leave.

What was checked

  • Read whole on the branch: Users.ts, orphanedUsers.ts, screen(), visibility.ts, accessPlugin.ts:120-140, CleanupCollections.ts:100-142, roles.ts.
  • Ladder: relationId already existed and now serves both call sites, replacing an inline typeof test. exists, select and the derived hidden are Payload's own.
  • Consumers: blocked_sender widens a union in a read position only. Grepped SahajAtlasWeb/src and WeMeditateWeb/server — type mirrors, plus two live-preview specs that strip screeningResult. No client role grants users, so a populated Events.submitter still falls back to a bare id and blockedReason reaches no client. payload-types.ts is additive, 11 lines.
  • Preview: both links answer 200, but signing in needs PREVIEW_ADMIN_EMAIL, which this environment has not got.

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


Generated by Claude Code

Comment thread src/collections/Users/Users.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 Nov 1, 2026
Six lines argued an absent key, and the same argument stood twice more in
this branch — in `docs/rules/admin-ui.md` and in the PR body. The rule file
is the copy that outlives the diff, so it keeps the reasoning and the field
config keeps a pointer to it.

Refs #630

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsF8seYfdCmb6gEys
The note above `relationId(submission.user)` said what the comment sixteen
lines down says about `senderEmail`, and the `if (userId != null)` beneath
it is the fact itself.

Refs #630

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsF8seYfdCmb6gEys
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1060 November 1, 2026 22:17 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Addressed the adversarial review's three findings. Base was already current, so no merge.

Adopted

  • Users.ts:21 — six lines cut to a pointer at docs/rules/admin-ui.md (9c8e338). The body's copy is one sentence now.
  • ScreenSubmissions.ts:181 — dropped the comment the next one repeats (7566e9f).
  • orphanedUsers.ts:95 — body only, no code. It now names the bind-parameter cap, not noteSenders, and CleanupCollections.ts:113 as what bounds the cost to one logged sweep.

Open for you

Lean gate green. Comment-only diff, so no spec changed.

🤖 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 Nov 1, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 1, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 1, 2026 22:30
@sydevs-bot
sydevs-bot requested a review from Ardnived November 1, 2026 22:30
@sydevs-bot
sydevs-bot enabled auto-merge November 1, 2026 22:30
@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 1, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 2, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 2, 2026
One conflict, in `src/migrations/index.ts`, where both branches appended a
migration. Both are kept, ordered by timestamp: main's data-only
`20261101_191500_atlas_drop_time_in_place` (#1057) runs before this branch's
`20261101_202242_block_submitter`. They touch different tables, so the order
is the chain's convention rather than a dependency.

The snapshot chain stays healthy without a merge-snapshot migration. The
newest snapshot by filename is this branch's, which the next
`migrate:create` diffs against; main's is the prior snapshot re-stamped,
because its migration is data-only and emits no DDL. Compared as objects,
`20261101_191500_atlas_drop_time_in_place.json` equals
`20261027_190500_pages_blank_slug_to_null.json`, and
`20261101_202242_block_submitter.json` equals it plus the two `users`
columns — so the newest snapshot already carries both branches' schema
(`src/migrations/AGENTS.md`, the out-of-order snapshot trap).

`src/payload-types.ts` merged cleanly and holds both edits: `blockedAt` and
`blockedReason` on Registrants, and no `time_in_place`.

Lean gate green: lint, format, typecheck, typecheck:tests, 2992 unit tests in
234 files. Integration specs for both sides, 53 passed —
`atlas-drop-time-in-place.int`, `screen-submissions.int`,
`retention-submissions.int`, `user-submissions-access.int`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZTTJ1b1acnDtHuMzR
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1060 November 2, 2026 00:43 Destroyed
`blockedReason` was only ever written, never cleared, so a second block
posted without a reason kept the lifted block's text and the record read
as though it were current. The button makes that easy to reach: it
pre-fills the textarea from the stored reason, so an admin who clears it
sends no `reason` at all.

A block now writes its own reason, `null` included. Unblock still keeps
it as history.

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

Both jobs' comments argued the reverse: that the stored column was
authoritative and a `users` join would be the derived copy. Dropping
`sender_email` inverted that — the field is `virtual: 'user.email'`, so
these reads already go through the join.

The fact worth keeping is the one the inverted comment hid: Payload
resolves a relationship-path virtual in the query, not through a
sibling's `afterRead`, so an include-mode `select` naming `senderEmail`
needs no `user` beside it. `session-reminders.int` pins it — the job
still sends to the right address with that select unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjW1aDBUWoTktqTjaWh
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1060 November 4, 2026 17:27 Destroyed
It is a separate ticket's work.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three findings built; one waits on you.

Adopted

Asked

  • the sender_email drop — I cannot take that count; it needs production pre-deploy. Ship the drop, or backfill first?

Also — 29e9bef fixes two reminder-job comments the drop inverted. Merged main in, clean.
Body — rewritten: an outline of the endpoint, button and edit view, and a ## Migration naming both.

Lean gate green. block-user.int 8, session-reminders.int 7. Security review: no findings.

🤖 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 Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 4, 2026
Devindra and others added 2 commits November 4, 2026 10:32
…stem, the delete guard in hooks/

- Field tables use `<Table appearance="condensed">`, Payload's own compact
  table and what its join fields render. CompactTable is gone; LogTable and
  ImportResultsTable are back to main, and SubmissionData's key column width
  is one rule on Payload's `.cell-field`.
- FormStateOnly is gone. Type, Status, Submitted By, Form and Event sit in
  the System group beside Submitted Via, as ordinary read-only fields: the
  banner and the Context summary present them, and the list columns and
  form state are unchanged.
- `refuseDeletingSender` moves to `Users/hooks/`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1060 November 4, 2026 17:44 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 4, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One answer, no code change.

Settled

  • the sender_email drop — A, on your count of 0 orphaned rows. The migration is untouched, and the number is now in ## Migration. Thread resolved.

Body — refreshed against your 2f55cc8 and 7ea46db. The Components outline now names Payload's <Table appearance="condensed"> and the System group instead of CompactTable, and the preview seed is out of Preview, Test results and Notes. Also corrected: blockedAt closes create and update, which the Contract block still described as open.

Base — level with main. Nothing to merge, nothing pushed, head is still 16fe289.

No threads are open.

🤖 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 Nov 4, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 4, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 0e39720 Nov 4, 2026
44 of 45 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-630-block-submitter branch November 4, 2026 18:11
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 4, 2026
sydevs-bot added a commit to sydevs/WeMeditateWeb that referenced this pull request Nov 4, 2026
Ardnived added a commit that referenced this pull request Nov 4, 2026
Main (#1060) made `senderEmail` `virtual: 'user.email'`, resolved under the
reader's access, so with the grant removed a contact recipient read every
message with no sender address. Restored on both roles, as the PR thread
decided (option A).

The `Users.submissions` join is reachable again, so its spec asserts the
join's own scope once more: a region manager and an event assignee each get
exactly the rows the per-row scope admits, against an admin control.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Nov 5, 2026
Main (#1060) made `senderEmail` `virtual: 'user.email'`, resolved under the
reader's access, so with the grant removed a contact recipient read every
message with no sender address. Restored on both roles, as the PR thread
decided (option A).

The `Users.submissions` join is reachable again, so its spec asserts the
join's own scope once more: a region manager and an event assignee each get
exactly the rows the per-row scope admits, against an admin control.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Nov 5, 2026
Reverts the restore. An Atlas manager reads their event's registrants on
the Registrations view (#1073), and a contact's sender address arrives in
its delivery mail; both read with `overrideAccess`, so neither needs the
Registrants collection.

The cost is deliberate and now pinned: a manager's read of a submission
carries no `senderEmail`, since that is `virtual: 'user.email'` (#1060).
Main's contact-scope cases identify rows by form instead, and the
Registrant-block case asserts the manager can read no Registrant at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1060 — 16fe2898 Deployed Nov 4, 2026 by railway-app[bot]
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(api): let an admin block a submitter, and purge spam sign-ups

3 participants