Repository navigation
Commit 406f562
fix(cloudflare): deploy targeted placement for Workers with secrets (#600)
Fixes #546.
`void deploy --platform cloudflare` refused `cloudflare.placement` with
`region`, `host` or `hostname` once the Worker had any secret. Workers
with secrets upload through the Workers beta version API, the only
endpoint that can pin secrets to a chosen version. That endpoint used to
drop the placement target
([terraform-provider-cloudflare#7273](cloudflare/terraform-provider-cloudflare#7273)),
so Void blocked it.
## Checked live (2026-10-26)
A throwaway Worker with one secret, deleted after the run:
```
beta POST, not deployed, secret inherited from the live version
{mode:'targeted', region} → kept reply {region}
{region} → kept reply {region}
{mode:'targeted', target:[{region}]} → kept reply {region} (the #7273 form)
{mode:'targeted', hostname} → kept reply {hostname}
{mode:'targeted', host} → kept reply {host}
classic GET of each version → placement_mode "targeted", target listed
beta GET / list, region version live → 200 (workers-sdk#15642's 500 did not show up)
next pinned upload after that → works
```
## What changed
```
targeted placement + secrets
send {mode:'targeted', region|host|hostname} ← same shape cf's own uploads send
upload reply still names the target?
yes → deploy goes on as before
no, staged deploy → stop before any traffic moves ("so it was not deployed")
no, atomic deploy → the version is already live; fail and say so
smart placement / none → same requests as before
no secrets (cf CLI) → unchanged
```
The check reads the upload reply, so it costs no extra request. It
accepts both reply shapes Cloudflare uses: `{ region }`, and `{ mode:
'targeted', target: [{ region, … }] }` with exactly one target.
## Tests
- `cf-version-runner.test.ts`: the old "rejects targeted placement"
cases are replaced.
- Upload: region, host and hostname, both staged and atomic. Checks the
body shape and that `?deploy=true` is set only for atomic.
- Reply with a target list: accepted.
- Bad replies, each stopping the deploy: no placement, `{}`, a targeted
mode with no target, smart, another region, the value under another
kind, two targets.
- Atomic upload that lost its target: the error says the version is
live.
- Mutation checks, each made a test fail: no reply check, no
single-target rule, the old body shape, ignoring the value, the atomic
wording.
- `vp run check`, `vp lint`, `vp fmt`, `vp run test` and one full `vp
test run` pass.
- An independent review in a separate worktree found no defects. Its one
point is listed below.
## Choices to check
- **Atomic deploys keep `?deploy=true`.** The issue's repro (`void
secret put`, then the first deploy) takes this path. If Cloudflare ever
drops the target again, that version is live before the check, and the
deploy fails with an error that names the version. The headline above
that error still says "could not bootstrap/publish". The container check
already has the same wording gap. Carrying the live version id through
the activation result would change the protocol in `deploy-cloudflare`,
so it is left out here.
- **No docs change.** No doc mentioned the refusal, and the new errors
say what to do.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent a1f00e6 commit 406f562
2 files changed
Lines changed: 138 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
425 | 439 | | |
426 | 440 | | |
427 | 441 | | |
| |||
430 | 444 | | |
431 | 445 | | |
432 | 446 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
441 | 460 | | |
442 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
443 | 467 | | |
444 | 468 | | |
445 | 469 | | |
| |||
1277 | 1301 | | |
1278 | 1302 | | |
1279 | 1303 | | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
1280 | 1310 | | |
1281 | 1311 | | |
1282 | 1312 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1368 | 1369 | | |
1369 | 1370 | | |
1370 | 1371 | | |
| |||
1373 | 1374 | | |
1374 | 1375 | | |
1375 | 1376 | | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
1379 | 1389 | | |
1380 | 1390 | | |
1381 | 1391 | | |
| |||
1387 | 1397 | | |
1388 | 1398 | | |
1389 | 1399 | | |
1390 | | - | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1391 | 1405 | | |
1392 | 1406 | | |
1393 | 1407 | | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | | - | |
1399 | | - | |
1400 | | - | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
1404 | | - | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
1408 | 1424 | | |
1409 | 1425 | | |
1410 | 1426 | | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1411 | 1482 | | |
1412 | 1483 | | |
1413 | 1484 | | |
| |||
0 commit comments