Skip to content

Commit ecf0896

Browse files
BYKGPT-6 Sol
andauthored
fix(cloudflare): Upload built Worker and SPA assets (#1400)
## Why The first exact-version production deployment uploaded source `public/` assets instead of Vite's built SPA. That directory has no `index.html`; candidate root smoke returned 404 before promotion, and the workflow recovered the previous version. ## Change - Upload using the generated `dist/sentry_mcp/wrangler.json` Worker config and `dist/client` assets, checking both exist first. - Add a regression for the version-upload inputs and update deployment docs. ## Validation - `pnpm run tsc`, `pnpm run lint`, `pnpm run test:ci-projects` (28 passed), `pnpm --filter @sentry/mcp-cloudflare run test` (431 passed), docs/generated checks, and Wrangler dry run passed. - Full `pnpm run test` timed out after ten minutes while the CLI suite was running; exact-head CI will run the full gate. Co-authored-by: GPT-6 Sol <agent@openai.com>
1 parent df857f8 commit ecf0896

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ jobs:
9696
TESTED_SHA: ${{ github.event.workflow_run.head_sha }}
9797
WRANGLER_OUTPUT_FILE_PATH: ${{ runner.temp }}/wrangler-upload.jsonl
9898
run: |
99+
test -s dist/client/index.html
100+
test -s dist/sentry_mcp/wrangler.json
99101
pnpm exec wrangler versions upload --experimental-auto-create=false \
100-
--config wrangler.jsonc \
102+
--config dist/sentry_mcp/wrangler.json \
103+
--assets dist/client \
101104
--message "toolkit-mcp:$GITHUB_RUN_ID:$GITHUB_RUN_ATTEMPT:$TESTED_SHA:upload"
102105
103106
- name: Identify uploaded production version

‎docs/operations/github-actions.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ smoke-test suite remains in its own workflow.
2121
### deploy.yml
2222
Runs after a successful `Test` push run on `main`. Checks out the tested commit
2323
and requires that it is still the tip of `main`. Builds once, records the active
24-
production version, and uploads one new version of `sentry-mcp`. It stages the
25-
candidate at 0% alongside the old version at 100%, then runs smoke tests
26-
through the production route with a version override on every request. The
27-
version endpoint confirms the override reaches the candidate. Only then does
28-
it promotes the tested version to 100% and repeats the smoke tests. On failure
24+
production version, and uploads one new version of `sentry-mcp` from Vite's
25+
generated Worker config and `dist/client` assets. The source `public` directory
26+
does not contain the built SPA's `index.html`. It stages the candidate at 0%
27+
alongside the old version at 100%, then runs smoke tests through the production
28+
route with a version override on every request. The version endpoint confirms
29+
the override reaches the candidate. Only then does it promote the tested
30+
version to 100% and repeat the smoke tests. On failure,
2931
it restores the exact captured prior version only if the live deployments still
3032
belong to this run.
3133

‎docs/releases/cloudflare.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ after the `Test` workflow succeeds for the current `main` commit:
143143

144144
1. Merge a PR into `main`; GitHub Actions tests that exact commit.
145145
2. The workflow builds once, captures the live production version, and uploads
146-
a new version of the production Worker without shifting traffic.
146+
the generated Worker bundle and `dist/client` SPA assets without shifting
147+
traffic. The source `public` directory does not contain the built homepage.
147148
3. It stages that version at 0% while the prior version serves 100%, then tests
148149
it with a version override through the production route. The version probe
149150
confirms that the candidate handled the overridden request.

‎scripts/deploy-workflow.test.mjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ test("production deploy requires a successful Test run on this repository's main
7272
);
7373
});
7474

75+
test("version upload includes the built Worker and SPA assets", () => {
76+
const upload = workflow.match(
77+
/- name: Upload production version without moving traffic[\s\S]*?(?=\n {6}- name: Identify uploaded production version)/,
78+
)?.[0];
79+
assert.ok(upload);
80+
assert.match(upload, /test -s dist\/client\/index\.html/);
81+
assert.match(upload, /--config dist\/sentry_mcp\/wrangler\.json/);
82+
assert.match(upload, /--assets dist\/client/);
83+
});
84+
7585
test("deployment failures never invoke an unqualified rollback", () => {
7686
assert.doesNotMatch(workflow, /(?:command:|pnpm exec wrangler)\s+rollback\b/);
7787
assert.match(

0 commit comments

Comments
 (0)