Skip to content

Reuse a consistent toolkit data snapshot#1078

Open
jottakka wants to merge 1 commit into
mainfrom
fix/cache-toolkit-data-snapshot
Open

Reuse a consistent toolkit data snapshot#1078
jottakka wants to merge 1 commit into
mainfrom
fix/cache-toolkit-data-snapshot

Conversation

@jottakka

@jottakka jottakka commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • cache one all-toolkit API snapshot for change detection, progress, and merging
  • reject a transient empty snapshot when prior generated output contains toolkits
  • cover repeated reads and destructive-delete protection with deterministic tests

Test plan

  • pnpm exec tsc --noEmit --project toolkit-docs-generator/tsconfig.json
  • pnpm exec vitest run --root toolkit-docs-generator

Note

Medium Risk
Changes affect incremental generation and change detection against live APIs; a false positive on the empty-snapshot guard could block legitimate runs, while the cache fixes real consistency bugs during multi-phase CLI flows.

Overview
Generation runs now wrap the toolkit data source with createCachedToolkitDataSource, so fetchAllToolkitsData is called once per run and change detection, progress, and merging share the same in-memory map instead of independent API reads that can diverge mid-run.

Incremental and dry-run flows add assertSafeCurrentToolkitSnapshot, which fails when the current snapshot is empty but prior generated output still has toolkits—blocking mistaken “remove everything” cleanup from a transient empty API response. generate --skip-unchanged and check-changes invoke this guard before diffing.

Vitest coverage was added for the cache wrapper (single fetch, shared promise) and the snapshot safety check.

Reviewed by Cursor Bugbot for commit 7e705cb. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 17, 2026 3:34am

Request Review

@jottakka

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Current version of PR was reviewed by /review-bugbot on Jul 17, 00:53 GMT-3. It flagged 0 findings.

Bugbot on commit 7e705cb is skipped.

@jottakka jottakka self-assigned this Jul 18, 2026
@jottakka
jottakka marked this pull request as ready for review July 18, 2026 21:22
@jottakka
jottakka requested review from EricGustin and byrro July 18, 2026 21:22
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