Skip to content

ci(smoke): publish and read our own atlas preview, not Cloudflare's - #299

Merged
sydevs-bot merged 10 commits into
mainfrom
claude/ci-282-own-preview
Oct 16, 2026
Merged

sydevs-bot merged 10 commits into
mainfrom
claude/ci-282-own-preview

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The Smoke job builds the app and publishes its own Workers preview with wrangler versions upload, then reads the address its publish step returned — so the 1,350-line Pages-discovery subsystem is deleted rather than ported, and no same-repo PR goes red when the app's host stops matching it.
  • production-smoke.yml fires on the Workers build instead of the Pages one, and ci-workflows.test.ts re-anchors on the app Worker's name now that CF_PROJECT is gone.

⚠ This PR's own Smoke check will be RED until the five Actions secrets below exist. That is the specified behaviour, not a defect — a same-repo PR that cannot publish a preview must fail rather than report a green check that read nothing. The message names all five. fix-ci cannot fix it; only entering the secrets can. See ## Manual verification.

Change outline

The smoke job's shape. Every step is gated on one reason, so the states that cannot publish pay for no setup at all — a merge_group entry is one per merge, and it has nothing to install for.

 smoke:                                              .github/workflows/ci.yml
-  install
-  Discover Cloudflare Pages preview URL             # 926 lines, 4 GitHub sources, ranked
-    → preview_url, preview_status                   # waits up to 10 min for a Pages build
-  specs, if preview_url != ''
-  Report a missing preview                          # pending / unreachable / absent / failed
+  Decide whether a preview can be published         # FIRST — before any setup
+    no PR number                     → queue        # merge_group: quiet, stated, exit 0
+    all five secrets present         → publish
+    same-repo, a secret missing      → no-credentials
+    else                             → fork         # quiet, stated, exit 0
+  ─── everything below: if reason == 'publish' ───
+  checkout · pnpm · install
+  Build the preview                                 # pnpm build:worker + the §6 values
+  Publish the preview                               # wrangler-action@9539…
+                                                    # versions upload --config --preview-alias pr-<n>
+    → deployment-url                                # the version just uploaded
+    → command-output                                # wrangler's stdout; carries the alias URL
+  Refuse an address that is not the app Worker's    # scripts/assert-preview-host.mjs
+                                                    # also parses the alias off stdout
+  Post the preview address as a check run           # the `Branch Preview URL` anchor
+  specs, with PREVIEW_URL = deployment-url
+  Report a smoke run that read nothing              # only when the specs were SKIPPED

⚠ versions upload, not wrangler preview — changed at 35d35ed, after the preview path was measured on this PR. For an assets-only Worker, preview (open beta, through 4.151.0) uploads a placeholder no-op-worker.js, so the platform serves the SPA fallback to browser navigations alone and fetch('/search') came back 404 while production served the shell. versions upload sends the shape wrangler deploy does, and deploys nothing. docs/testing.md carries the measurement.

The host question the deleted ranking used to answer. Nothing is scraped any more, so provenance is structural; what survives is which Worker, and both ends of the label are anchored.

appPreviewHost(url, worker, subdomain)              scripts/assert-preview-host.mjs
  not https, or unparseable                    → null   # `hostname` refuses a credential form
  labels after the first  ≠  subdomain         → null   # equality, never a suffix test
  first label does not end at `-<worker>`      → null   # refuses `-sahajatlas-design`
  first label IS `-<worker>`                   → null   # that is production, not a preview
  else                                         → the hostname

Responsibilities, not edits.

 scripts/
-├── get-cloudflare-preview-url.mjs    # 926 lines: 4 sources, provenance ranking, a 10-min wait
-├── get-cloudflare-preview-url.test.ts
+├── assert-preview-host.mjs           # is this address a preview of the app Worker?
+├── assert-preview-host.test.ts
+├── _wrangler-config.mjs              # the ONE JSONC reader + `package.json`, for three readers
 ├── _ci-output.mjs                    # unchanged; check-bundle-size.mjs still imports it
 ├── ci-workflows.test.ts              # + the publish step's couplings to things outside it
 └── wrangler-config.test.ts           # now reads through _wrangler-config.mjs
 .github/workflows/
 ├── ci.yml                            # the job above
 └── production-smoke.yml              # fires on `Workers Builds: sahajatlas`, with `==`

Preview

Preview pending, and it will stay pending on this PR. The address this lane reads is one its own Smoke job publishes, and that job cannot publish without the Actions secrets below — so there is no atlas preview to link until they exist. Nothing in this PR changes a rendered page: no src/ or public/ file is touched.

