Repository navigation
chore(claude): adopt the shared workflow plugin - #656
Merged
Merged
Conversation
Replace this repo's copies of the workflow skills and hooks with the `workflow` plugin from sydevs/claude-workflow. Per-repo variation moves to .claude/workflow.json, so the deltas that used to live in three hand-synced copies of workflow-parity.md now have exactly one definition each. - remove draft-ticket, implement-issue, finalize-pr, reflect-session, sync-workflow, fix-bug and dev-server skills; pr-prep/check.sh stays - remove the four hooks the plugin now provides; payload-types-gen and unit-test stay repo-local - remove the inert researcher.yaml agent and the security-reviewer agent (covered by /security-review and the security-guidance plugin) - correct README's Cloudflare/D1 deployment to Railway + Postgres - move the e2e admin password out of tracked source into env vars Co-Authored-By: Claude Opus 5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-656
August 27, 2026 19:03
Destroyed
Ardnived
pushed a commit
that referenced
this pull request
Aug 29, 2026
Resolves one delete/modify conflict on .claude/skills/finalize-pr/SKILL.md: main deleted it in #656 when the workflow skills moved to the sydevs/claude-workflow plugin, while this branch had edited it. Taking main's deletion. The edit itself was worth keeping and is not lost — it documents that a conflicted PR schedules zero workflow runs, silently, so `gh run list` reads as a stuck scheduler rather than a blocked merge. That has been ported to the plugin's copy of finalize-pr, which is now the only copy. Co-Authored-By: Claude Opus 5 <[email protected]>
Ardnived
added a commit
that referenced
this pull request
Aug 29, 2026
The smoke lane's `ensureAdmin` bootstraps a preview by logging in and, on failure, calling Payload's `first-register`. Payload returns Forbidden from `first-register` as soon as the auth collection holds any document, so once a preview has been seeded the only 403 it can produce means "an admin already exists that PREVIEW_ADMIN_PASSWORD does not open" — the opposite of what the raw error reads like. That is the state this PR's preview is in. Its Postgres has been up since 2026-08-26T22:47Z and the first smoke run seeded [email protected] with the password that was still hardcoded in this file; #656 then moved the credential to the PREVIEW_ADMIN_PASSWORD secret (created 2026-08-27T17:35Z), and a preview's volume outlives its deploys, so the seeded admin kept the old value. Login fails on the new secret, first-register is Forbidden, and all five auth-dependent smoke specs die on a Payload stack that says only "You are not allowed to perform this action". #656's own CI could not catch this: the preview-URL discovery step found no preview on #656, #657 or #658, so the smoke lane skipped there and this branch is the only place the change has ever run. Report the real cause and the remedy, drop the getter's stale pointer at the Railway service variables (nothing server-side reads that name), and record in AGENTS.md that the secret is stable per preview rather than rotatable on its own. This does not turn the lane green — the preview database still has to be reset so it can be seeded again — but it stops the failure from reading as a registration bug. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Aug 30, 2026
Ardnived
added a commit
that referenced
this pull request
Aug 31, 2026
* refactor(emails): rename the contact-admin send path to user messages The intake is becoming a `user-messages` collection screened by a job, so the email path is named for what it carries rather than for the endpoint that used to own it: - `sendContactAdmin` -> `sendUserMessage` - `ContactAdminEmail` -> `UserMessageEmail` (plus `buildContactDetails` -> `buildUserMessageDetails` and the two exported types) - `ContactAdminContext` -> `UserMessageContext`, relocated out of `endpoints/responseTypes.ts` into the collection that will store it Also corrects the template footer, which promised "nothing about this message is stored; this email is the only record". That was true under #602 and is about to be false — a copy is kept for screening and triage, then purged. What the sender is told about their own data is not bookkeeping trivia, so it changes with the behaviour. `CONTACT_EMAIL` is untouched: it is the public support address, not part of this intake. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(user-messages): async intake with deep spam screening Replaces the synchronous send inside `POST /api/contact-admin` with a persisted collection plus a screening job, applying the shape `ScreenEventSubmissions` established to a second public intake. Intake moves onto the collection seam — API clients create through the built-in `POST /api/user-messages` — which is what earns it the usage plugin's origin enforcement and the write-guard's anti-spam policy instead of hand-rolling both. Screening runs what the request path could not afford: an MX lookup (fail-open), a disposable-list re-check, how many messages this sender sent in the last 24h, and whether this exact body arrived before. Clean messages are emailed and marked `delivered`; the rest are kept as `spam` for triage. The failure story survives async delivery. A send failure marks the row `failed` *before* rethrowing — the job runner gives each task an isolated transactionID, so that write commits and the row is visible immediately, while the throw still earns a retry that re-attempts the send. Access is deliberately tighter than event-submissions: `user-messages` is in RESTRICTED_COLLECTIONS and granted by NO manager role, so reading one takes the admin bypass. `sahaj-atlas-client` holds create only. Two things are duplicated on purpose, both noted in the code: this job owns its copy of `hasMxRecords` (the two intakes stay independent, and the verdict *wording* was never shareable), and `screening.ts` writes its own notes rather than reusing the event-submission ones. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(user-messages): nightly retention sweep Persisting messages was accepted on the understanding that they do not accumulate, so the retention policy ships with the intake rather than being deferred. Delivered messages are deleted after 7 days — short enough to nearly keep #602's "nothing is stored" promise, long enough that the two 24-hour screening windows still have history to count against. That lower bound is the load-bearing part: shorten it past the window and the repeat-sender and duplicate-body checks would silently pass everything. Spam is kept 90 days, because a sender's history is what makes a pattern visible, and `failed` is never swept — it is the one state where deleting the row destroys the only record that a message went undelivered. Runs at 04:00 UTC on the existing `nightly` queue, after the 02:00/03:00 sweeps. Note that `monthly` has no autoRun entry, so a task scheduled there would never fire. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * feat(api)!: replace POST /api/contact-admin with the user-messages intake BREAKING CHANGE: `POST /api/contact-admin` is gone. Clients create through `POST /api/user-messages` instead. Three things move on the wire: - the Turnstile token goes in the `x-turnstile-token` HEADER, not the body (the write-guard reads it there — it is transport metadata, not document data); - the response is Payload's `{ doc, message }` at 201, not `{ ok: true }`; - the machine code moves from `errors[].code` to `errors[].data.code`, which is where Payload's `formatErrors` puts an APIError's `data`. Safe to cut over in one step: the Atlas widget is still pre-release and no third-party host embeds it yet. SahajAtlasWeb needs the matching change. Deletes with it: the `ContactAdmin*` types in `endpoints/responseTypes.ts`, the hand-authored OpenAPI path + schemas, and `antiSpamErrorResponse` — whose only production consumer was that handler. `parseBody`, `checkNoUrls` and `verifyTurnstileOrFail` all have other consumers and stay. `atlas/seo` is now the ONLY root endpoint, so every doc that used contact-admin as the canonical example is re-pointed. `.claude/rules/ endpoints.md` keeps the story rather than erasing it: "stored nowhere and owned by nothing" was true only because the endpoint chose not to store anything, and that is the trap — ask whether a resource is genuinely ownerless or merely unpersisted before reaching for the root. `responseTypes.ts` stays put despite now serving one endpoint; client repos sync it by a stable raw GitHub URL. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(lib): move antiSpamGuard out of lib/endpoints Its consumers are now the write-guard plugin and the two screening jobs — not a single endpoint, since `contactAdmin` became a collection. Leaving it under `endpoints/` would have made the folder name a lie for the next reader. `requireActiveClient` / `parseBody` / `parseQuery` stay: those are still genuinely endpoint helpers. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(migrations): add user_messages table and status enum Generated by `db:migrations:create`, unedited. Validated: - `up` is purely additive — 0 DROP statements. The two the validator flags are both in `down`, reversing the new table, which is correct. - The task-slug enums gain their values via `ADD VALUE ... BEFORE`, not the drop-and-recreate that a value *rename* would have produced. - `client_id` / `user_id` are `ON DELETE set null`: deleting a client or a registrant must not destroy the message they relayed or sent. - Indexes land on `sender_email` and `body_hash` — the two columns the screening job's history counts look up by. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * test(user-messages): cover the intake, screening, and retention Three integration lanes plus a unit lane. Three of the assertions were checked by breaking the thing they guard, because each could otherwise pass vacuously: - the field-access tests forge `screeningResult` and `deliveredAt`, not `status` — status is defended twice (field access AND the prepare hook overwrites it), so it cannot isolate the guard. Removing `systemFieldAccess` makes both fail; with it, both stick as stripped. - the intake spec runs `overrideAccess: false` with a real published client. The override the sibling event-submissions spec uses skips field access entirely, so a spec using it could not tell a stripped field from an accepted one. - the retention/window invariant (delivered retention must outlive the screening window, or the history checks count against deleted rows and silently pass everything) fails when the constant is lowered. Two findings recorded rather than papered over: - The screening spec's fixtures originally shared one message body and seven cases failed on the duplicate-body check. That was the check working; `seed()` now varies the body unless a case names one. - `ALLOW_POST_FOR` turns out to be necessary but NOT sufficient: tier 2 hides any path whose collection is in no project, so both public intakes' POSTs are `x-internal`. The test asserts the real behaviour for both, and `.claude/rules/openapi.md` now says what would actually change it. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * chore(admin): regenerate the import map for UserMessageStatus The status banner is registered as a field `components.Field`, which the admin import map has to resolve at runtime. Generated, not hand-edited. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor: simplify per /simplify pass Three cleanups, no behaviour change: - `screen()` returned its verdict from five places, three of which hand-carried the diagnostic via a repeated spread and two of which correctly omitted it — a shape a reader has to verify rather than read. One `settle()` exit now carries it wherever it has been set. - `screen()` took `messageId` alongside the `message` it came from. - `context`'s validator was inline while `message`'s was extracted; both are named functions now. Reuse angle found nothing to reuse: no shared hash or name-from-email helper exists, and `hasMxRecords`'s duplication is the recorded decision. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(user-messages): validate a restored verdict against the real set `isScreeningResult` asserted `value is UserMessageScreeningResult` while checking only that `verdict` was a string — an assertion wider than its check, which the compiler then propagates. The review that raised this described the wrong failure (notes filled with `undefined` via `messageVerdictNote`); that cannot happen, because the note is only ever composed from a freshly computed verdict, never from the restored one. The real consequence is worse and is now pinned by a test: a `failed` row whose stored verdict is unrecognisable was TRUSTED, so screening was skipped and a disposable-address message got delivered. Loosening the guard makes that test fail with `expected 'delivered' to be 'spam'`. `MESSAGE_VERDICTS` is now a runtime list with the type derived from it — the same shape as `USER_MESSAGE_STATUSES` — because a value read back out of a JSON column needs something to check against. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(user-messages): restore the 254-char bound on the sender address Found by the security pass, as a parity gap rather than a vulnerability. The endpoint this collection replaces bounded `email` at 254 via Zod, and its OpenAPI schema published that. Payload's `email` field has **no** `maxLength` option — the option is absent from `EmailField`, present only on text-shaped fields — so moving the intake onto a collection dropped the bound silently, leaving an unbounded string on a public write path. Restored as a validator composing Payload's own `email` check, the same shape `message` already uses. Tested in both directions so it cannot pass by rejecting everything. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs: sync Turnstile and access docs with the collection move Docs-sync sweep of the branch diff turned up three stale spots and one that was misleading before this branch: - DEPLOYMENT.md quoted a log line operators grep for, `contactAdmin: Turnstile verification could not be completed`, which no longer exists — the guard logs under `antiSpamGuard:` now. Both it and .env.example also described the secret as belonging to one endpoint; it covers the whole public write surface, via a header. - `.claude/rules/access.md` said a collection in no project is reachable only by explicit-permission users. That is the opposite of what step 5 of its own permission flow says: no project means SHARED, i.e. implicitly readable by every role. `RESTRICTED_COLLECTIONS` exists precisely because of that, and the section never mentioned it — which is a trap for anyone adding a collection that holds personal data. Rewritten with the two knobs and how they compose. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs: state the root-endpoint criterion, not the count PR #651 adds `/api/atlas/sitemap` as another root endpoint, so wording that asserted "exactly one" / "the only root endpoint" would have been false the moment either PR merged, whichever went first — and would have collided textually in the same paragraphs. The durable point was never the count: it is that "unpersisted" is not "ownerless", which is what #632 demonstrated by deleting an endpoint whose only claim to being ownerless was that it chose not to store anything. That survives any number of siblings. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Revert "fix(user-messages): restore the 254-char bound on the sender address" Removed at the user's request. The bound was raised by the security pass as a parity gap rather than a vulnerability — an over-long address is a storage concern, not an exploitable one — and Payload's `email` field still rejects anything that isn't a well-formed address. This reverts d8f5a2b, including its test. Refs #632 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(ci): a conflicted PR runs no CI, and nothing says so Cost ~30 minutes of this session. `main` moved under this branch (#651), the PR went CONFLICTING, and GitHub silently stopped scheduling runs — a `pull_request` workflow runs against the merge commit, and a conflicted PR has none. Nothing surfaces that: `gh pr checks` showed only Railway (which kept deploying, since it builds the branch head, not the merge), `gh run list --branch` was empty, and no job appeared failed. It reads exactly like a stuck scheduler, so the instinct is to wait, or to close/reopen the PR — neither of which touches the cause. Documents the one-command diagnostic (`gh pr view <n> --json mergeable,mergeStateStatus`) in AGENTS.md, and puts it as a precondition in the finalize pipeline's CI-watch step, which is where the workflow actually meets it. Two traps recorded with it: a green run can be STALE (it predates `main` moving, so a conflicted PR looks tested — check the run's `head_sha`), and docs conflict far more readily than code, because sibling feature PRs edit the same paragraph of the same rules file even when they share no functions. Hence the advice to write shared rule docs as a criterion rather than a count. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * fix(e2e): name the stale-preview-admin case instead of a bare 403 The smoke lane's `ensureAdmin` bootstraps a preview by logging in and, on failure, calling Payload's `first-register`. Payload returns Forbidden from `first-register` as soon as the auth collection holds any document, so once a preview has been seeded the only 403 it can produce means "an admin already exists that PREVIEW_ADMIN_PASSWORD does not open" — the opposite of what the raw error reads like. That is the state this PR's preview is in. Its Postgres has been up since 2026-08-26T22:47Z and the first smoke run seeded [email protected] with the password that was still hardcoded in this file; #656 then moved the credential to the PREVIEW_ADMIN_PASSWORD secret (created 2026-08-27T17:35Z), and a preview's volume outlives its deploys, so the seeded admin kept the old value. Login fails on the new secret, first-register is Forbidden, and all five auth-dependent smoke specs die on a Payload stack that says only "You are not allowed to perform this action". #656's own CI could not catch this: the preview-URL discovery step found no preview on #656, #657 or #658, so the smoke lane skipped there and this branch is the only place the change has ever run. Report the real cause and the remedy, drop the getter's stale pointer at the Railway service variables (nothing server-side reads that name), and record in AGENTS.md that the secret is stable per preview rather than rotatable on its own. This does not turn the lane green — the preview database still has to be reset so it can be seeded again — but it stops the failure from reading as a registration bug. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * refactor(user-messages): let jsonSchema own the JSON columns' shape and types (#660) Applies the review on #653. The JSON fields now carry a `jsonSchema`, which Payload compiles to a write-time validator AND generates the field's type from — so `types.ts`'s `UserMessageContext` and `screening.ts`'s `UserMessageScreeningResult` are gone rather than kept in agreement by eye. - `context`: open schema (unknown keys still pass, per the intake contract); `validateContext` and its serialized-length cap deleted. - `screeningResult`: closed schema, `verdict` enum derived from MESSAGE_VERDICTS so the runtime list and stored contract cannot drift. - `message`: built-in `minLength`/`maxLength` replace the composed validator; both bounds inline. - `messageVerdictNote` becomes the `MESSAGE_VERDICT_NOTES` record. - `UserMessageStatus`: `Severity`/`BANNER_TYPE` collapse into `Banner`'s own type; the defensive `notesOf` filter goes, the schema having closed the hole. - `normalizedBodyHash` folds into its one consumer, `prepareUserMessage`. Per-key documentation survives as JSON Schema `description`, which Payload renders into the generated type's JSDoc. Claude-Session: https://claude.ai/code/session_01Jry6g9kMG1UQ63N99vABAC Co-authored-by: Claude <[email protected]> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Devindra <[email protected]> Co-authored-by: SYDevelopers Bot <[email protected]>
Ardnived
pushed a commit
that referenced
this pull request
Nov 5, 2026
Resolves one delete/modify conflict on .claude/skills/finalize-pr/SKILL.md: main deleted it in #656 when the workflow skills moved to the sydevs/claude-workflow plugin, while this branch had edited it. Taking main's deletion. The edit itself was worth keeping and is not lost — it documents that a conflicted PR schedules zero workflow runs, silently, so `gh run list` reads as a stuck scheduler rather than a blocked merge. That has been ported to the plugin's copy of finalize-pr, which is now the only copy. Co-Authored-By: Claude Opus 5 <[email protected]>
Ardnived
added a commit
that referenced
this pull request
Nov 5, 2026
The smoke lane's `ensureAdmin` bootstraps a preview by logging in and, on failure, calling Payload's `first-register`. Payload returns Forbidden from `first-register` as soon as the auth collection holds any document, so once a preview has been seeded the only 403 it can produce means "an admin already exists that PREVIEW_ADMIN_PASSWORD does not open" — the opposite of what the raw error reads like. That is the state this PR's preview is in. Its Postgres has been up since 2026-08-26T22:47Z and the first smoke run seeded [email protected] with the password that was still hardcoded in this file; #656 then moved the credential to the PREVIEW_ADMIN_PASSWORD secret (created 2026-08-27T17:35Z), and a preview's volume outlives its deploys, so the seeded admin kept the old value. Login fails on the new secret, first-register is Forbidden, and all five auth-dependent smoke specs die on a Payload stack that says only "You are not allowed to perform this action". #656's own CI could not catch this: the preview-URL discovery step found no preview on #656, #657 or #658, so the smoke lane skipped there and this branch is the only place the change has ever run. Report the real cause and the remedy, drop the getter's stale pointer at the Railway service variables (nothing server-side reads that name), and record in AGENTS.md that the secret is stable per preview rather than rotatable on its own. This does not turn the lane green — the preview database still has to be reset so it can be seeded again — but it stops the failure from reading as a registration bug. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
workflowplugin from sydevs/claude-workflow..claude/workflow.json, so deltas that lived in three hand-synced copies ofworkflow-parity.mdnow have one definition each.Why
The three repos kept the same workflow in sync by hand against a spec requiring byte-identical copies. They had drifted 90–250 lines apiece, pipeline steps were renamed between them, and
/sync-workflowhad been auditing against~/Documents/Projects/— a path the repos left some time ago, so every audit compared against missing files.Changes
draft-ticket,implement-issue,finalize-pr,reflect-session,sync-workflow,fix-bug,dev-server;pr-prep/check.shstays repo-local.payload-types-gen.mjsandunit-test.mjsstay.researcher.yaml(inert — agents load from.md) andsecurity-reviewer.md(covered by/security-review+ thesecurity-guidanceplugin).README.md: correct the Cloudflare Workers + D1 deployment description to Railway + Postgres..env.example:DATABASE_URI=file:./local.db→DATABASE_URLPostgres.E2E_ADMIN_PASSWORD/PREVIEW_ADMIN_PASSWORD.Test results
src/changes.Notes for reviewer
enabledPluginsmust be an object map ({"workflow@sydevs": true}), not an array — the array form installs the plugin but silently leaves it disabled.The preview admin password has been rotated;
PREVIEW_ADMIN_PASSWORDneeds to exist in CI secrets and Railway service variables for the preview e2e lane.