Feng Yi: On the free tier, the cheapest rollback is not a release—it's a switch in KV
On 2026-11-21, X user @Michael_liyang (Feng Yi) wrote: on the free tier, the cheapest rollback is not a release—it's a switch in KV. Steps: 1 put the switch in KV; 2 read the switch first on the request—on takes the new path, off takes the old path; 3 canary-split by user hash, 10% first and then full rollout; 4 if something goes wrong, change KV and roll back immediately, without waiting for a release. Path: request → read switch → split → new/old path → log to D1. Switches also need expiry cleanup; don't let them pile up into dead config.
- Products
- Workers KVWorkersD1
- Source
- Author experience𝕏 post
- Author
- Feng Yi (@Michael_liyang)
Key points
- This is a new KV-switch rollback tutorial from this author, and it is not merged into the author's existing CORS preflight or other free-tier quota guides. The post does not give specific KV operation cost figures.
Original sources
Published
Original post
Read on 𝕏On 2026-11-21, X user @Michael_liyang (Feng Yi) wrote: on the free tier, the cheapest rollback is not a release—it's a switch in KV. Steps: 1 put the switch in KV; 2 read the switch first on the request—on takes the new path, off takes the old path; 3 canary-split by user hash, 10% first and then full rollout; 4 if something goes wrong, change KV and roll back immediately, without waiting for a release. Path: request → read switch → split → new/old path → log to D1. Switches also need expiry cleanup; don't let them pile up into dead config.
风易 | AI 工具链
@Michael_liyang · Original 𝕏 post
先说结论:免费档里最便宜的回滚不是发版,是 KV 里的一个开关。做法:1 开关放 KV;2 请求先读开关,开走新链路、关走旧链路;3 灰度按用户哈希分流,先 10% 再全量;4 出问题改 KV 立刻回滚,不用等发版。链路:请求→读开关→分流→新/旧链路→记 D1。开关也要过期清理,别攒成死配置。
More to read
sean1093/purse-strings: in-process LLM spend budgets, with optional Durable Objects or KV stores
The MIT-licensed TypeScript library purse-strings (sean1093/purse-strings) is described as a denial-of-wallet guard for apps that call LLM APIs: per-user, per-session and global token, cost and request budgets, plus step, tool-call and time limits for agent loops. It has zero runtime dependencies and can keep counters in memory, Firestore, or Cloudflare Durable Objects or Workers KV. The README warns that with multiple process replicas, each replica enforces the limit, so the effective limit is N times the configured value unless a shared store is used, and that a Durable Objects or KV store is what a hard limit needs. Reviewed from the public README on 2026-11-19. Example figures in the docs include a user-daily cap of costUsd: 1 and a fleet-daily cap of costUsd: 200.
Kun Save Point (@Savepoint_kk): a D1 bug rewrote unchanged data into a $2,739.12 bill; $2,141 goodwill credit granted.
Kun Save Point (@Savepoint_kk), an indie developer who says he recently lost his job, says a bug repeatedly rewrote unchanged data while inefficient queries amplified reads, producing a $2,739.12 Cloudflare bill already paid via PayPal (D1 rows written $2,641.00, rows read $64.06, other services $34.06); he says his bills were usually under $10 a month. Cloudflare granted a $2,141 goodwill account credit under case #02391058. He asks for it to be converted into a refund to the original PayPal payment, or at least for relief on the $2,641 write charges, and later writes that the initial request was declined and has been reopened for additional review. On October 25 he adds that he missed the only alert email Cloudflare sent, whose amount was not particularly high, and received no further warning before the large card charge; on October 26 he writes that the refund request to the original payment method is still under further review. On November 10 he posts a timeline saying that after following up on November 10–11, support again stated the $2,141 could only remain as account credit and the remaining $598.12 was still undecided while the ticket was being closed.
Uploads: send large bodies straight to R2 instead of through a Worker
风易 (@Michael_liyang) recommends a flow where the Worker only issues a one-time upload token, the browser uploads directly to R2, and a callback writes the D1 record, so large bodies do not burn Worker CPU or request quota.