Skip to content

docs(contributing): tighten public-API checklist for methods, events, and exports#3480

Merged
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-typecheck-contributing-checklist
May 25, 2026
Merged

docs(contributing): tighten public-API checklist for methods, events, and exports#3480
caio-pizzol merged 1 commit into
mainfrom
caio-pizzol/SD-typecheck-contributing-checklist

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Procedural follow-up to PR #3479. The recent SuperDoc.search regression (typed as string instead of string | RegExp) slipped past every existing gate β€” type checks, the consumer matrix, the deep-type audit, package shape, snapshots, closure, and all 1054 SuperDoc package tests. The bot caught it because no consumer fixture asserted Parameters<SuperDoc['search']>[0]. The current CONTRIBUTING section on "Adding a public API" only describes new exports and doesn't say anything about adding methods or events.

This PR closes the procedural half of that gap. A coverage gate that mechanically enforces the rule is the next step (planned, separate PR).

What changed

CONTRIBUTING.md now spells out three cases instead of one:

  • A. New public method on SuperDoc / DocumentApi / a UI handle: fixture must assert BOTH Parameters<> and ReturnType<>. With the search regression as the worked example for why both are needed.
  • B. New event in SuperDocEventMap or new Config.on* callback: fixture must assert the payload type; for SuperDoc-emitted events, also a runtime test that registers a handler and asserts the emitted shape. Names the type/runtime distinction explicitly so reviewers don't conflate them.
  • C. New public export from superdoc: the existing gate list, with one factual fix β€” verify-public-facade-emit.cjs no longer maintains an expectedNames allowlist (PR refactor(typecheck): derive facade expected names from source filesΒ #3476 made it parse facade source directly), so the "update the expectedNames array" sentence is wrong.

The PR-checklist item also generalized to point at all three cases instead of just exports.

What this does NOT do

  • Not a mechanical gate. This is a reviewer-facing rule that degrades silently if reviewers don't enforce it. The next step is a superdoc-public-fixture-coverage script that walks the SuperDoc class with the TS AST and fails CI when a public method has no Parameters<> / ReturnType<> reference in any fixture. Separate PR.
  • Not a runtime-payload test pass. That's a separate, larger piece of work focused on SuperDocEventMap events that SuperDoc emits directly (~9 events, ordered cheap β†’ expensive). Separate PR.

Stacked on #3479 (the .js β†’ .ts migration). The two are related but independent β€” this one is comments-only and has no code impact.

… and exports

The existing 'Adding a public API' section only covered new public
exports. It missed two cases the recent SuperDoc.search regression
exposed:

- New public method on an existing class: needs explicit
  Parameters<> and ReturnType<> fixtures. The search regression
  slipped past every existing gate because the return-type fixture
  was there but the parameter-type fixture was not.
- New event or Config callback: needs a typed-payload fixture
  AND a runtime test asserting the emitted shape. Types prove
  consumer usability; runtime tests prove the value the runtime
  actually emits. Different gates.

Also refreshes the stale 'verify-public-facade-emit.cjs ... update
the expectedNames array' wording. The expectedNames allowlist was
removed when the script started parsing facade source directly
(#3476). Adding a named export to the source file is now the only
action.

PR checklist item generalized to point at all three cases.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 25, 2026 00:23
Base automatically changed from caio-pizzol/SD-typecheck-superdoc-ts to main May 25, 2026 00:33
@caio-pizzol caio-pizzol merged commit 64f66b0 into main May 25, 2026
4 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-typecheck-contributing-checklist branch May 25, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant