Harden toolkit-doc generation against destructive failures#1064
Harden toolkit-doc generation against destructive failures#1064jottakka wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7ffca25. Configure here.
| if (this.requireCompleteData) { | ||
| throw new Error(`Failed to process ${toolkitId}: ${message}`, { | ||
| cause: error, | ||
| }); |
There was a problem hiding this comment.
Overwrite then strict fail wipes output
High Severity
With requireCompleteData enabled, a single toolkit merge failure now throws an error, stopping the entire generation process. This can leave the output directory empty if cleared, or result in stale/incomplete output and an outdated index.json for other toolkits that successfully processed before the failure, particularly in batch or incremental runs.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7ffca25. Configure here.
| const errors = validateToolkitFileNames(toolkits); | ||
| if (errors.length > 0) { | ||
| return { filesWritten, errors }; | ||
| } |
There was a problem hiding this comment.
Incremental writes skip collision checks
Medium Severity
Case-insensitive toolkit ID collision detection runs only in generateAll via validateToolkitFileNames. Incremental mode publishes through onToolkitComplete → generateToolkitFile, which never runs that batch check, so colliding IDs can still overwrite the same JSON file before publishing is rejected.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7ffca25. Configure here.
Reject incomplete or unsafe inputs before they can erase generated artifacts, while retaining actionable verification evidence for the workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
7ffca25 to
eb2fb74
Compare
Keep last-known-good merge fallbacks in generated output when an individual toolkit merge fails. Co-authored-by: Cursor <cursoragent@cursor.com>
Write last-known-good merge fallbacks during generate-all as well as provider batch generation. Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent check-changes from reporting a transient empty toolkit API response as every toolkit being removed. Co-authored-by: Cursor <cursoragent@cursor.com>


Summary
Test plan
pnpm exec tsc --noEmit --project toolkit-docs-generator/tsconfig.jsonpnpm exec vitest run --config toolkit-docs-generator/vitest.config.tsNote
Medium Risk
Changes affect the CI docs generation pipeline and incremental
--skip-unchangedbehavior; failures now skip overwrites and can fail the job, which is intentional but alters operational outcomes.Overview
Hardens the toolkit docs generator so incremental runs cannot wipe committed JSON from bad API data or partial merge failures.
Snapshot consistency and mass-delete guard:
createCachedToolkitDataSourcereuses onefetchAllToolkitsDatasnapshot for change detection, progress, and merging.--skip-unchangednow documents a single/v1/tool_metadatafetch instead of summary-then-partial fetches.assertSafeCurrentToolkitSnapshotaborts when the current snapshot is empty but previous output had toolkits.Failures preserve last-known-good output:
MergeResultgains anerrorfield; failed merges return the previous toolkit when available and are excluded from writes. The CLI exits non-zero on merge or write failures and only writes successful merges.requireCompleteDatafails the run instead of emitting placeholder toolkits.Safer output I/O: Toolkit IDs are validated (no path escape, reserved
index, case-insensitive collisions). JSON is written atomically;index.jsonentries are sorted. Output directory clearing uses stricterclearSafeOutputDirrules.Schema/docs:
ToolkitSubPageSchematightens custom sections and mergedsubPages. README/workflow docs add generator tests in CI and Anthropic as the primary LLM secret.Reviewed by Cursor Bugbot for commit 7ffca25. Bugbot is set up for automated code reviews on this repo. Configure here.