Skip to content

Commit 7eb7412

Browse files
authored
docs(contributing): name the public-API type-test rule (SD-2862) (#3042)
The auto-derive script (SD-2860) and the subpath matrix (SD-2861) are now the regression net for public exports, but the rule that PRs adding public exports must keep them green was implicit. Make it explicit in CONTRIBUTING.md so contributors know which gates apply and how to run them, and add a checkbox to the "Before Submitting" list. The enforcement is unchanged; this is the documentation that names it.
1 parent 56632f5 commit 7eb7412

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,17 @@ pnpm run format # Run Prettier
226226

227227
## Pull Request Process
228228

229+
### Adding a public API
230+
231+
If your PR adds a new public export from `superdoc` (a new `@typedef` in `packages/superdoc/src/index.js`, a new value re-exported from a public subpath, or a new subpath in `package.json` `exports`), it must ship with a type test that exercises the new surface under strict mode.
232+
233+
The consumer matrix at `tests/consumer-typecheck/` is the regression net. Two automated checks enforce this on every PR:
234+
235+
- **`check-public-types.mjs`** -- the assertion list in `tests/consumer-typecheck/src/all-public-types.ts` is auto-derived from the `@typedef` block in `packages/superdoc/src/index.js`. Adding a new typedef without regenerating the list fails CI. Run `npm run check:types:write` from inside `tests/consumer-typecheck/` (or `node tests/consumer-typecheck/check-public-types.mjs --write` from the repo root) and commit the regenerated file.
236+
- **`typecheck-matrix.mjs`** -- every typed public subpath in the RFC inventory has at least one matrix scenario. If you add a new subpath, add a fixture under `tests/consumer-typecheck/src/` and a corresponding entry in the matrix, and update the inventory in `docs/architecture/package-boundaries.md`.
237+
238+
The point of these gates is to keep customer TypeScript builds working. A new export that ships without a type test can collapse to `any` (or fail to resolve) for consumers without the team noticing.
239+
229240
### Branch Naming
230241

231242
- `feature/description` for new features
@@ -273,6 +284,7 @@ When you open a PR, the following checks run automatically:
273284
- [ ] Code is formatted (`pnpm run format:check`)
274285
- [ ] Commit messages follow conventional commits
275286
- [ ] PR description links to related issue
287+
- [ ] If you added a public API, the consumer-typecheck gates pass (see [Adding a public API](#adding-a-public-api))
276288

277289
## Release Process
278290

0 commit comments

Comments
 (0)