Skip to content

Promote ctx.data.staleWhileRevalidate as the primary cache-first pattern in builder prompt#70

Merged
pablopunk merged 1 commit into
mainfrom
fractal-nvm-work-62-builder-prompt-doesn-t-promote-ctx-53ab7a
Jun 21, 2026
Merged

Promote ctx.data.staleWhileRevalidate as the primary cache-first pattern in builder prompt#70
pablopunk merged 1 commit into
mainfrom
fractal-nvm-work-62-builder-prompt-doesn-t-promote-ctx-53ab7a

Conversation

@pablopunk

Copy link
Copy Markdown
Owner

Why

The AI builder defaults to manual cache-then-refresh patterns when building cache-first views, even though ctx.data.staleWhileRevalidate() provides the same semantics declaratively in ~10 lines. This leads to 5-10x more turns and fragile ~180-line hand-rolled cache code.

What

  • Added data to the builder system prompt's namespaces list so the builder knows the namespace exists before reaching for the full API reference
  • Added a data hint section describing staleWhileRevalidate as the primary pattern for cache-first views — covering fresh/stale/expired/error-fallback lifecycle — with explicit guidance to prefer it over manual ctx.storage.get/set + ctx.views.invalidate()
  • Also documents ctx.data.loader() for non-cached lazy-loading cases

Closes #62

…first pattern

- Add 'data' to the builder system prompt namespaces array
- Add a data section describing staleWhileRevalidate as the preferred
  declarative pattern for cache-first views, replacing the manual
  ctx.storage.get/set + ctx.views.invalidate() antipattern
- Also document ctx.data.loader() for non-cached lazy-loading views

Closes #62
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nvm Ready Ready Preview, Comment Jun 21, 2026 6:10pm

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@pablopunk, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 12 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d1fde048-e45a-4437-9b8b-f622335783c0

📥 Commits

Reviewing files that changed from the base of the PR and between a471f45 and 3250563.

📒 Files selected for processing (1)
  • src/electron/ai.ts

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@pablopunk
pablopunk merged commit 1a577b7 into main Jun 21, 2026
8 checks passed
@pablopunk
pablopunk deleted the fractal-nvm-work-62-builder-prompt-doesn-t-promote-ctx-53ab7a branch June 21, 2026 18:26
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.

Builder prompt doesn't promote ctx.data.staleWhileRevalidate() as the primary cache-first view pattern

1 participant