Repository navigation
Commit 523264d
fix(cli): do not require DNS Edit when a plan only adopts a DNS record (#668)
---
### Problem
If a zone already has a compatible, proxied wildcard record that no
installation has recorded, `addDnsPlan` plans an `adopt` action for it.
The description is "Use the existing compatible wildcard DNS record
without taking ownership":
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/src/cli/platform-plan.ts#L929-L938
The resource phase never calls the DNS API for an `adopt` action. It
only records the adoption in the installation manifest and checkpoint:
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/src/cli/platform-installer-resources.ts#L62-L83
`planWritesDns`, however, counts every `dns-record` action other than
`reuse` as a DNS write, so `adopt` is included:
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/src/cli/platform-auth.ts#L145-L161
As a result, browser (OAuth) login is treated as unable to apply a plan
that makes no DNS change:
- **Non-interactive:** the install stops with `Cloudflare browser login
cannot authorize the planned zone or DNS changes. Set
CLOUDFLARE_API_TOKEN with Zone → DNS → Edit …`.
- **Interactive:** the installer opens the management token page and
prompts for a management API token:
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/src/cli/platform-lifecycle.ts#L799-L836
The same check also runs for `void platform domain set`.
### Repro (synthetic)
1. In a Cloudflare zone `example.app`, create a proxied `AAAA` record
`*.example.app` → `100::` by hand. No Void installation has recorded it.
2. Sign in with browser login only, so that neither
`CLOUDFLARE_API_TOKEN` nor `CF_API_TOKEN` is set.
3. Run `void platform install --application-domain example.app --zone
example.app`.
4. The plan shows `adopt` for `application-dns`. Before this change, the
installer then asks for a management token with **Zone → DNS → Edit**
(interactive), or exits with the error above (non-interactive).
### Change
- `planWritesDns` in `packages/void/src/cli/platform-auth.ts` now treats
only `create` as a DNS write. `reuse` and `adopt` no longer count.
- The "Required Credentials" summary in `formatPlatformSetupPlan` has
the same predicate inline, so it now uses the same rule. Without this,
`--plan` would still list "DNS changes" for an adopt-only plan:
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/src/cli/platform-setup.ts#L247-L251
Zone creation, Access setup, and `create` of a DNS record still require
a management token, exactly as before.
### Tests
This extends `requires an API token before browser OAuth applies zone or
DNS writes` in `packages/void/test/unit/platform-auth.test.ts`:
https://github.com/voidzero-dev/void/blob/afeeff6a4d72682f6cfb6c947e9a2c29393c00a6/packages/void/test/unit/platform-auth.test.ts#L168-L196
For an OAuth credential:
| Plan contains | `platformOperatorNeedsManagementToken` |
| --- | --- |
| `dns-record` `adopt` | `false` |
| `dns-record` `reuse` | `false` |
| `dns-record` `create` | `true` |
`assertPlatformOperatorCredentialCanApplyPlan` does not throw for the
adopt-only plan.
### Verification
```
$ vp test run packages/void/test/unit/platform-auth.test.ts packages/void/test/unit/platform-setup-flow.test.ts packages/void/test/unit/platform-setup.test.ts
Test Files 3 passed (3)
Tests 131 passed (131)
$ vp run --filter ./packages/void typecheck # exit 0
$ vp fmt --check / vp lint on the changed files # clean
```
`vp run test` on this machine has 60 pre-existing failures that also
fail on `main` without this change (Playwright Chromium not installed,
playground output not generated); none are in the touched files. With
the source fix reverted, the new `platform-auth` test fails (`expected
true to be false`).
The `platform-setup-flow` fixture used a DNS `adopt` action as its
example of "needs a DNS write"; it now uses `create`.
_Prepared with Claude Code on behalf of @iPLAYCAFE-dev; reviewed by the
maintainer of this account._
### Maintainer follow-up
```
plan action DNS API call needs Zone → DNS → Edit
dns-record create yes yes
dns-record adopt no no ← this PR
dns-record reuse no no
zone create — Account → Zone → Edit
```
- `planCreatesZone` / `planWritesDns` now live in
`platform-plan-writes.ts`, which has only type imports.
`formatPlatformSetupPlan` calls them instead of keeping its own copy.
This keeps the setup prompts from loading the auth module's runtime
imports.
- `platform-auth.test.ts` shares one plan-action helper.
- `docs/guide/platform/installation/{setup,credentials}.md`: a
management token is needed when the install creates the zone or its
wildcard record, or sets up Access. An existing proxied `*.<application
domain>` record works with browser login.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: LongYinan <github@lyn.one>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent e1d6c5c commit 523264d
8 files changed
Lines changed: 79 additions & 29 deletions
File tree
- docs/guide/platform/installation
- packages/void
- src/cli
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 156 | | |
164 | 157 | | |
165 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 248 | + | |
252 | 249 | | |
253 | 250 | | |
254 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
177 | 176 | | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
198 | 218 | | |
199 | 219 | | |
200 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
453 | 472 | | |
454 | 473 | | |
455 | 474 | | |
| |||
0 commit comments