fix(cloudflare): align integration with live API, fix type-coercion bug#5444
Conversation
- fix update_zone_setting body builder: was blindly JSON.parse-ing every value, silently coercing scalar settings (e.g. min_tls_version "1.2") to the wrong type; now only parses object/array literals - fix list_dns_records name/content/tag filters to use Cloudflare's exact-match dotted param names (name.exact/content.exact/tag.exact) - remove auto_minify (never a real setting ID) and minify (deprecated and removed from the live zone-settings API in Aug 2024) - remove dead jump_start param from create_zone (not part of the current POST /zones schema) - fix block bgColor from #F5F6FA to Cloudflare's actual brand orange #F38020 - add missing secondary zone type option and plan.id sort option - expand BlockMeta skills/templates
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview
Create zone drops the unsupported Update zone setting UI and copy remove deprecated/invalid Two new BlockMeta skills cover zone provisioning and SPF/DKIM/DMARC setup. Reviewed by Cursor Bugbot for commit f3f3596. Configure here. |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8d72b05. Configure here.
Greptile SummaryThis PR aligns the Cloudflare integration with the live API by fixing a real type-coercion bug in
Confidence Score: 5/5Safe to merge — all changes are targeted API-alignment fixes with no new logic paths that could cause regressions on currently-working settings. The body-builder rewrite in update_zone_setting.ts is the only non-trivial logic change, and it correctly handles every runtime type that can flow through the param. The DNS filter changes swap bare params for Cloudflare's documented exact-match equivalents. Removed fields were already broken against the live API. No currently-working code path is regressed. No files require special attention. update_zone_setting.ts received the most logic change and is well-commented. Important Files Changed
Reviews (7): Last reviewed commit: "revert(cloudflare): keep original block ..." | Re-trigger Greptile |
Greptile SummaryThis PR aligns the Cloudflare integration with the live API by fixing a type-coercion bug, correcting DNS record filter params, and removing stale/deprecated fields and settings.
Confidence Score: 4/5Safe to merge; all changes are API-alignment fixes and deprecation removals with no core path regressions. The update_zone_setting body builder is materially improved — the previous blind JSON.parse coerced "1.2" to 1.2 and broke the Cloudflare API; the new dispatch is correct for every setting in the exposed dropdown. The trimmed variable is computed but the three fallback return paths use params.value instead, meaning whitespace-padded inputs for string settings (e.g. " on ") are sent unstripped to the API. This is a pre-existing quirk carried over from the old catch block, but since trimmed is now available it should be used consistently. The remaining changes (DNS exact-match params, deprecated field removal, brand color, new zone type, sort option) are straightforward and well-documented. apps/sim/tools/cloudflare/update_zone_setting.ts — the trimmed/params.value inconsistency in the fallback returns warrants a look before merge. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[update_zone_setting called] --> B[trimmed = params.value.trim]
B --> C{settingId is browser_cache_ttl?}
C -->|Yes| D[numeric = Number of trimmed]
D --> E{isNaN?}
E -->|Yes| F[send string fallback]
E -->|No| G[send as integer]
C -->|No| H{trimmed starts with curly or bracket?}
H -->|Yes - JSON literal| I[JSON.parse trimmed]
I --> J{Parse OK?}
J -->|Yes| K[send as parsed object or array]
J -->|No| L[send string fallback]
H -->|No - plain scalar| M[send as string e.g. full or on or 1.2]
G --> N[PATCH /zones/:id/settings/:settingId]
K --> N
M --> N
F --> N
L --> N
%%{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[update_zone_setting called] --> B[trimmed = params.value.trim]
B --> C{settingId is browser_cache_ttl?}
C -->|Yes| D[numeric = Number of trimmed]
D --> E{isNaN?}
E -->|Yes| F[send string fallback]
E -->|No| G[send as integer]
C -->|No| H{trimmed starts with curly or bracket?}
H -->|Yes - JSON literal| I[JSON.parse trimmed]
I --> J{Parse OK?}
J -->|Yes| K[send as parsed object or array]
J -->|No| L[send string fallback]
H -->|No - plain scalar| M[send as string e.g. full or on or 1.2]
G --> N[PATCH /zones/:id/settings/:settingId]
K --> N
M --> N
F --> N
L --> N
Reviews (2): Last reviewed commit: "fix(cloudflare): reject empty browser_ca..." | Re-trigger Greptile |
- use trimmed value consistently in update_zone_setting fallback paths - document that tag_match has no effect with a single exact-match tag filter (Cloudflare's API only combines multiple tag conditions)
|
Addressed the tag_match/tag.exact semantics note from the Greptile summary (Comments Outside Diff) in 493cb56 — updated the |
|
@greptile review |
|
@cursor review |
Wand-generated or block-referenced values can arrive as a number at runtime despite the declared string param type, which crashed the body builder's .trim() call.
|
@greptile review |
…description - coerce null/undefined value to empty string instead of literal "null"/"undefined" strings before trimming - fix stale block-level 'tag' input description left over from the comma-separated-tags -> exact-match-tag filter fix
|
@greptile review |
|
@cursor review |
A block-referenced array/object value was being blindly stringified
before the JSON-shape check, so String([...]) comma-joined arrays and
String({...}) produced the literal "[object Object]" instead of the
JSON shape Cloudflare expects (e.g. for ciphers). Already-structured
values now pass straight through.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit cb2004b. Configure here.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f3f3596. Configure here.
Summary
update_zone_setting: the body builder blindlyJSON.parse'd every value, which could silently coerce scalar settings (e.g.min_tls_version: "1.2") to the wrong type and get rejected by the API — now only object/array literals are JSON-parsedlist_dns_recordsname/content/tag filters to use Cloudflare's exact-match dotted param names (name.exact/content.exact/tag.exact) instead of bare params the API doesn't honor the same wayauto_minify(never a real Cloudflare setting ID) andminify(deprecated, removed from the live zone-settings API in Aug 2024) from the Update Zone Setting dropdownjump_startparam fromcreate_zone— not part of the currentPOST /zonesschemabgColorfrom an incorrect near-white (#F5F6FA) to Cloudflare's actual brand orange (#F38020)secondaryzone type option andplan.idsort optionAll changes were independently verified by 3 parallel audit passes against Cloudflare's live API docs, plus a dedicated backwards-compatibility check confirming no currently-working field was removed (the removed fields were all dead/broken against the live API already).
Type of Change
Testing
Tested manually — lint and typecheck pass clean on all touched files.
Checklist