Skip to content

Harden toolkit docs generation and indexing#1060

Open
jottakka wants to merge 28 commits into
mainfrom
fix/toolkit-docs-generation
Open

Harden toolkit docs generation and indexing#1060
jottakka wants to merge 28 commits into
mainfrom
fix/toolkit-docs-generation

Conversation

@jottakka

@jottakka jottakka commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Reviewer guide

Open the standalone reviewer handoff. It separates new behavior from unchanged behavior, identifies meaningful commits, and explains which generated commits to skip.

Summary

  • fail closed on empty, incomplete, colliding, unsafe, or unwritable toolkit generation inputs while preserving last-known-good output
  • replace the redundant full-site generator workflow build with focused type-checks/tests and one consistent Engine snapshot
  • publish generated toolkit routes through sitemap and llms.txt, with idempotent artifact generation that cannot commit-loop
  • align route, sidebar, Markdown, slug, index, and rich-subpage behavior across build-time and runtime consumers

Scope

  • no MCP server or MCP tool implementation changed
  • generated JSON remains sourced from existing Engine and design-system metadata
  • Algolia remains externally managed; no ranking or credential configuration changed

Test plan

  • pnpm run toolkit-docs:check (46 files, 581 tests)
  • pnpm test (58 files, 774 tests)
  • pnpm lint
  • pnpm build
  • mock CLI generation and strict output verification
  • strict and non-strict provider failures exit nonzero without writing output
  • failed all-toolkit merges preserve prior JSON byte-for-byte
  • read-only output simulation preserves prior JSON and returns nonzero
  • sidebar sync dry run reports 114 aligned toolkits
  • live preview crawl: 114 pages, 114 JSON APIs, sitemap, and llms.txt aligned
  • representative Markdown API checks include custom Datadog documentation chunks
  • manual LLMSTXT workflow dispatch passes with no diff or extra PR
  • Luna and Terra review/adjudication loops clean
  • local Bugbot final pass clean; GitHub Bugbot skipped the duplicate review
  • all PR checks pass

Note

Medium Risk
Touches sitemap, llms.txt, slug/route resolution, and generator fail-closed behavior—incorrect slug filtering or snapshot handling could hide integration pages or block doc updates, but changes are covered by extensive tests and preserve prior JSON on merge errors.

Overview
This PR tightens the toolkit docs pipeline and how generated integration pages are discovered, exported, and searched.

Generator & CI: The generate workflow now runs toolkit-docs:check instead of a separate generator build, uses a single cached Engine /v1/tool_metadata snapshot for skip-unchanged runs, and refuses to wipe all toolkits on an empty API response. Writes are atomic, toolkit IDs are validated for collisions/reserved names, merge failures surface as nonzero exits while keeping last-known-good JSON when possible, and optional pr_branch supports isolated verification PRs.

Site routing & exports: Toolkit slugs are validated (getToolkitSlug can return null); routes, the integrations index, sitemap, and sidebar sync skip or drop invalid entries and sort routes deterministically. Copy-page Markdown now includes toolkit/tool documentation chunks (replace/before/after) via shared sortDocumentationChunks. llms.txt expands real toolkit URLs (not [toolkitId] templates), groups them by integration category, avoids metadata-only commit loops, and the workflow skips fork PRs with full git history.

Search: Algolia UI adds debounced query, loading/error/empty states, and shared config helpers (with tests).

Docs copy: Agentic-development and README text reflect llms.txt in CI rather than automatic markdown negotiation on every URL.

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

Fail closed on unsafe or incomplete inputs, reuse one Engine snapshot, and expose generated routes to crawlers. Replace the redundant site build with focused generator validation and document the Vercel and Algolia flow.

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

vercel Bot commented Jul 13, 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 13, 2026 10:36pm

Request Review

@jottakka

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor

cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown

Current version of PR was reviewed by /review-bugbot with additional instructions on Jul 12, 22:44 GMT-3. It flagged 0 findings.

Bugbot on commit b0a39fa is skipped.

Keep last-known-good output on failures while returning nonzero status, publish real toolkit routes to llms.txt, and align Markdown, sidebar, slug, and subpage handling across consumers.

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

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread scripts/generate-llmstxt.ts
jottakka and others added 13 commits July 13, 2026 13:22
Skip llms generation when its own bot commit synchronizes the PR, while retaining full-history diffs and fork safety.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ignore metadata-only changes so generated commits preserve the prior source SHA and do not trigger another artifact commit.

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

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread app/_lib/toolkit-slug.ts Outdated
Comment thread app/_lib/toolkit-markdown.ts
Allow manual workflow dispatches to target a dedicated branch and base ref without changing the shared automation PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Request InstantSearch-compatible highlight markers and suppress stale results until they match the current typed query.

Co-authored-by: Cursor <cursoragent@cursor.com>
Collapse rapid keystrokes into one request so the result list no longer repeatedly unmounts and rerenders during input.

Co-authored-by: Cursor <cursoragent@cursor.com>
Exercise rapid query replacement and immediate clearing with fake timers so the anti-flicker request behavior cannot regress.

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

Copy link
Copy Markdown
Contributor Author

Algolia search regression verification

Reproduced on the preview before the fix:

  • Algolia returned <em> highlights because the request omitted InstantSearch marker tags.
  • Stale results and Searching… alternated repeatedly while typing.
  • The dialog performed 13 DOM state transitions for github, exposing literal HTML tags and causing visible jank.

Fixed by requesting __ais-highlight__ markers, suppressing stale-query results, and debouncing input by 150 ms.

Final generated preview measurement:

  • 1 Algolia request for typing github.
  • 2 states only: Searching… → results.
  • 0 literal-tag renders.
  • 0 console errors.
  • 0 search-time long tasks.

@jottakka

Copy link
Copy Markdown
Contributor Author

@cursor review

@jottakka jottakka self-assigned this Jul 13, 2026
Comment thread app/_lib/toolkit-markdown.ts
Group generated integrations in llms.txt, reject invalid empty slugs, and preserve UI chunk placement and replacement semantics in Markdown exports.

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

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread app/_components/toolkit-docs/lib/documentation-chunks.ts Outdated
Comment thread app/_components/algolia-search.tsx
Handle failed Algolia requests explicitly and preserve null safety when lightweight documentation chunks share sort priority.

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

Copy link
Copy Markdown
Contributor Author

@cursor review

Comment thread .github/workflows/generate-toolkit-docs.yml
Target the dispatch ref only for explicit verification branches while keeping shared automation PRs on the repository default branch.

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

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 63c423c. Configure here.

@jottakka jottakka marked this pull request as ready for review July 15, 2026 17:35
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