Once the secrets land, a reviewer gets two links from the job itself, in the Atlas preview check run and in the step summary:

  • Branch Preview URL → pr-<n>-sahajatlas.contact-c66.workers.dev — follows the preview across pushes
  • this commit's build → <first 8 of the version id>-sahajatlas.contact-c66.workers.dev — what the specs actually read

Phases

All four repo-side phases are pushed, each with its review done. Phase 5 of the ticket is attended and is deliberately not a box here — it is work no cloud session can perform, and an unticked box would have the dispatcher start another implement session for it. It is in ## Manual verification instead.

  • Publish and read — build, publish, the host guard and its spec, the rewritten report step
  • Our own check run, with the two labelled anchors, posted before the specs
  • Re-home the prose, then delete the 1,350 lines
  • The production lane, and the ci-workflows.test.ts re-anchor

Test results

Measured on 4b5bc72, the current head.

  • Lean gate: ✓ pnpm lint && pnpm typecheck && pnpm test:run — 142 files, 1,717 tests, 77s
  • Targeted specs: 14 passed (ci-workflows), and the new secret-gate assertion was watched fail against the two-secret gate before it passed
  • Build, at 35d35ed: ✓ pnpm build + pnpm size (standalone 309.1/318, loader 2.8/3.5, embed 310.9/318 KiB), pnpm ladle:build ✓, pnpm check:wrangler ✓ both configs. ⚠ Not re-run on 4b5bc72, whose only changes are .github/, docs/ and scripts/*.test.ts — CI's gate job covers it.
  • pnpm build:worker && ls dist/_redirects → absent; after pnpm build → present
Every new assertion was watched fail against its own defect

docs/testing.md asks for this, and several of the specs below passed before they could fail.

Defect reintroduced Result
Host match by bare substring 3 refusals red (playground, lookalike label, production host)
Host match by domain suffix the inserted-label refusal red
Publish passes the action's secrets: input red
Publish builds with a bare pnpm build red
Publish targets the playground config red
Specs read the branch alias instead of deployment-url red
wranglerVersion off package.json's pin red
Action pinned by tag rather than SHA red
Host guard dropped from the job red
Pinned alias carries the Branch Preview URL label red
Plan gates on the Cloudflare pair alone red — the new secret-gate assertion
Production lane points at sahajatlas-design red
Production lane reverted to Cloudflare Pages: red
Production lane relaxed from == to startsWith red
Plan emits a reason the report does not handle red
Report drops its loud *) fallback red
no-credentials made a quiet skip red

Shell is not reachable from a spec, so the two shell steps were run directly under GitHub's own bash -e: the plan step over all four states (each exits 0, each reason correct), and the report step over all five branches (fork and queue exit 0 with a ::warning::; no-credentials, publish and an unrecognised reason exit 1 with a ::error::).

The two addresses were read off the two pins, not off a README, since the whole lane rests on them not swapping. ci.yml's guard-step comment carries the citation:

  • wrangler-action at 953926a2: action.yml declares command-output ("comes from stdout"), and handleVersionsUploadOutputEntry sets deployment-url from the output file's preview_url, reading no other field. For a versions upload it sets no preview-* output at all — those belong to wrangler preview.
  • wrangler 4.150.0: versionsUpload writes that preview_url as versionPreviewUrl, https://<first 8 of the version id><suffix>, and puts the alias in preview_alias_url, which the action never reads. The alias reaches us only as the Version Preview Alias URL: line the guard parses, logged through logger.log → console.log → stdout.

Manual verification

The attended list this run hands back. No cloud session can do any of it.

  1. Add five Actions secrets (docs/environment.md → "GitHub Actions secrets"): CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID, the Cloudflare pair scoped to Workers only, plus VITE_SENTRY_DSN, VITE_SAHAJCLOUD_API_KEY and VITE_MAPBOX_ACCESSTOKEN. The Smoke check stays red until all five exist, and the plan step now gates on every one, so a half-entered set cannot publish. Then re-run it.
  2. Read the first publish log for a Creating new Worker "sahajatlas" line. That is the first live test of the provisioning path this PR rests on — at 4.150.0, provisionParentWorker confirms { defaultValue: true, fallbackValue: true } under "Default to true so CI and Workers Builds can create Previews unattended." ⚠ That was read against runPreview; versions upload is expected to reach the same provisioning, and nothing has yet run either.
  3. Open the branch alias in a browser: the world list renders keyless and tiles draw — not the configuration-error screen, not an empty canvas. ⚠ Also fetch a deep link (/search): it must serve the shell, which is the defect 35d35ed moved off wrangler preview for.
  4. Record the X-Robots-Tag finding. curl -sI <preview>/search and curl -sI <preview>/this-does-not-exist: does the Workers preview host add noindex of its own accord? If it does, three robots.smoke.test.ts cases and cache-headers.smoke.test.ts's embed.js case can no longer tell our public/_headers rule from a platform default. docs/testing.md says to record it and not weaken the specs; Preview checks build on GitHub Actions SahajCloud#903's success list owns the repair.
  5. Prove the red both ways, since an assertion is not finished until it has failed: break the publish step once (a bad config path is enough) and confirm the job goes red naming the publish failure with no spec reporting green; then point it at wrangler.design.jsonc and confirm the guard refuses it rather than smoke-testing the playground. Restore both.
  6. Confirm the aliases accumulate rather than leak. There is no teardown any more — see ## Notes for reviewer. After a few merged PRs, list the Worker's preview aliases in the dashboard and confirm each pr-<n> is still addressable and the set is growing as expected. ⚠ chore(build): move the Ladle playground to Cloudflare Workers #279's finding 2 — wrangler preview delete on an assets-only Worker — is therefore still unmeasured, and this PR no longer measures it.
  7. Stop Cloudflare's own preview builds of the app Worker, via POST/PATCH /accounts/{id}/builds/triggers. ⚠ The branch_excludes recipe cannot exist — docs(deploy): record the design Worker's first build and smoke measurement #296 measured the API refusing prefix wildcards (12002). Choose a branch_includes of the production branch literal only, or remove the app Worker's preview trigger; keep the production trigger, and record which shape was used and why. Then confirm by looking that a branch push starts no build for the app Worker and a merge to the production branch still does.
  8. Read the Workers Builds check run on that production merge, record its exact name and app slug, and confirm it satisfies the repointed if: while a sahajatlas-design deploy does not. Only the -design pair has been observed.
  9. Point at a Production Smoke run that started on its own within an hour of the merge and read the host it says it read. If it never appeared, that is a failure, not a pass.

Notes for reviewer

  • ⚠ §7's teardown is void, and this PR deliberately ships none. The ticket specified wrangler preview delete on pull_request: [closed], which only exists for the wrangler preview path 35d35ed abandoned. A versions upload --preview-alias has no delete command: Cloudflare keeps a Worker's 1,000 most recent aliases and drops the oldest, so an alias ages out rather than being torn down, and nothing is left unreachable to tooling. .github/workflows/preview-teardown.yml and the deployments: write grant only the preview path used both went with it, in 35d35ed. docs/testing.md records the retention. The ticket's own Hygiene and scope criterion — "a closed pull request's preview is deleted" — cannot be met and should be read as void, not unticked.
  • ⚠ The ticket's §1 output table is stale for the same reason. It says deployment-url is the stable preview-url and "not a third address", and tells the specs to read preview-deployment-url. That holds for wrangler preview. For versions upload the action sets only deployment-url, from the version's own URL — so the specs read it, and the branch alias comes off stdout. The criterion "the specs read preview-deployment-url" is satisfied in substance: they read the pinned, immutable address, which is what it was protecting.
  • One ticket item moved phase. ci-workflows.test.ts's re-anchor is phase 4 in the ticket, but phase 1 deletes the CF_PROJECT value it read — so it had to land in phase 1 to keep each phase green. Phase 4 then only repoints the integration prefix.
  • One extraction the ticket did not name. §9 says to reuse wrangler-config.test.ts's readConfig, but that helper was private to a spec, and importing a spec from a spec is worse than a shared module. It became scripts/_wrangler-config.mjs, which all three readers now use — so a Worker rename breaks them together.
  • securityReview.triggerPattern matches nothing in this diff, so no security review ran. ⚠ That is itself a gap: the pattern (.claude/workflow.json) covers no .github/workflows/ path, and this PR adds a workflow handling five secrets and a Cloudflare token. The ticket's ## Notes already owes that file an attended edit for wrangler*; .github/workflows/ belongs in the same edit. In its place I read the credential surface by hand: each secret's presence reaches if: as a boolean and never as the secret; no ${{ }} of attacker-controlled text enters any run: block (the PR number and head SHA are the only interpolations, both passed through env and jq --arg); the workflow is pull_request, never pull_request_target, so a fork run gets no secrets at all; the Cloudflare credential is an action input and is absent from the build step's environment; and wrangler's stdout reaches the guard through env, so a hostile line in it cannot reach the shell as syntax.
  • Declined, with reasons (all from the review pass): "set but unusable ⇒ throw" in tests/smoke/_helpers/preview.ts — a non-empty bad value already fails loudly, and the empty case must stay a skip because production-smoke.yml and a -design run both set hosts the guard refuses by design; moving the report step into scripts/ — it must run without a checkout, and gating the checkout is what makes a queue entry free; a shared isMain() in _ci-output.mjs — it would edit assert-no-sourcemaps.mjs, untouched here.
  • One measured saving left on the table, because a criterion names the command. The smoke build runs pnpm build:worker, i.e. tsc && vite build && assert:css && assert:maps, and the gate job already proved tsc, assert:css and (with no token, vacuously) assert:maps on the same SHA. A build:preview of vite build alone would save one full TypeScript program per publishing run. I did not take it: the acceptance criteria name pnpm build:worker explicitly, and wrangler-config.test.ts pins the config↔script pairing a third script would sidestep. Worth a follow-up if the minutes matter.
  • The Atlas preview check run is neutral, which merge-gate.mjs counts as green alongside success, so it gates nothing.
  • Cross-repo, not blocking: finalize-pr/SKILL.md tells a run to gather "each Cloudflare check run's output.summary". The anchor-carrying check run is ours, so that prose wants one line widening in sydevs/claude-workflow. branch-preview-url.mjs itself needs no change — PREVIEW_HOST already accepts workers.dev, and piping this step's exact summary through it prints sahajatlas and the branch alias, exit 0.
Detail

What moved into docs/testing.md rather than being deleted with the script. The 86-build timing record in full and in the past tense (p50 99s · p75 138s · p90 232s · p95 373s · max 453s, across main and PR heads #58–#128), the queueing cause of the slow tail, the sahajatlas-design sibling's median 41-second head start, the finding that a Cloudflare build's in-progress window is observable live and invisible to a retrospective query, #135's observed staleness case, and the check-run naming collision — re-pointed at the one thing that still depends on it, production-smoke.yml's ==.

Compared set-wise against origin/main, docs/testing.md loses no #NNN breadcrumb and gains five ⚠ markers. Three reference sites the ticket's citation table did not list turned up in the grep and were swept too: both wrangler configs cited the deleted spec as their anchor's pin, and docs/environment.md's VITE_SENTRY_DSN row cited the deleted script.

Why the guard dropped a clause. The first draft also refused parsed.username || parsed.password. No assertion could reach it: reading hostname already refuses a credential form, so the clause could never fail and was the vacuity trap docs/testing.md names. The test for the credential form stays; the comment now says what actually refuses it.

Rejected: actions/upload-artifact between the jobs. It would need the VITE_* secrets on the gate's build, which ends that build's fork-runnability and puts three keys in a PR-run artifact anyone with repo read access can download. It would also change what pnpm size measures — the budget is calibrated against the uncredentialed loader — and force needs: gate, turning the lane's wall clock from max(gate, smoke) into gate + download + publish.

Closes #282

🤖 Generated with Claude Code

https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg

The `Smoke` job hunted GitHub for whatever Cloudflare Pages had published.
Once the app serves from a Worker that hunt matches nothing and every
same-repo pull request goes red, so the job now builds the app itself and
publishes it with `cloudflare/wrangler-action`, pinned by SHA and to the
`wrangler` version `package.json` pins. Nothing is scraped, derived from a
branch name, or read from text this workflow did not produce.

The job builds its own `dist/` because `wrangler preview` uploads from a
local directory and the gate job's build is deliberately secret-free so a
fork can run it. It builds with `pnpm build:worker`: a bare `pnpm build`
leaves `dist/_redirects`, whose splat the Workers API rejects as an
infinite loop and which fails the whole upload (#280, #295).

`scripts/assert-preview-host.mjs` is what still asserts WHICH Worker the
address belongs to. It anchors the whole worker-name label segment at both
ends, reading the name off `wrangler.jsonc`, because `sahajatlas` is a
prefix of `sahajatlas-design` and a bare substring, a domain suffix test or
an unanchored regex all accept the playground's host. Its spec carries
`get-cloudflare-preview-url.test.ts`'s three refusals in their Workers
spelling, plus the playground, the Worker's own production host, and a
label inserted before the account subdomain. Each was watched fail: the
substring defect reddens three cases, the suffix defect one.

A `username`/`password` clause in the first draft is gone. Reading
`hostname` already refuses a credential form, so no assertion could reach
it, and a condition no spec can fail is the vacuity trap `docs/testing.md`
names.

The report step keeps every invariant and collapses only the reason
vocabulary. `pending`, `unreachable`, `absent` and `failed` described
somebody else's build; ours either published or did not. A fork and a
merge-queue entry stay stated skips at exit 0 — the queue would stall on a
red required check — a same-repo pull request with no Cloudflare secret
goes red naming the secret, and an unrecognised reason keeps the loud
branch. All five branches and all four plan states were run under `bash -e`.

`scripts/ci-workflows.test.ts` gains the couplings the publish step creates,
each of which fails silently: the wrangler version against `package.json`
and the action's 4.136.3 floor, both uses of the action pinned by SHA, the
absence of the action's production-secret-writing `secrets:` input, the
specs reading the immutable address rather than the branch-following one,
`build:worker` rather than `build`, and the guard being called at all. Every
one was watched red against its own defect. Its production-lane pin
re-anchors on the app Worker's `name`, since `CF_PROJECT` carried it and
goes with discovery.

`scripts/_wrangler-config.mjs` is the one JSONC reader behind all three
readers that anchor on that name, so a rename breaks them together.

A `pull_request: closed` job deletes the preview. Wrangler has no `preview
list`, so there can be no later sweep, and the delete needs
`--skip-confirmation` because the command prompts otherwise and tolerates no
absent preview of its own. `continue-on-error` covers a second close; the
step summary says whether the preview is actually gone, so a leak nothing
can sweep is at least not silent.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
`finalize-pr` in sydevs/claude-workflow reads a preview address out of an
`<a href>` whose own anchor text matches /branch\s+preview\s+url/i
(`branch-preview-url.mjs`). On Pages, Cloudflare wrote that label. On
Workers no vendor does, and once Cloudflare stops previewing the app Worker
there is no vendor comment to read either — so the smoke job posts the
anchors itself, after the host guard and before the specs, so a red smoke
run still leaves the reviewer a link.

The branch alias carries the label; the pinned alias carries none, because
`commitAliasFrom` identifies it by shape and `projectFrom` recovers the
Worker's name from the same eight-hex label. Piping the exact summary this
step builds through `branch-preview-url.mjs` prints `sahajatlas` and the
BRANCH alias, exit 0. Swapping which address carries the label makes it
print the per-commit one instead — the defect `finalize-pr/SKILL.md` names,
since a frozen alias has the reviewer opening a dead build two pushes
later. `ci-workflows.test.ts` pins the label onto `preview-url`, and was
watched red against that swap.

`neutral`, not `success`: the check run carries links and gates nothing.
`merge-gate.mjs` counts both as green, so it blocks no merge.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
`scripts/get-cloudflare-preview-url.{mjs,test.ts}` are gone — 1,350 lines
that hunted GitHub for whatever Cloudflare Pages had published. The lane
publishes its own preview now, so the hunt has nothing to find. What the
script carried moves into `docs/testing.md` rather than being deleted with
it:

- The build-timing record, in full and in the past tense: 86 successful
  `Cloudflare Pages: sahajatlas` check runs across `main` and PR heads #58
  to #128 — p50 99s, p75 138s, p90 232s, p95 373s, max 453s — the queueing
  cause of the slow tail, and the `sahajatlas-design` sibling's median 41
  seconds' head start, which is why it was no use as a second source once
  #279 deleted that project.
- The finding that a Cloudflare build's in-progress window IS observable
  live and INVISIBLE to a retrospective query, which #132 was written on
  the wrong side of.
- #135's observed staleness case, now under invariant three: the comment
  naming `9326e3b` while the head was `56c6b0d`.
- The check-run naming collision #280 and #297 found, re-pointed at the one
  thing that still depends on it — `production-smoke.yml`'s `==`.

Invariant three is restated rather than dropped. Its security half gets
stronger, and the restatement says why: nothing is scraped, so the
provenance ranking has no class of attack left to rank, and the middle
label of a Workers preview host is our own account subdomain rather than a
first-come-first-served one. The staleness risk is named in its new form —
the specs must read the pinned alias, because the branch-following one
would smoke-test a later push — and so is the label-segment anchor, as the
thing that refuses the playground.

The `preview_status` table becomes the six causes that can now occur. The
lesson under `failed` is kept explicitly: never send a reader to re-run a
job that will fail identically.

Every row of the ticket's citation table is swept, plus three the table did
not list and the grep found: `wrangler.jsonc` and `wrangler.design.jsonc`
both cited the deleted spec as the anchor's pin, and
`docs/environment.md`'s `VITE_SENTRY_DSN` row cited the deleted script —
that row now records that the preview's DSN is an Actions secret here, not
a Cloudflare Preview-environment variable. `scripts/_ci-output.mjs` stays,
since `check-bundle-size.mjs` imports it, with its docblock re-pointed.

No `⚠` line, `#NNN` breadcrumb or cross-repo pointer was dropped: compared
set-wise against `origin/main`, `docs/testing.md` loses no breadcrumb and
gains five `⚠` markers. The `X-Robots-Tag` unknown is recorded beside the
four assertions it would blunt, with the instruction to record rather than
weaken them.

`ci.yml`'s gate-step comment no longer calls `wrangler.design.jsonc` the
only config the gate reads, names `dist/` as well as `build/` among what
must exist first, and states that `pnpm build` runs twice on purpose —
deleting the first as a duplicate would fail the gate cold.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
`production-smoke.yml` fired on `Cloudflare Pages: sahajatlas`. Once the
app serves from a Worker that run stops being the one that publishes
production, and the lane would wait on a check run nobody posts again —
silently, since a workflow that never fires raises nothing.

#297 answered both of this section's unknowns off the design Worker's own
builds: Workers Builds does post a check run, it is named
`Workers Builds: <worker name>`, and one Cloudflare App posts both it and
the Pages run — so `startsWith(app.slug, 'cloudflare')` holds unchanged and
the `push`-trigger fallback this ticket once specified is void.

⚠ The comparison stays `==` on the whole name. `sahajatlas` is a prefix of
`sahajatlas-design`, which deploys from this repo too, so `startsWith` or
`contains` would let the playground fire the atlas's production lane —
the same prefix hazard the preview host guard exists for, one layer up.
The production-versus-preview pair, the bare `PREVIEW_URL` literal, the
`SYDEVS_BOT_PAT` author, the `production-red` label and the smoke-step gate
are all untouched.

`ci-workflows.test.ts` now matches the whole check-run name against
`Workers Builds: <wrangler.jsonc's name>`, so the integration prefix is
part of the anchor rather than assumed. Watched red against all three
defects: pointing at the playground, reverting the prefix to Pages, and
relaxing `==` to `startsWith`.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
Four review lenses over the whole branch. Applied:

- **`realpathSync('')` throws ENOENT**, so the main-module guard's `|| ''`
  was false reassurance: a missing `argv[1]` would crash the import rather
  than read as false. The guard now tests it first. Carried from the
  deleted discovery script, which had the same line.
- **`label.length <= suffix.length` had an unreachable half.** After
  `endsWith(suffix)` the length cannot be smaller, so it is `label ===
  suffix` — which also states the intent, that the bare worker label is
  production rather than a preview of it.
- **The guard demands every address, rather than filtering empties.** "Do
  we have an address" now lives in one place: the specs step gates on
  `reason` like its four siblings, and the workflow expression that used to
  encode the same rule, and could only ever disagree with it, is gone.
- **`appWorkerName()` moved below the empty-argument check**, so a broken
  config cannot pre-empt the clearer message.
- **The plan step's `publish` output was `reason == 'publish'` spelled
  twice.** One value now, which also removes a trailing `&&` list a reader
  had to prove safe under `set -e`. Re-ran all four states under `bash -e`.
- **`PACKAGE` and `ROOT` were parsed twice** in two specs in one directory,
  each with its own hand-written type. `readPackage()` and `ROOT` join
  `_wrangler-config.mjs`, whose docblock now says why `package.json` sits
  beside the configs.
- **`atLeast` was eight lines of unreachable generality** for one
  constant-floor check: `localeCompare(…, { numeric: true })` does it, and
  the ⚠ naming the `4.9.0` trap stays. Verified against six version pairs,
  including that a plain compare reads `4.9.0` as newer than `4.136.3`.
- **The import-shape regex went**, keeping `toContain('appWorkerName()')`.
  It only added the imported-but-unused case, which lint already rejects,
  while reddening legal rewrites such as an aliased import.
- **`ci.slice(indexOf(…))` could vacuum**: `-1` leaves one character, and
  every negative assertion below passes against it. It throws at collection
  now, the same rule as `match()`.
- **The merge-queue and fork paths paid for a checkout and a full install**
  for a job that then skipped everything. The plan step runs first and the
  setup steps are gated on it. A queue entry is one per merge.
- **A closed pull request's `refs/pull/<n>/merge` stops being served**, so
  the teardown's default checkout could fail on the one event that can ever
  delete the preview. It checks out the base commit, which is also the
  right copy of `wrangler.jsonc`.

Two new cross-file pins, each watched red against the defect it names: the
teardown deletes the preview the publish created, by the same `--name` and
the same `--config` as `APP_CONFIG` — a mismatch leaks a preview no sweep
can reach, since wrangler has no `preview list`; and the report step handles
every reason the plan step emits, makes only `fork` and `queue` quiet, and
keeps the loud fallback.

Declined, with reasons:

- **"Set but unusable ⇒ throw" in `tests/smoke/_helpers/preview.ts`.** A
  non-empty bad value already fails loudly, and the empty case must stay a
  skip: `production-smoke.yml` and a `-design` run both set hosts the guard
  refuses by design, so the loudness belongs to the job. `docs/testing.md`'s
  first invariant says so.
- **Moving the report step into `scripts/`.** It must run without a
  checkout, which is now gated — and gating the checkout is what makes a
  queue entry free. The vocabulary pin above closes the gap a spec would.
- **`build:preview` (`vite build` without `tsc`/`assert:css`).** Measurably
  cheaper, and it contradicts an explicit acceptance criterion naming
  `pnpm build:worker`. Noted for the reviewer rather than decided here.
- **A shared `isMain()` in `_ci-output.mjs`.** It would edit
  `assert-no-sourcemaps.mjs`, which this PR does not otherwise touch.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
The preview's build-time values moved from Cloudflare's Preview environment
into this repository's Actions secrets, because the job that builds the
preview is ours now. `docs/environment.md` is the variable reference, so it
gains the five and says which failure each one prevents — two of them
(`VITE_SENTRY_DSN`, `VITE_SAHAJCLOUD_API_KEY`) are not optional for a
preview, and the file already recorded why.

⚠ Until all five exist every same-repo pull request fails its `Smoke`
check, naming the missing pair. Stated there, because the alternative is a
green check that read nothing.

It also corrects a claim the change made false: `SENTRY_AUTH_TOKEN` was
"the only secret in this repo read by a build rather than run by hand". It
is now only the only one a DEPLOY build reads.

`AGENTS.md`'s CI-gate bullet described a missing Cloudflare preview being
annotated and then failed; it now describes the two states that skip
quietly and says every other route to no preview fails the job, plus the
teardown being the only chance to delete a preview.

No `docs/embedding.md` or `CHANGELOG.md` entry is owed: nothing a host can
observe changes. No `src/` or `public/` file is touched, the domain does
not move, and the preview's Sentry origin is already covered by the
`connect-src` row #123 widened.

Refs #282

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MZ4TLZehWMEjq4c7Vw1ghg
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 14, 2026
@sydevs-bot

sydevs-bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 17:15Z resolve-conflicts · attempt 1 · session · done
  • 17:15Z resolve-conflicts · attempt 1 · session
  • 07:04Z address-review · attempt 1 · session · done
  • 07:04Z address-review · attempt 1 · session
  • 06:56Z review-pr · attempt 1 · session · done

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

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Smoke is red because this repository holds no CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID. No code change fixes it.

The plan step read HAS_TOKEN: false, PR_NUMBER: 299, SAME_REPO: true, so it emitted no-credentials. The report step then exited 1. No spec ran. The PR's own ## Summary specifies that red.

A cloud session cannot add an Actions secret. ## Manual verification step 1 is the only fix: add the five secrets, then re-run Smoke.

I pushed nothing. On ea647da, Lint, Typecheck & Build and Dependency Review / review are both green.

🤖 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 Oct 14, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design 2f5ad81 Oct 16 2026, 05:23 PM

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

This draft has had no CI activity for hours and no session holds it. A mention (@sydevs-bot) or a push from you starts me again.

🤖 sydevs dispatcher

`wrangler preview` (open beta, through 4.151.0) uploads an assets-only
Worker with a placeholder `no-op-worker.js`. The platform then serves the
SPA fallback to browser navigations only, so `/search` returned 404 to the
smoke specs' fetch while production served the shell. `versions upload
--preview-alias pr-<n>` routes like `wrangler deploy` and deploys nothing.

The action exposes only the version URL for an upload, so the guard reads
the alias off wrangler's stdout. Aliases cannot be deleted (Cloudflare keeps
the 1,000 most recent), so preview-teardown.yml goes, along with the
`deployments: write` grant only the preview path used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2f5ad81
Status: ✅  Deploy successful!
Preview URL: https://2e482d05.sahajatlas.pages.dev
Branch Preview URL: https://claude-ci-282-own-preview.sahajatlas.pages.dev

View logs

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 16, 2026
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 16, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

The session for this item did not finish after 3 attempts. I have stopped retrying. A mention (@sydevs-bot) or a push from you starts me again.

🤖 sydevs dispatcher

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 16, 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

Net −726 lines, 1,350 deleted rather than ported: the shape the ticket asked for. The guard keeps the one property that survives the move, anchored on wrangler.jsonc's own name, and _wrangler-config.mjs earns its place at three readers.

But the body describes a different PR. HEAD is 35d35ed ci(smoke): publish with versions upload, not wrangler preview; the body still documents wrangler preview. It names .github/workflows/preview-teardown.yml, absent from the branch, reads two outputs nothing reads, and offers four "watched it fail" rows for code the diff has not got. The reviewer reads the body first.

That change also voided §7 in silence: the close-time delete is gone, with no line on whether an alias needs deleting. Wrangler has no preview list, so one nobody deletes is unreachable forever.

Findings

  • blocker — the body documents the pre-35d35ed implementation, down to a workflow file that does not exist.
  • should-fix — §7's teardown dropped, with no statement of why or whether an alias needs one.
  • should-fix — ci.yml:134: the plan step gates on two of the five secrets the build needs.
  • should-fix — ci.yml:279: nothing shows deployment-url is the version's address, not the alias's.
  • consider — ci.yml:229: command-output and wrangler's stdout label carry the lane, unverified.

What was checked

#282 whole against the diff. Read on the branch: all 344 lines of ci.yml, assert-preview-host.mjs and its spec, _wrangler-config.mjs, ci-workflows.test.ts, both wrangler configs, production-smoke.yml, boot-origins.smoke.test.ts. git ls-tree shows no preview-teardown.yml. The production lane keeps == and its head_branch/head_sha pair. The guard spec carries §2's four refusals plus the playground host. No preview to open; the body says why, correctly.

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


Generated by Claude Code

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml 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 Oct 16, 2026
The plan step read only the Cloudflare pair. With those entered and the
three VITE_* secrets missing, a same-repo run reached `publish`, uploaded
successfully, and then failed boot-origins.smoke.test.ts on an origin vite
had inlined as empty — a missing secret arriving as a spec failure that
blames the deploy, with the report step silent because the specs did run.

The two lists are now pinned to each other: ci-workflows.test.ts compares
what the plan step gates on against what the build step reads, so neither
can move alone. Watched fail against the two-secret gate.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Roix3cGDiKX6EXqnXYicKf
The guard's two unpinned strings — the action's `command-output` output
and wrangler's `Version Preview Alias URL:` line — and the claim that
`deployment-url` is the version's address rather than the alias's were
each stated without a source. Record where each was read, so the next
reader checks the two pins rather than re-deriving them.

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

Copy link
Copy Markdown
Contributor Author

Addressed the review. Head 4b5bc72, lean gate green.

Adopted

  • blocker, the stale body: rewritten for versions upload — its two addresses, no preview-teardown.yml, the dead rows replaced.
  • should-fix, §7's teardown — ## Notes for reviewer opens with it. An alias has no delete command, and Cloudflare drops the oldest of a Worker's 1,000, so none leaks. That criterion is void, not unticked.
  • ci.yml:134: ffa267f gates publish on all five secrets, pinned to the build's list. Watched fail.

Rebutted, from source

  • ci.yml:279, ci.yml:229: for a versions upload, deployment-url is the version's own URL, the alias a field the action never reads, and command-output is declared at the pinned SHA. 4b5bc72 cites both.

🤖 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 Oct 16, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 16, 2026 07:22
@sydevs-bot
sydevs-bot requested a review from Ardnived October 16, 2026 07:22
@sydevs-bot
sydevs-bot enabled auto-merge October 16, 2026 07:22
@sydevs-bot sydevs-bot moved this from Revising to Approved in SYDevelopers Technical Roadmap Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 16, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 16, 2026
Two specs conflicted, both because `main` and this branch extracted the
same repo-file reads into different shared modules.

`scripts/wrangler-config.test.ts` and `scripts/ci-workflows.test.ts` now
use both: `readRepoSource`/`REPO_ROOT` (#302) for a plain repo file, and
`_wrangler-config.mjs` for the wrangler configs and `package.json`, which
is what couples the three readers anchoring on the app Worker's `name`.

`_wrangler-config.mjs` is a `scripts/**/*.mjs`, so #302's new
`no-restricted-syntax` ban reaches it. It resolves its root with
`dirname(fileURLToPath(import.meta.url))`, the form that rule's own
message prescribes for a `.mjs` that cannot import the `.ts` reader.

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

Copy link
Copy Markdown
Contributor Author

Merged main in at 2f5ad81. Two specs conflicted, both because main (#302, #303) and this branch extracted the same repo-file reads into different shared modules.

wrangler-config.test.ts and ci-workflows.test.ts now use both readers, each where it belongs: readRepoSource/REPO_ROOT for a plain repo file, _wrangler-config.mjs for the wrangler configs and package.json — the one thing coupling the three readers that anchor on the app Worker's name. Taking either side wholesale would have dropped the other's coupling.

One change neither side's conflict showed. _wrangler-config.mjs is a scripts/**/*.mjs, so #302's new no-restricted-syntax ban reaches its new URL('../', import.meta.url). Its root is now dirname(fileURLToPath(import.meta.url)), the form that rule's own message prescribes for a .mjs that cannot import the .ts reader.

Lean gate green on the merge: 145 files, 1,733 tests, 59s. Smoke stays red until the five Actions secrets land — unchanged by this merge.

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


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit 14cabcb Oct 16, 2026
18 checks passed
@sydevs-bot
sydevs-bot deleted the claude/ci-282-own-preview branch October 16, 2026 17:28
@sydevs-bot sydevs-bot moved this from Approved to Done in SYDevelopers Technical Roadmap Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

ci(smoke): publish and read our own atlas preview, not Cloudflare's

3 participants