Skip to content

perf(kv): bound scans and deduplicate cache writes - #1042

Merged
Pigbibi merged 5 commits into
mainfrom
perf/kv-directory-reconcile-availability
Nov 1, 2026
Merged

Pigbibi merged 5 commits into
mainfrom
perf/kv-directory-reconcile-availability

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

AI assistance

Codex (user-requested sol). Existing four drafts originally used DeepSeek; this revision is implemented and verified by Codex.

What changed

Persist a 100-attempt UTC-day List budget in the existing serialized directory; change default reconciliation from six hours to one day; preserve immediate key registration. Serialize semantic current-strategies cache writes across isolates using a persisted digest and the existing 15-minute keep-alive. Fix in_progress for a complete snapshot with a pending cursor. Retain receiver-first compatibility and loud storage/quota errors.

Why

Reduce repeated Worker computation and KV operations without changing authorization or business decisions.

How verified

Directory and cache regression suites PASS: 288 cron ticks => 1 List/1 mirror put; 100 simultaneous refreshes => 1 cache put; Worker bridge, restart, rotation, real changes, failed-write retry and legacy receiver covered. Python: 1067 tests OK (10 skipped) in an isolated checkout of this head. Generated config/display/runtime validation, frontend build/operations tests, syntax and documentation style PASS. The CI JS sequence was executed in parts: Node 24 rejected the CI's legacy flag, so remaining commands used Node 22. One UX1 demo test cannot determine its listener because lsof is unavailable; other executed JS commands passed. In a multi-repository layout, three compatibility subcases fail on both main and this head because the sibling QuantAIService changes discovery; the isolated suite passes.

Daily KV estimate

Normal single-page steady case: 1 List/day (0.1% of Free), plus admin/migration pages, with 100 attempts/day (10%) enforced by this owner. Cache/mirror writes <=97/day plus actual cache content changes, other record writes and new-key mirrors. If those extra writes are B, QRS is <=97+B/day; other namespaces historically average 88/day, giving a planning total <=185+B/day. Reserving the entire historical QRS mean (529.33) as B gives a deliberately conservative planning scenario of 626.33 QRS writes/day and 714.33 account writes/day (71.43%). This is not a production measurement or a bound on mutation bursts; peak writes can still exceed 1000/day.

Free account-wide limits: 1,000 writes/day and 1,000 Lists/day, resetting at 00:00 UTC. Cloudflare KV pricing. Estimates assume the audit workload; no deployment or post-change production measurement has occurred. Bulk writes still count per key.

Risk

High: Worker and existing DO paths. Out-of-band discovery may lag up to 24 hours by default; indexed ingress remains immediate. New list-budget exhaustion remains an explicit outage until UTC reset +60s. No authority/freshness checks, protected labels, deployment settings or bindings are weakened. No merge or deployment.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d46bf199-8fd8-4ea6-9c74-2285ec8efb1b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Pigbibi Pigbibi changed the title perf(console): keep directory serving and skip no-op mirror writes perf(kv): bound scans and deduplicate cache writes Nov 1, 2026
@Pigbibi Pigbibi added needs-owner-approval The owner must apply owner-approved before this high-risk pull request can merge. risk:high Protected paths require owner approval as determined by the risk gate. labels Nov 1, 2026 — with ChatGPT Codex Connector
@Pigbibi
Pigbibi marked this pull request as ready for review November 1, 2026 20:07
@Pigbibi Pigbibi added the owner-approved Owner approval for high-risk PRs. AI agents must never apply this label. label Nov 1, 2026
@Pigbibi
Pigbibi merged commit 9b695a4 into main Nov 1, 2026
18 of 23 checks passed
@Pigbibi
Pigbibi deleted the perf/kv-directory-reconcile-availability branch November 1, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-owner-approval The owner must apply owner-approved before this high-risk pull request can merge. owner-approved Owner approval for high-risk PRs. AI agents must never apply this label. risk:high Protected paths require owner approval as determined by the risk gate.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants