Skip to content

feat(atlas): repeatable re-sync pipeline, with the data kept out of git - #1079

Merged
Ardnived merged 8 commits into
mainfrom
feat/atlas-resync-pipeline
Nov 5, 2026
Merged

Ardnived merged 8 commits into
mainfrom
feat/atlas-resync-pipeline

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Why

The Atlas seed data was a one-off extraction. Its grooming (≈490 hand-edited listings) lived only in a committed events.json, so a refresh meant redoing the curation by hand. The committed files also carried registrant and manager personal data (names, emails, phones) into this public repository. We need to resync production with the legacy Atlas now, and once more before launch.

What

  • pnpm atlas:sync (seeds/atlas/sync/), a local pipeline that runs the same way every time:
    • fetch captures a Heroku backup of sahajatlas, restores it to a scratch Postgres, and extracts it.
    • build lays the grooming overlay and the merge decisions over the raw data and writes the importer's input, a delta report and a grooming worksheet.
    • groom applies a mechanical clean plus a hand-written patch.
    • check enforces the grooming and write-contract invariants (the old data specs).
    • record turns the groomed data into the next overlay.
    • A curated value is re-applied only while its source fields are unchanged upstream, so a refresh re-grooms only what moved. Rebuilding reproduces the groomed data byte for byte.
  • seeds/atlas/data/ is gitignored and removed from the tree. The CLI already uploads it as inlineData. ⚠ The files remain in git history.
  • Floors come from the data. A new from-data expectation reads floors from the uploaded manifest.json, derived by sync/counts.ts. A run that uploads no manifest fails verification instead of passing silently. Merge decisions move to sync/merges.ts and apply locally, so a new merge needs no deploy.
  • pnpm seed atlas-reset empties events (and versions), regions, users and user-submissions in one transaction below the Local API. It never truncates, and it refuses to run if a RESTRICT foreign key appears. clients.region goes null until atlas --update re-links it.
  • atlas --update prunes managers Atlas deleted. It keeps, with a warning, any admin, any holder of a non-Atlas role, and anyone a non-Atlas client or form names.
  • Timestamp bug fixed: extract.ts now reads timestamp without time zone as UTC and date as a date. Every extracted timestamp had been shifted by the operator's UTC offset, and the same dump extracted in two zones disagreed. Tokyo and Vancouver extractions are now identical.

Checked locally

  • The pipeline reproduces the committed 2026-08 data exactly from backup b007, and the floors it derives (495/646/1864/649/2004/31) match the old constants.
  • The 2026-11 backup b008: 30 new events, 35 edited upstream, 8 deleted, 35 new venues, 11 new cities and 21 new managers. All were groomed under the feat(atlas): groom legacy event listings and group shared venues before import #605 rules, and check passes.
  • pnpm test:unit (235 files), lint, format, typecheck and typecheck:tests all pass.

Rehearsal

Rehearsal on this PR's Railway preview: seed the 2026-08 data, then atlas-reset and atlas --update with the 2026-11 data. Results will follow in a comment.

🤖 Generated with Claude Code

The Atlas seed data was a one-off extraction whose grooming lived only in a
committed events.json, so refreshing it meant redoing the curation by hand —
and the files carried registrant and manager personal data into this public
repository. This makes the refresh a repeatable, local pipeline.

- `pnpm atlas:sync` (seeds/atlas/sync/): fetch captures a Heroku backup of the
  legacy Atlas, restores and extracts it; build lays a grooming overlay and the
  merge decisions over it and writes the importer's input, a delta report and a
  grooming worksheet; groom applies a mechanical clean plus a hand-written
  patch; check enforces the grooming and write-contract invariants; record
  turns the groomed data into the next overlay. A rebuild reproduces the
  groomed data byte for byte.
- seeds/atlas/data/ is gitignored and removed from the tree; the CLI already
  uploads it as inlineData. Its data specs move into `check`.
- Verification floors are derived from the data on every build and ride in
  the uploaded manifest (`from-data` floors), so no refresh leaves a stale
  constant. Merge decisions move to sync/merges.ts and apply locally, so a new
  one needs no deploy.
- `pnpm seed atlas-reset` empties events, regions, users and user-submissions
  in one transaction below the Local API, refusing if a RESTRICT key appears;
  `--update` now prunes managers Atlas deleted, keeping any SahajCloud gave
  something to.
- extract.ts reads Atlas's `timestamp without time zone` columns as UTC and
  dates as dates: every timestamp was shifted by the operator's UTC offset,
  and the same dump extracted in two zones disagreed.

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

railway-app Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

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

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

…region

Deleting regions nulls every client's region, and the import re-links only the
clients Atlas created, so a SahajCloud-made client would lose its region.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 16:23 Destroyed
The preview rehearsal's clean import fell 16 events short of its floor.

- Atlas stores a single session or a concert as `type: daily` with no end, so
  the importer listed every past concert as repeating daily forever.
  `isAtlasOneOff` maps it to a schedule that does not repeat.
- `refuseDuplicateClass` (#912) shipped after production was seeded and
  refused every pair the grooming passes left unmerged on purpose (two
  managers, one slot), plus the concerts above. The seed now skips it through
  `context.skipDuplicateClassCheck`: Atlas's duplicates are decided by evidence
  in sync/merges.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 17:11 Destroyed
`refuseDuplicateClass` ran on every update, so a class that already had a twin
could never be saved again — a manager's edit, or the bookkeeping write a
registration triggers, which took the registration down with it. The rehearsal
lost 10 registrations to it, and production holds such pairs today. An update
is now checked only when its region or class key moves.

The atlas importer also skips, by name, an inactive listing with neither a
phone nor an email, which Events refuses (#335's only contact is a Meetup
page), and the events floor mirrors it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 17:40 Destroyed
Storage renames an upload, so MediaUploader's filename match never found the
earlier copy, and every run uploaded all 130 Atlas pictures again — a re-sync
keeps images through atlas-reset, so each one would have doubled them. Match
on the picture-<legacyId>- stem the renaming keeps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 17:42 Destroyed
Its own hand-kept list had drifted from the CLI's. Derive it from
EXPECTED_COUNTS, which the type system makes complete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 17:46 Destroyed
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 4, 2026 17:52 Destroyed
@Ardnived

Ardnived commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Preview rehearsal: passed

I ran the rehearsal on this PR's Railway preview.

  1. Seeded the committed 2026-08 set, standing in for production today.
  2. Issued an API key to one Atlas client, standing in for the WordPress sites.
  3. Added a client that does not come from Atlas, pointing at a region.
  4. Added one manager whose record Atlas has since deleted.
  5. Ran atlas-reset and then atlas --update with the groomed 2026-11 data.
Result
Floors (from manifest.json) All met exactly: events 670, regions 661, users 2178, registrations 2325, clients 31 (+1 non-Atlas), managers 516 (+admin)
Errors Only the two permanently unimportable rows: #4958 (no Atlas area) and region:East
atlas-reset Refused while the non-Atlas client pointed at a region, and named it. After that region was cleared, it emptied 5 tables in one transaction. No client or manager was touched.
Clients All ids, API keys (keyGeneratedAt), clientId, roles, managers and status are unchanged. The issued key still authenticates. All 23 Atlas regions were re-linked. The non-Atlas client is untouched.
Managers The manager deleted in Atlas was pruned. 21 new managers were added.
One-offs Concerts and single sessions no longer repeat. Each finishes on its own date.
Pictures No re-uploads: the image count was the same before and after.

The rehearsal surfaced the four fixes below. All are committed on this branch.

  • One-off events. One-off events had been imported as open-ended DAILY repeats. On production today, every past concert lists itself as upcoming every day.
  • Duplicate-class guard on update. refuseDuplicateClass ran on every update. On production today, it refuses saves and registrations on either half of a deliberately unmerged pair. It now checks only when the class's identity changes, and the seed skips it.
  • Event pictures. Event pictures were re-uploaded on every run, because storage renames uploads.
  • Seed route script list. The seed route kept a separate, drifted list of valid scripts. It now derives the list from EXPECTED_COUNTS.

Payload skips validation only for a call passing `draft`, and `upsert` never
passed it — so `_status: 'draft'` alone was refused like a publish, and the
atlas importer's "re-import as a draft for an admin to fix" fallback could
never land a row that failed validation. `upsert` now takes `draft`.

The atlas importer uses it to park an inactive listing with neither a phone
nor an email (Events refuses to publish one) as a draft, rather than skipping
it, so a manager can complete it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1079 November 5, 2026 00:52 Destroyed
@Ardnived
Ardnived marked this pull request as ready for review November 5, 2026 01:17
@Ardnived
Ardnived enabled auto-merge November 5, 2026 01:17
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot

sydevs-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 16:05Z review-pr · attempt 3 · session · done
  • 16:05Z review-pr · attempt 3 · session
  • 07:51Z review-pr · attempt 2 · session · timed out
  • 07:51Z review-pr · attempt 2 · session
  • 01:18Z review-pr · attempt 1 · session · timed out

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

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 5, 2026
@Ardnived
Ardnived disabled auto-merge November 5, 2026 04:35
@Ardnived
Ardnived merged commit 30b4c75 into main Nov 5, 2026
15 checks passed
@Ardnived
Ardnived deleted the feat/atlas-resync-pipeline branch November 5, 2026 04:35
@sydevs-bot sydevs-bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 5, 2026
Ardnived added a commit that referenced this pull request Nov 5, 2026
…it (#1079)

* feat(atlas): repeatable re-sync pipeline, with the data kept out of git

The Atlas seed data was a one-off extraction whose grooming lived only in a
committed events.json, so refreshing it meant redoing the curation by hand —
and the files carried registrant and manager personal data into this public
repository. This makes the refresh a repeatable, local pipeline.

- `pnpm atlas:sync` (seeds/atlas/sync/): fetch captures a Heroku backup of the
  legacy Atlas, restores and extracts it; build lays a grooming overlay and the
  merge decisions over it and writes the importer's input, a delta report and a
  grooming worksheet; groom applies a mechanical clean plus a hand-written
  patch; check enforces the grooming and write-contract invariants; record
  turns the groomed data into the next overlay. A rebuild reproduces the
  groomed data byte for byte.
- seeds/atlas/data/ is gitignored and removed from the tree; the CLI already
  uploads it as inlineData. Its data specs move into `check`.
- Verification floors are derived from the data on every build and ride in
  the uploaded manifest (`from-data` floors), so no refresh leaves a stale
  constant. Merge decisions move to sync/merges.ts and apply locally, so a new
  one needs no deploy.
- `pnpm seed atlas-reset` empties events, regions, users and user-submissions
  in one transaction below the Local API, refusing if a RESTRICT key appears;
  `--update` now prunes managers Atlas deleted, keeping any SahajCloud gave
  something to.
- extract.ts reads Atlas's `timestamp without time zone` columns as UTC and
  dates as dates: every timestamp was shifted by the operator's UTC offset,
  and the same dump extracted in two zones disagreed.

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

* fix(atlas): atlas-reset refuses while a non-Atlas client points at a region

Deleting regions nulls every client's region, and the import re-links only the
clients Atlas created, so a SahajCloud-made client would lose its region.

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

* fix(atlas): import one-offs as one-offs, and keep Atlas's unmerged pairs

The preview rehearsal's clean import fell 16 events short of its floor.

- Atlas stores a single session or a concert as `type: daily` with no end, so
  the importer listed every past concert as repeating daily forever.
  `isAtlasOneOff` maps it to a schedule that does not repeat.
- `refuseDuplicateClass` (#912) shipped after production was seeded and
  refused every pair the grooming passes left unmerged on purpose (two
  managers, one slot), plus the concerts above. The seed now skips it through
  `context.skipDuplicateClassCheck`: Atlas's duplicates are decided by evidence
  in sync/merges.ts.

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

* fix(events): check a class for repeats only when its identity changes

`refuseDuplicateClass` ran on every update, so a class that already had a twin
could never be saved again — a manager's edit, or the bookkeeping write a
registration triggers, which took the registration down with it. The rehearsal
lost 10 registrations to it, and production holds such pairs today. An update
is now checked only when its region or class key moves.

The atlas importer also skips, by name, an inactive listing with neither a
phone nor an email, which Events refuses (#335's only contact is a Meetup
page), and the events floor mirrors it.

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

* fix(atlas): reuse an earlier upload of each event picture

Storage renames an upload, so MediaUploader's filename match never found the
earlier copy, and every run uploaded all 130 Atlas pictures again — a re-sync
keeps images through atlas-reset, so each one would have doubled them. Match
on the picture-<legacyId>- stem the renaming keeps.

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

* fix(seed): the seed route accepts every script, atlas-reset included

Its own hand-kept list had drifted from the CLI's. Derive it from
EXPECTED_COUNTS, which the type system makes complete.

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

* fix(atlas): atlas-reset shows the operator what it counted and deleted

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

* fix(seed): a draft upsert is a draft save, so parked rows import

Payload skips validation only for a call passing `draft`, and `upsert` never
passed it — so `_status: 'draft'` alone was refused like a publish, and the
atlas importer's "re-import as a draft for an admin to fix" fallback could
never land a row that failed validation. `upsert` now takes `draft`.

The atlas importer uses it to park an inactive listing with neither a phone
nor an email (Events refuses to publish one) as a draft, rather than skipping
it, so a manager can complete it.

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

---------

Co-authored-by: Devindra <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@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 5, 2026
Ardnived pushed a commit to sydevs/claude-workflow that referenced this pull request Nov 7, 2026
* feat(lib): decide how a session reaches a gated PR preview

`workflow/lib/preview-auth.mjs` turns a repo's own `previewUrl` block and a PR
number into the host, the sign-in request to send, the Access headers to attach
by env-var name, and one verdict both `finalize-pr` and `review-pr` read:
whether this repo seeds previews at all.

It decides and never fetches, like `railway.mjs` beside it — a routine cannot
reach an API from a script, so the session sends the request and this file holds
no credential. Each token variable is reported only as set or unset, and the
headers are shell references, so a plan can be logged.

The two token env-var names go in `loop-config.json` as `previewAccess`, beside
`railway.tokenEnvVar`: a name typed into a skill is a tuning change nobody can
review on its own. `ceilings` is untouched.

The route and the account are the producing repo's, carried in its `.auth`
block, so nothing here knows either and nothing here goes stale when they
change. The test fixture deliberately uses a `.invalid` host for the same
reason: a copy of another repo's config value is a second definition, in a
fixture as much as in a skill.

The failure this prevents: `review-pr` reads no repo config today, so without one
answer in one place each skill would re-derive "does this repo seed previews" on
every dispatch — 25 to 40 times a day — and the two are then free to disagree.

Refs #241

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

* feat(finalize-pr): give previewUrl.auth a meaning

Step 7's *Every link opens on data* now asks the helper first, and signs in with
what it answers where a repo declares `previewUrl.auth`. The configuration table
gains the key beside `.pattern` and `.seed`.

The example Preview block stops naming a real host. The pair it used names
SahajCloud's Railway address, which sydevs/SahajCloud#1081 shuts — so the
example would have told the next reader to write a link that 403s, and a host
spelled in this skill is a copy of a config value either way.

The failure this prevents: a run that holds a preview-only Access token still
had nowhere to read the route, the account or the header names from, so it
would have written `Data: not seeded yet` beside a preview it could have filled.

⚠ No step assumes `previewUrl.seed` is set. SahajCloud's copy carries only
`.pattern` today, and the same hand-edit that adds `.auth` adds `.seed`; the
`Cannot seed` case still covers an unset one.

Refs #241

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

* fix(review-pr): a red seed check outranks a line in the body

Two places let a change admit it has no data and pass anyway. Where a repo's own
CI goes red on a preview that exists and could not be filled, the red check is
the gate and a sentence cannot stand in for it.

⚠ **Conditional, never a removal.** That text is correct for the other four
repos, which have no seeding check and no gate — there the line is still the only
honest thing to write. Each edit decides from the helper's verdict, so neither
skill names a number, a label or a repo. `rule-delta.mjs` reports no dropped
rule.

The failure this prevents is the one the written rule has already accepted twice:
sydevs/SahajCloud#1073 shipped its Registrations page with `Data: not seeded` and
a console snippet to paste, and sydevs/SahajCloud#874 linked three pages nobody
saw anything on — filling that one by hand afterwards found three defects in a
minute.

The story goes behind one new `docs/why.md` anchor, beside the rule it extends.
Each edit still reads as an instruction with the citation removed.

Refs #241

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

* docs(routine-setup): write down both preview Access tokens

They live in two different places, so the doc needs a row in each: the
`github-ci` pair as an org-level GitHub secret, read by SahajCloud CI's seed and
smoke steps, and the `claude-loop` pair as a Claude cloud-environment variable,
read only by `workflow/lib/preview-auth.mjs`.

The ⚠ on "There is no secret store" now says what a preview-only Access token
reaches — every preview of the gated repo, as a service identity whose every use
Cloudflare logs — and what it does not: anything on the live site, whose address
it cannot change.

The failure this prevents is a person setting up the loop with one Service Auth
policy on "any service token", which reads like the simpler choice and makes
switching one token off a deletion of both. Two named policies are what let the
loop's be switched off while CI keeps running, and the other way round.

Nothing here names a stopgap variable: sydevs/SahajCloud#1081 retires it, and
this doc never carried a row for it.

Refs #241

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

* chore(plugin): 5.3.0 → 5.4.0

Every skill change in this PR reaches a cloud routine on its next run, and an
installed plugin on no run at all until this string moves:
`installed_plugins.json` records a `gitCommitSha` and never revisits it, and the
cache directory is named after `version`. A skill change without a bump is the
one failure this repo has already paid eight days of stale skills for.

`.claude-plugin/marketplace.json` still parses and still points at `./workflow`.

Refs #241

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

* fix(why): the 874 anonymisation was a hand seed, and no code does it

That passage read as though the seed itself replaced coordinator identities with
`preview.invalid` addresses. It did not: `grep -rn 'preview\.invalid'` over
sydevs/SahajCloud returns zero hits, and nothing writes that address. The
anonymisation was done by hand, once, on one preview.

Left as it was, the passage stated the opposite of the parent goal's whole
premise — that the content system has nothing safe to fill a preview with, since
its only data scripts import real people's names and addresses. A reader who
trusted it would have concluded the problem was already solved.

What makes made-up preview data true in code is the committed fixture
sydevs/SahajCloud#1081 adds, and that is structural rather than tested: the
real-data files left that checkout in sydevs/SahajCloud#1079, so no CI run holds
a real name to leak. It remains no promise about a preview somebody filled by
hand.

Replaced in place, not appended.

Refs #241

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

* fix(lib): refuse a plan that would leave the preview host or carry half a token

Four defects found reviewing the helper, each the kind a prose rule cannot
hold and a script can.

A sign-in route came from config and was concatenated onto the host with no
check, so `@evil.example/x` or a bare `.evil.example/x` moved the origin while
`finalize-pr` attached the Access service token to the request. The route is
joined, then the composed origin is compared against the host's; anything else
plans no sign-in. For the same reason `{pr}` now takes digits only — the slot
sits inside the hostname — and a pattern must be `https:`, since `http:` would
put the pair on the wire in cleartext and `file:` would read the disk.

`headers` was built from the variable NAMES, so an environment holding no
token still handed the session two headers that expand to empty. Cloudflare
logs a blank client id as a failed service-token attempt, and the run reads two
headers as a working credential. Both halves must now be set. SahajCloud's
`accessTokenHeaders` already answered this question the same way; two answers
were one too many. The pair also rides only with a gated request now: a repo
declaring no `.auth` has no Access in front of it, and a preview host a repo
has since moved is a name anyone may claim.

`seedsPreviews` was true for any truthy `auth`, `{}` included. That verdict
tells `review-pr` to raise a `should-fix` on every empty preview in a repo
where no run can sign in or seed — a finding no author can comply with. It now
reads a usable plan.

`accountsPage` is gone. The seed route accepts only an admin manager, so a run
that picked another account from that page could not then seed, and the field
widened what the credential was used for while adding nothing.

The suite caught none of this: 7 of 7 mutations survived it, the
"opens no connection" assertion grepped for `fetch(` alone and passed a module
importing `node:https`, and neither field-name override was exercised. It now
asserts the import list against an allowlist, and 11 mutations were watched
failing against it.

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

* fix(skills): make the new preview rules executable, and drop three false claims

Review found the skill half stated things that are not true and asked for
things a run cannot do.

False, and a false sentence in a skill is in the next run's context: the
example's hosts did not "become unreachable the day #1081 shut Railway's
address" — that ticket is open, and the raw host redirects rather than going
dark. The reason the hosts are gone is timeless, so it is stated that way.
`finalize-pr` promised that a repo's seed check "will red this PR", but
SahajCloud's step reds only where a preview was discovered; with none, CI
warns. `why.md` claimed in the present tense a fixture that an unmerged PR
commits, and named the ticket rather than the PR.

Not executable: `review-pr` was told to call the helper but never where its
input lives — `previewUrl` is not in `loop-config.json`, which is the only
config that skill opens — nor that the path needs the `CLAUDE_PLUGIN_ROOT`
convention, which is why 52 sessions once lost a call each. It also never got
the Access headers, so on a gated repo every preview link answers with the
login screen and reads as empty: the critic would have filed its own missing
credential as a finding. And the new absolute collided with the carve-out two
lines above it, leaving a mid-build 404 ambiguous.

`finalize-pr` asked for a JSON subobject hand-spliced into a single-quoted
shell string while the file was right there, and named no check on the token
before sending. Both are `jq` and one clause. Hard rules still carried the
unconditional form of the rule this PR makes conditional, which is the section
a run under pressure re-reads, and step 7b restated the bullet instead of
pointing at it.

Two rules added rather than corrected. The token must never be printed —
`fix-ci` already says so for the analogous case, and the values reach the
shell even though the script never holds them. And data a preview already held
must never be quoted into a public body: somebody may have filled it by hand
from a real source. `rule-delta` reports that second one as a removal because
it absorbed the shorter "never seed real people's contact details", which it
contains.

The docs now carry the Access application steps, because a service token is
account-scoped and the promise that it "opens nothing on the live site" is kept
by a policy nobody was told to create — with a verification `curl` against the
live hostname expecting 403. The `CF_ACCESS_*` row moves to a repo secret:
`--visibility all` would hand one repo's previews to every workflow in five.
And both docs now say the feature is inert until a repo declares
`previewUrl.auth`, naming its keys, which nothing told the person who must
write that block.

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

* fix(review-pr): key the unreachable preview on a signIn, not empty headers

`headers: []` has two causes and the text read only one. `authPlan` empties
it whenever `signIn` is null, so every repo with no `previewUrl.auth` — all
four product repos today — matched the sentence, and so did a repo carrying
`seed` alone. The branch's own test at `workflow/lib/preview-auth.test.mjs:141`
is that case: `seedsPreviews: true`, `signIn: null`, `headers: []`.

Read as written, the rule recorded such a preview unreachable and raised
nothing, cancelling the `should-fix` the next sentence demands. The condition
is now a `signIn` present with either `access` half unset, which is the only
shape that means this environment cannot pass a gate, and empty `headers`
with no `signIn` is named as no gate rather than a missing token.

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

* fix(finalize-pr): pin the unreachable preview to a signIn and name the field

Same misreading as review-pr:98, and unscoped here. `authPlan` returns
`headers: []` whenever `signIn` is null, so all four repos carrying no
`previewUrl.auth` matched this sentence on every preview. Read as written,
step 7 stopped checking data and wrote "unreachable" instead — the exact
failure the step exists to prevent.

The sentence now requires a `signIn`, and names the condition as
`access.clientId.set` / `.clientSecret.set` rather than leaving the run to
infer it from an empty list. Empty `headers` with no `signIn` is stated to
mean no gate, so the data check proceeds as before.

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

* fix(preview): send the Access pair only to the plan's own host

The security review found a credential leak this PR introduced, and it is the
kind a prose rule cannot hold.

`review-pr` was told to "send each link with the plan's `access.headers`",
where each link is a `## Preview` link read out of the body under review. That
body is not ours. `dispatcher/decide.mjs` fires `review-pr` with `onDemand`
on a PR no member authored as soon as a `respondTo` login types the review
verb, and the skill is told to judge a ticketless PR against its own body. So
anyone able to open a PR could name their own host in a Preview section and
collect the Cloudflare Access service token from their logs — a token that
opens every PR preview of the gated repo.

The branch had already hardened the script against leaving the host: `routeOn`
joins the sign-in route and compares the composed origin. The prose then left
by a different door, because the module validated the one URL it built while
the skill attached the same headers to URLs it never saw.

`onHost` closes it where a rule can be evaluated, and `--on-host <link>`
answers `ON_HOST` or `OFF_HOST` for one link. Both skills now send the pair to
an `ON_HOST` link only, and an `OFF_HOST` link in a body is a `should-fix` of
its own: a body pointing where the repo publishes no preview is one a reviewer
cannot check. `review-pr` also gains the `Never print the token` rule its
`finalize-pr` counterpart already carried, since it publishes a public
What-was-checked section. `railway.mjs` allowlists an outside poster's host for
the same reason.

Four mutations of the check were watched failing the suite: the `https:` guard
dropped, `endsWith` for origin equality, hostname for origin, and always
allowing. A fifth, dropping the null-host guard, is behaviour-preserving — the
try/catch already answers false.

`budget.test.mjs` asserts every verdict word a skill names is one a script can
print, so each script now exports its own list and the test reads their union.

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

---------

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

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1079 — 0cdb9c3f Deployed Nov 5, 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.

2 participants