Skip to content

fix(dns): type-aware update editor for PullZone/Script records#118

Merged
jamie-at-bunny merged 2 commits into
mainfrom
fix/dns-update-editor-link-records
Jul 9, 2026
Merged

fix(dns): type-aware update editor for PullZone/Script records#118
jamie-at-bunny merged 2 commits into
mainfrom
fix/dns-update-editor-link-records

Conversation

@jamie-at-bunny

Copy link
Copy Markdown
Member

No description provided.

- promptFieldChanges no longer offers Value for PullZone/Script records;
  it offers the Pull zone ID / Edge Script ID instead (labelled with the
  record's LinkName), mapping to UpdateDnsRecordModel.PullZoneId/ScriptId.
- The CAA Tag picker now pre-selects the record's current tag.
@bogdan-at-bunny

Copy link
Copy Markdown

@codex review

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 39d9845

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@bunny.net/cli Patch
@bunny.net/cli-linux-x64 Patch
@bunny.net/cli-linux-arm64 Patch
@bunny.net/cli-darwin-x64 Patch
@bunny.net/cli-darwin-arm64 Patch
@bunny.net/cli-windows-x64 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: eb61a853d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the interactive DNS record update editor so that PullZone-type and Script-type records show their linked resource ID field (PullZoneId / ScriptId) instead of the meaningless Value field, and pre-selects the current CAA tag value for the Tag prompt.

  • Type-aware field selection: The interactive field picker now branches on existing.Type to show PullZoneId or ScriptId (with the linked resource's display name from LinkName) for the respective record types, falling back to Value for all other record types.
  • CAA tag pre-selection: The Tag prompt now derives initial via findIndex on CAA_TAGS, so the currently-set tag is pre-highlighted rather than always defaulting to the first option.
  • Friendlier error messages: The required-field error now uses the human-readable prompt label (e.g., "Pull zone ID is required.") instead of the raw model field name ("PullZoneId is required.").

Confidence Score: 5/5

Safe to merge — the change is confined to the interactive prompt path and introduces no new API calls or data mutations beyond what the editor already performs.

The type-aware branching, CAA tag pre-selection, and error-label extraction are all correct. The DnsRecordModel read schema intentionally omits PullZoneId/ScriptId as write-only fields in UpdateDnsRecordModel, so the body-seeding gap is a pre-existing API-level constraint shared with the non-interactive flag path.

No files require special attention.

Important Files Changed

Filename Overview
packages/cli/src/commands/dns/record/update.ts Core change: adds PullZoneId/ScriptId to FIELD_PROMPTS, branches promptFieldChanges on record type, pre-selects current CAA tag, and improves error label extraction. Logic is correct; no critical issues found.
.changeset/dns-update-editor-link-records.md Changeset entry correctly categorises the fix as a patch release for @bunny.net/cli.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[promptFieldChanges called] --> B{existing.Type?}
    B -->|PULLZONE| C[Push PullZoneId field\nLabel: Pull zone (LinkName)]
    B -->|SCRIPT| D[Push ScriptId field\nLabel: Script (LinkName)]
    B -->|other| E[Push Value field]
    C --> F[Push Name, TTL, Comment, Disabled...]
    D --> F
    E --> F
    F --> G[multiselect: user picks fields to change]
    G --> H[for each picked field]
    H --> I{spec.kind?}
    I -->|tag| J[select prompt\ninitial = findIndex CAA_TAGS]
    I -->|number/text| K[number/text prompt\ninitial = existing field or undefined]
    J --> L{value === undefined?}
    K --> L
    L -->|yes| M[throw UserError\nusing spec.message label]
    L -->|no| N[changes[field] = value]
    N --> H
    H -->|done| O[return changes]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[promptFieldChanges called] --> B{existing.Type?}
    B -->|PULLZONE| C[Push PullZoneId field\nLabel: Pull zone (LinkName)]
    B -->|SCRIPT| D[Push ScriptId field\nLabel: Script (LinkName)]
    B -->|other| E[Push Value field]
    C --> F[Push Name, TTL, Comment, Disabled...]
    D --> F
    E --> F
    F --> G[multiselect: user picks fields to change]
    G --> H[for each picked field]
    H --> I{spec.kind?}
    I -->|tag| J[select prompt\ninitial = findIndex CAA_TAGS]
    I -->|number/text| K[number/text prompt\ninitial = existing field or undefined]
    J --> L{value === undefined?}
    K --> L
    L -->|yes| M[throw UserError\nusing spec.message label]
    L -->|no| N[changes[field] = value]
    N --> H
    H -->|done| O[return changes]
Loading

Reviews (2): Last reviewed commit: "fix(dns): address review feedback in the..." | Re-trigger Greptile

Comment thread packages/cli/src/commands/dns/record/update.ts
Comment thread packages/cli/src/commands/dns/record/update.ts Outdated
- Exclude Tag from the computed initial (the tag select derives its own
  from CAA_TAGS), removing a dead value.
- Cancelled prompts report the prompt label ("Pull zone ID is required.")
  instead of the model field name ("PullZoneId is required.").
@jamie-at-bunny jamie-at-bunny merged commit 93ffdbc into main Jul 9, 2026
2 checks passed
@jamie-at-bunny jamie-at-bunny deleted the fix/dns-update-editor-link-records branch July 9, 2026 14:49
@github-actions github-actions Bot mentioned this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants