#1484·corsair

Generated plugin docs mix tenant-scoped and unscoped setup

Author: elkampuCreated Sep 4, 2026Updated Sep 11, 2026

Steps to reproduce

  1. On current main, run pnpm generate:docs:all.
  2. Inspect any generated docs/plugins/*/overview.mdx page. The setup creates Corsair without multiTenancy: true, but the examples later call corsair.withTenant(...).
  3. Inspect generated api.mdx and database.mdx pages. They call corsair.<plugin>.api and corsair.<plugin>.db directly, which conflicts with the tenant-scoped usage shown in the overview.
  4. Inspect a generated webhook example. It creates a configured plugin instance as a standalone expression after createCorsair(...), so that configured instance is not registered in the client's plugins array.

On the current tracked documentation this affects all 207 overview pages that use withTenant, 181 database pages, 207 API pages, and the generated webhook examples for plugins that expose them.

Expected behavior

Generated examples should describe one internally consistent setup:

  • setup enables multiTenancy: true before calling withTenant;
  • API and database examples use the tenant-scoped client; and
  • webhook configuration is registered in the plugins array while preserving any auth or factory options already shown in setup.

The docs validator should also catch regressions in those invariants.

Corsair version

Current main (291ac57a)

Environment details

bash
OS: Windows 11
Node: 22.x
Package manager: pnpm 10.x

What part of Corsair is affected?

Documentation

Anything else

I found this while addressing the Google Sheets examples in #1252 / #1483. It predates that work and is generator-wide, so it should be fixed separately rather than expanding the plugin-scoped pull request.

I have locally verified a possible direction against all 260 generated plugin docs: update the generator and documentation contract, add validation for the tenant/setup relationship and direct API/database calls, and regenerate only the intended tracked outputs in a reviewable follow-up.