Repository navigation
Description
Summary
The loop cannot sign in to a SahajCloud preview, so finalize-pr writes Data: not seeded yet and
review-pr accepts that line in place of a link that shows the change. sydevs/SahajCloud#1081 puts
every preview behind a Cloudflare Access gate at a fixed per-PR address, seeds it from a committed
fixture, and turns a preview it cannot fill into a red check. This ticket is claude-workflow's
whole share of that goal: a sign-in helper, a documented meaning for previewUrl.auth, the two
skills' seeding text made conditional on that red check, the two service tokens written down, the
plugin version bumped, and one docs/why.md passage corrected.
Goal context
Part of sydevs/SahajCloud#1078 — "Reviewers open every content-system preview with test data, as any
role, behind a sydevs login". #1081 builds the gate, the picker and the fixture; this is the goal's
only other child, and it gives the loop a way through that gate while stopping the written rule from
accepting a sentence where the gate now produces a check.
Approach
Read sydevs/SahajCloud#1078's Technical notes block before starting. Everything its "Settled from
the docs" table marks settled is settled — do not re-research Workers-before-Access, the Custom
Domain choice, the two Service Auth policies, or where the cache sits.
Three repo rules bind every part below.
- ⚠ Merging to
mainhere IS the deploy. The cloud routines read the skills fresh frommain
on every run, so a merge reaches them on their next run, and there is no rollback but another
PR. Open the PR. A human merges it, deliberately — this repo is in
mergePolicy.loopMayNotMerge(loop-config.json). - ⚠ Nothing here can be tested by running it. A skill edit takes effect on the next session,
never the current one. So the PR body must state, for each change, the failure that change
prevents. That reasoning is the only evidence available before merge. - One PR is allowed, with one commit per behaviour, each named in the PR body. The hard split in
this repo is "never ship a skill change and a ceiling change together", and no part of this
touchesloop-config.json→ceilings. Part A adds a token-name value under a new key, which is
a value, not a ceiling. Do not split this ticket for the skill/ceiling rule.
A. The sign-in helper
A new script under workflow/lib/ — propose preview-auth.mjs — that turns a preview host, the
repo's previewUrl block and the loop's preview-only service token into the requests a session
then sends, plus the one verdict parts B and C both need.
- ⚠ It must decide, not fetch.
workflow/lib/railway.mjs:16-18is the precedent and states the
reason: "It never fetches. The session sends the request with curl, so this file holds no
credential and never opens a connection." A routine cannot reach an API from a script
(workflow/lib/config.mjs:1-14, why:docs/why.md#a-routine-cannot-reach-the-github-api,
docs/why.md#a-script-here-never-fetches). Read JSON on stdin, emit the plan on stdout. - Node standard library only. No dependency (
CLAUDE.md→ "No package manager"). - stdin: the repo's
.claude/workflow.jsonpreviewUrlblock and the PR number. stdout:
the host, whether this repo seeds previews at all, the Access headers to attach by env-var
name, and the sign-in request. Mirrorrailway.mjs'stokenSetshape — say only whether each
variable is set, never its value. - It is also the one place that answers "does this repo seed previews?", so parts B and C read
one answer rather than re-deriving it. A computation re-derived on every dispatch is a chance to
derive it differently (CLAUDE.md→ "Scripts, not prose, own mechanical rules"). - The sign-in request this repo's share plans comes from #1081's
## Interfaces:
POST /api/managers/request-magic-linkwith{ "email": "<any manager in that preview>" }at the
fixed address, carrying theclaude-loopservice token'sCF-Access-Client-Id/
CF-Access-Client-Secret. The Worker supplies #1081's shared-secret header, so the loop never
holds it. Treat the route and the address shape as given by #1081 — restate neither as a fact
this repo owns. - The two token env-var names are values, so they go in
loop-config.json, beside
railway.tokenEnvVarandsentry.tokenEnvVar: a newpreviewAccessblock naming the client-id
and client-secret variables, with a one-line$commentonly if a bare value is unclear alone.
Nothing but values goes there, and no skill hard-codes a name the script can read. - ⚠
leanGate.commandin.claude/workflow.jsonis
claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs. A new
workflow/lib/<name>.mjsis therefore gated only if it ships a sibling
workflow/lib/<name>.test.mjs. Eight scripts inworkflow/lib/have no test sibling today, so
nothing else catches this. Followworkflow/lib/railway.test.mjs's shape: import the named
exports, assert against a plan built from a real recorded input. - The gate must pass from the checkout and from a
.claude/worktrees/<slug>worktree, because
implement-ticketruns it from one. A test resolvingloop-config.jsonby a path relative to the
cwd rather than to its own module URL fails only in the worktree —
railway.test.mjs:7reads it throughnew URL('../../loop-config.json', import.meta.url). - A skill invokes it as
node "${CLAUDE_PLUGIN_ROOT:-<claude-workflow>/workflow}/lib/preview-auth.mjs", the form
finalize-pr/SKILL.md:127already uses: a routine has noCLAUDE_PLUGIN_ROOTand reads the
skills from the checkout.
B. previewUrl.auth — give it a documented meaning
#1081 adds previewUrl.auth to SahajCloud's .claude/workflow.json. That file is a protected
path, so a person writes it there and it is not this ticket's to edit. This part defines what the
loop does with it.
finalize-pr/SKILL.md:37is the table of the.claude/workflow.jsonkeys that skill reads. It
listspreviewUrl.pattern/.seedtoday and must gain.auth, in one table row.- It takes effect in step 7's seed section, Every link opens on data
(finalize-pr/SKILL.md:273-293)::278says "The repo guide says how to sign in", and:280
runspreviewUrl.seed. Both now go through part A's helper when.authis set. - ⚠
previewUrl.seedis already consumed atfinalize-pr/SKILL.md:280and:291but is unset
in SahajCloud's copy — verified: that repo's.claude/workflow.jsonhaspreviewUrl.patternand
nothing else. #1081 sets.seedin the same hand-edit, so this part must not assume it is
present. - Keep the edit to the fewest words that change behaviour. The reasoning belongs in
docs/why.md
(part C's new anchor), not in the skill.
C. The text that lets a line stand in for data — made conditional, never removed
Two places let a change admit it has no data and still pass:
review-pr/SKILL.md:90— "A link that shows no data with no line in the body saying why … is a
should-fix", which accepts the line.finalize-pr/SKILL.md:290— theData: not seeded yetdisclosure;:291— theCannot seed
case; and:328, the same line on step 7b's timeout.
⚠ That text is correct for the other four repos, which have no seeding check and no gate. So the
edit is conditional, never a removal. Where the repo has a red seed check, the red check is the
gate and a line in the body no longer substitutes for it; where it does not, today's rule stands
verbatim.
- How the skill decides: it asks part A's helper, which reads the repo's own
previewUrl.seed/.auth. Their presence is the signal — a config key the script reads, not a
number or a label name typed into a skill. - ⚠
review-pr/SKILL.mdreads no.claude/workflow.jsonat all today (grep: zero hits, unlike
finalize-pr,implement-ticket,address-review,fix-ci,resolve-conflicts,start-run,
dev-server). So this is review-pr's first repo-config read. Add it as one line that calls
the helper, not a configuration table — the table would be read on every dispatch of that handler
for one key. - ⚠ A skill's length is a running cost.
finalize-prandreview-prare read on every dispatch
of their handlers, 25–40 times a day, forever
(docs/why.md#the-rules-cost-more-than-the-output). Each of these edits is a clause, not a
paragraph. - The story goes in
docs/why.mdbehind one new anchor, cited from each edit as
(why: docs/why.md#<anchor>)— the failure being prevented is feat(events): a Registrations tab for the event's own manager SahajCloud#1073, which
shipped its Registrations page with "Data: not seeded" and a console snippet, and
feat(events): bulk-import events into a region from CSV SahajCloud#874, whose three links nobody saw anything on. Put it beside
docs/why.md#a-preview-link-must-open-on-data(:352), which this extends. ⚠ Never let the story
be a rule's only statement: check the imperative still reads as an instruction with the anchor
removed (workflow/skills/AGENTS.md).
D. The two tokens, in docs/routine-setup.md
The goal gives the loop and the checks separate preview-only Access service tokens, each
switchable off alone. They live in two different places, so the doc needs a row in each.
- The checks' token (
github-ci) is an org-level GitHub secret → the table at
docs/routine-setup.md:281-290, besideSYDEVS_BOT_PATandSENTRY_CLAUDE_WORKFLOW_TOKEN. One
row naming the client-id/client-secret pair, what reads it (SahajCloud CI's seed and smoke steps),
and that it reaches previews only. - The loop's token (
claude-loop) is a Claude cloud-environment variable →§4 The Claude cloud environmentat:438-452, in the.env-format block besideSENTRY_CLAUDE_WORKFLOW_TOKENand
MAILPIT_UI_AUTH, plus a short paragraph in the shape the Railway token's at:461-464already
uses (what reads it, and what the loop does without it). - Plus a sentence in the ⚠ at
:454-459. It says today "There is no secret store … Never put a
production admin credential here." It must now also say what a preview-only Access token does and
does not reach: every preview of the gated repo, as a service identity whose every use is logged,
and nothing on the live site — and that it is switchable off on its own without deleting the
other token, which is why there are two Service Auth policies rather than one on "any service
token". - ⚠ Say nothing here about
PREVIEW_ADMIN_EMAILbeing a stopgap. Reviewers open every content-system preview with test data, as any role, behind a sydevs login SahajCloud#1078's Notes
call adding it to the loop's cloud environment a stopgap a person can make today; #1081 retires
the variable. Ifdocs/routine-setup.mdhas gained a row for it by the time this is built, remove
that row in the same commit and say so.
E. Bump the plugin version
⚠ version in workflow/.claude-plugin/plugin.json is 5.3.0 and must change, or every
/plugin install workflow@sydevs consumer keeps the cached old skills however far main has moved:
installed_plugins.json records a gitCommitSha and never revisits it, and the cache directory is
named after version (CLAUDE.md, why: docs/why.md#an-installed-plugin-does-not-track-main). A
skill change without a bump is the one failure this repo has already paid eight days for.
.claude-plugin/marketplace.json, one level above workflow/, must stay valid alongside
plugin.json or an install fails — claude plugin validate ./workflow --strict is the gate's first
half.
F. One joined docs correction — docs/why.md:364-365
That passage reads: "the seed uses synthetic or anonymised people: the 874 seed replaced 495
coordinator identities with atlas-manager-<id>@preview.invalid." No code does this. It was a
hand seed on one preview, and the passage now states the opposite of the parent goal's whole
premise — that the content system has nothing safe to fill a preview with.
Verified in sydevs/SahajCloud:
grep -rn 'preview\.invalid'over the checkout returns zero hits. Nothing writes that
address.- The real-data files have since left the checkout entirely:
.gitignore:86-87excludes
/seeds/atlas/data/and/seeds/atlas/local/(since feat(atlas): repeatable re-sync pipeline, with the data kept out of git SahajCloud#1079), so no CI run holds
a real name and theatlasscript cannot run there at all.
Correct it to say the anonymisation was done by hand, once, and that the hand-authored fixture
#1081 adds is what makes "made-up data" true in code — a structural property of CI, not a test.
Replace the sentence in place; never append a correction (format-ticket, on notes).
This joins the same PR by the join rule: same repo, same subject, one reviewer, one sitting.
Interfaces
Consumes from sydevs/SahajCloud#1081 — which is this ticket's blocker, because the helper has
nothing to sign in to and the conditional text has no red check to be conditional on until it
merges:
- The fixed address shape,
https://pr-<n>.cloud-preview.sydevelopers.com, live from a PR's
first push. It reaches this repo only as SahajCloud's ownpreviewUrl.pattern, hand-written into
that protected path by a person — nothing here hard-codes it. - The sign-in route a service token calls:
POST /api/managers/request-magic-linkwith
{ "email": "<any manager in that preview>" }, answering{ ok: true, token }plus the session
cookie, reached at the fixed address with theclaude-loopAccess service-token headers. The
Worker supplies the shared-secret header, so the loop does not hold it. - The account list: the picker rendered at
/admin/loginon a preview, which is how the loop
learns which addresses exist. - The red check: the seed step lives inside SahajCloud's existing
Lint, Test & Smokecheck, so
no new check name appears, and part C's conditional text has something to be conditional on.
Provides back: nothing. #1081 consumes nothing from this repo.
Acceptance criteria
A — the helper
- A new
workflow/lib/<name>.mjsexists, reads JSON on stdin and writes its plan to stdout, and
contains no network call, nofetch, nocurland no credential value. - It imports only from
node:*— no dependency is added anywhere in the repo. - Its output reports each Access token variable only as set or unset, never its value.
- Its output includes the preview host, the sign-in request to send, the Access header names to
attach, and a boolean saying whether this repo seeds previews. - Given a
previewUrlblock with noauthand noseed, it reports that this repo does not
seed previews and plans no sign-in request. - A sibling
workflow/lib/<name>.test.mjsexists and imports the script's named exports, so
node --test workflow/lib/*.test.mjscovers it. -
claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjspasses
from the repo checkout and from a.claude/worktrees/<slug>worktree. - The two Access token env-var names appear in
loop-config.jsonand in noSKILL.md. -
loop-config.json→ceilingsis byte-identical toorigin/main.
B — previewUrl.auth
-
finalize-pr/SKILL.md's configuration table listspreviewUrl.authwith the step that reads
it. - Step 7's Every link opens on data says how a session signs in and seeds when
.authis set,
and behaves as it does today when it is not. - No step assumes
previewUrl.seedis set;Cannot seedstill covers an unset.seed. - Nothing in this repo contains the literal
pr-<n>.cloud-preview.sydevelopers.comor any other
SahajCloud preview host.
C — the conditional text
-
review-pr/SKILL.md's "shows no data" rule accepts a body line only where the repo has no red
seed check, and treats the missing data as a finding where it has one. -
finalize-pr/SKILL.md'sData: not seeded yet,Cannot seedand step 7b timeout lines each
still state today's behaviour for a repo with no seed check. - No line of either skill is deleted outright:
node workflow/lib/rule-delta.mjs --base origin/main workflow/skillsreports no dropped rule, or the PR body accounts for each
removal by name. - Each edit decides from the helper's verdict, and neither skill names a number, a label or a
repo. - One new
docs/why.mdanchor holds the story, cited from both skills; neither skill carries
the narrative, and each edit still reads as an imperative with the citation removed.
D — the tokens
-
docs/routine-setup.md's org secrets table has a row for thegithub-ciAccess token pair. -
§4's environment-variable block names theclaude-loopAccess token pair, with a paragraph
saying what reads it and what the loop does without it. - The ⚠ at
§4's "There is no secret store" says what a preview-only Access token reaches,
that it reaches nothing on the live site, and that it can be switched off without deleting the
other. -
docs/routine-setup.mdnames noPREVIEW_ADMIN_EMAILstopgap.
E — the version
-
versioninworkflow/.claude-plugin/plugin.jsonis higher than5.3.0. -
claude plugin validate ./workflow --strictpasses, and.claude-plugin/marketplace.json
still parses and still points at./workflow.
F — the correction
-
docs/why.mdno longer claims any seed code replaced coordinator identities with
preview.invalidaddresses;grep -rn 'preview\.invalid' docs/returns nothing, or only the
corrected sentence naming it as a one-off hand seed. - The corrected passage says the anonymisation was done by hand once, and that
feat(auth): gate and seed previews behind Cloudflare Access SahajCloud#1081's committed fixture is what makes made-up preview data true in code. - The passage is replaced in place; no "correction" or "update" section is appended.
The PR itself
- The PR is open and not merged by the loop, whatever the gate says.
- The PR body states, per change, the failure that change prevents.
- One commit per behaviour, each named in the PR body.
Verification checklist
-
.claude/skills/pr-prep/check.sh— if this repo has no such script, run
.claude/workflow.json'sleanGate.commandinstead:
claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs. -
node --test workflow/lib/*.test.mjs— all tests pass, and the run names the new
workflow/lib/<name>.test.mjsfile. -
git worktree add .claude/worktrees/verify && cd .claude/worktrees/verify && claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs— both halves pass from
the worktree. Remove the worktree afterwards. -
node workflow/lib/rule-delta.mjs --base origin/main workflow/skills— read the directive and
rule counts, and write into the PR body what each removal was. A rewrite can pass
ste-lint.pywhile dropping a rule outright. -
python3 workflow/lib/ste-lint.py workflow/skills/finalize-pr/SKILL.md workflow/skills/review-pr/SKILL.md— the two edited skills. -
echo '{"previewUrl":{"pattern":"https://example-pr-{pr}.invalid"},"pr":7}' | node workflow/lib/<name>.mjs— exits 0 and reports that this repo does not seed previews. -
echo '{"previewUrl":{"pattern":"https://example-pr-{pr}.invalid","seed":"…","auth":{…}},"pr":7}' | node workflow/lib/<name>.mjs— exits 0, prints the host with{pr}filled, the sign-in
request, and each token variable reported only as set or unset. -
grep -rn 'fetch(\|https\?://' workflow/lib/<name>.mjs— no outbound call; any URL present is
in the emitted plan or a comment, never a request the script makes. -
grep -rn "^import\|require(" workflow/lib/<name>.mjs— every import isnode:*. -
git diff origin/main -- loop-config.json— the diff touches only the newpreviewAccess
block, and no line underceilings. -
node -e "JSON.parse(require('fs').readFileSync('.claude-plugin/marketplace.json')); JSON.parse(require('fs').readFileSync('workflow/.claude-plugin/plugin.json'))"— both parse,
andversionreads higher than5.3.0. -
grep -rn 'preview\.invalid' .(excludingnode_modulesand.git) — only the corrected
sentence, if any. -
grep -rn 'cloud-preview.sydevelopers.com\|sahajcloud-sahajcloud-pr' workflow/ docs/ loop-config.json— returns nothing. -
grep -rn 'PREVIEW_ADMIN_EMAIL' docs/ workflow/— returns nothing. -
gh pr view <n> --json isDraft,state— the PR exists and is unmerged. Do not merge it.
Notes
- Why this ticket exists at all, in a ticketless repo.
prAllowlistGlobsis**here and the
PR body is normally the proposal, so nothing in this repo needs a ticket. This child exists for
two reasons a PR body cannot carry: the merge ordering across repos — feat(auth): gate and seed previews behind Cloudflare Access SahajCloud#1081
merges first, and theBlocked by:line above is what records it — and because the parent goal's
@sydevs-bot implementis what approves this work. A roadmap goal spanning repos gets one
child per repo (format-ticket, One ticket per repo), and this is the second of two. - Between children of one goal, the
Blocked by:line orders the merge, not the build. The set
is built together (why:docs/why.md#a-cross-repo-set-is-built-together), so this may be built
beside feat(auth): gate and seed previews behind Cloudflare Access SahajCloud#1081 — only the merge waits. - A protected path blocks nothing here. The four
.claude/workflow.jsonedits this work depends
on land in SahajCloud's copy and are a person's, listed in feat(auth): gate and seed previews behind Cloudflare Access SahajCloud#1081's Notes.
Nothing in this ticket writes under any.claude/directory, so no part of it should be handed
back for the Protected Paths guard. ⚠.claude/worktreesis exempt from that guard, so the
worktree check above is an ordinary write and--no-worktreeis not a workaround for it. securityReview.triggerPatterncovers this change: it matches^workflow/lib/,
^workflow/skills/.+\.md$and^loop-config\.json$, so the security review runs. That is
expected, not a fault — a skill body is an instruction to an agent holding write access to five
repos.- This repo has no CI (
loop-config.json→ci.noCi), so a PR here is green at once and review is
its only gate.claude plugin validatechecks the manifest and skill frontmatter, never whether
the prose is right. - Preview checks build on GitHub Actions SahajCloud#903 owns the written page saying which Cloudflare key is which, and the words a
check uses to say why there is no preview. Do not restate either here. - Related: feat(events): a Registrations tab for the event's own manager SahajCloud#1073, whose preview shipped with "Data: not seeded" and a console
snippet, and feat(events): bulk-import events into a region from CSV SahajCloud#874, whose three links showed nothing. Those are the failures part
C's conditional and part F's correction are both about.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Nov 5, 2026
🤖 no session running
approved by Ardnived
Written by the sydevs dispatcher. Sessions never edit this comment.
feat(preview): give the loop a way through a gated PR preview (#242)