Skip to content

Design: data fetching, caching and revalidation - #194

Merged
stylessh merged 1 commit into
mainfrom
diffkit/data-fetching-design
Nov 8, 2026
Merged

stylessh merged 1 commit into
mainfrom
diffkit/data-fetching-design

Conversation

@stylessh

@stylessh stylessh commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Proposal doc only, no code: docs/data-fetching.md.

Goal: Linear-like instant UI (no skeletons for anything seen before, background revalidation) without a sync engine, which does not fit a GitHub client (no write authority, per-user permissioned data, rate-limited reads).

  • L1, client cache: IndexedDB persistence of all GitHub queries; loaders never block; pendingMs ~300 ms; filter cookie read on the client; list→detail seeding; optimistic auth from the persisted viewer.
  • L2, change feed: webhooks write entity keys to a 15-minute-TTL table; the client polls one /api/changes endpoint and invalidates only affected queries; fixed per-query polling goes away.
  • L3, optional ETag server cache: KV with TTL, writes in waitUntil, no invalidation tables.
  • Guardrails: every store ships with TTL plus a sweeper, and a D1 size alert at 80%.

Includes a measured list of where skeletons come from today, and a phased plan. See the Open questions section for the decisions needed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a proposal describing potential improvements to data loading, including cached views, targeted updates, and placeholders while details load.
    • Documented proposed background authentication checks, repository change notifications, and an optional server-side cache, along with rollout phases and monitoring safeguards. These changes describe a plan; they do not indicate that the features are available.

Instant UI from a persisted client cache, a bounded webhook change feed
for targeted revalidation, and an optional ETag server cache with
built-in expiry. Follows the D1-full incident fixed in #193.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request adds a proposal for per-user client persistence, webhook-backed query invalidation, and an optional server cache. It also describes fallback behavior, cleanup and monitoring guardrails, delivery phases, and open questions.

Changes: Data-fetching design

Layer / File(s) Summary
Caching and revalidation proposal
docs/data-fetching.md
Proposes restoring per-user GitHub query data from IndexedDB before first render, using a webhook-backed change feed to invalidate affected queries, and optionally caching responses with per-user ETags and seven-day KV expiry. It also documents fallbacks, guardrails, delivery phases, and open questions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • stylessh/diffkit#161: Changes the signal-based revalidation path that the proposed change feed would replace.
  • stylessh/diffkit#162: Changes persistence and server-cache behavior addressed by the proposal.
  • stylessh/diffkit#164: Extends webhook-to-signal mappings that overlap with the proposed change feed.
Merge Risk: Moderate · up to ac1b2

The proposal should be revised before it is adopted as the implementation plan. As written, the design could expose private repository activity keys, leave lists and aggregates stale after polling is removed, and lose the cache the proposal aims to deliver. These are design fixes, and no production code changes in this PR.

- [ ] 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

@stylessh
stylessh merged commit bbde52b into main Nov 8, 2026
4 of 5 checks passed
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.

1 participant