Skip to content

fix(typecheck): one wrapper for SuperDoc public surface across CI lanes#3471

Merged
caio-pizzol merged 2 commits into
mainfrom
caio-pizzol/SD-typecheck-wrapper-and-ci
May 23, 2026
Merged

fix(typecheck): one wrapper for SuperDoc public surface across CI lanes#3471
caio-pizzol merged 2 commits into
mainfrom
caio-pizzol/SD-typecheck-wrapper-and-ci

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

PR 2 of the type-checking organization plan. Folds the three duplicated CI step lists into one wrapper command, and inverts the alias direction so canonical names directly invoke implementations. Builds on #3469 (now merged).

What changed

scripts/check-public-contract.mjs — wrapper extension

Adds three stages so check:public:superdoc covers everything the SuperDoc public surface needs:

# Stage Was running where?
1 build:superdoc wrapper (existing)
2 typecheck-matrix wrapper (existing)
3 deep-type-audit --strict-supported-root wrapper (existing)
4 package-shape-gate separate CI step (all 3 lanes)
5 snapshot --all --check separate CI step (all 3 lanes)
6 check-root-classification-closure separate CI step (all 3 lanes)

Ordering matters: stage 2 packs superdoc.tgz and installs it into the consumer fixture. Stages 3, 5, and 6 read from the installed fixture; stage 4 reads the tarball directly. Both inputs are produced by stage 2, so it always runs first.

Three CI lanes switched to the wrapper

Workflow Lines removed New step
ci-superdoc.yml 3 separate steps dropped pnpm check:public:superdoc --skip-build
release-superdoc.yml 5 separate steps dropped same
release-stable.yml 5 separate steps dropped same

Net ~110 lines removed across workflows. Any future change to the SuperDoc validation chain (new stage, reorder, rename) lands in one place and propagates to every lane automatically.

Alias direction inverted

Per the agreed migration plan: canonical names now directly invoke the real implementations; legacy names delegate.

Canonical (now real impl) Legacy (now alias)
check:typestsc -b tsconfig.references.json type-checkpnpm run check:types
check:public:superdocnode scripts/check-public-contract.mjs check:public-contractpnpm run check:public:superdoc
check:public:docapi → 4 docapi check commands docapi:checkpnpm run check:public:docapi
generate:docapitsx generate-contract-outputs.ts docapi:syncpnpm run generate:docapi
report:public:superdocnode scripts/report-public-contract.mjs report:public-contractpnpm run report:public:superdoc

The new names are now in the hot path (no extra alias hop), and --skip-build / other arg forwarding works through both name systems.

Doc updates

  • AGENTS.md: enumerated all 6 stages on the check:public:superdoc line; legacy alias tagged on each canonical command.
  • packages/superdoc/scripts/README.md: dropped the "tracked separately" caveat for the package-shape/snapshots/closure folding (now done); rewrote "CI vs local" to say all three workflows call the wrapper; clarified that package-shape-gate reads the tarball while the other downstream stages read the installed fixture.

Verified

  • pnpm check:public:superdoc (canonical, full build) → PASS 6 stages, 144.2s
  • pnpm check:public:superdoc --skip-build → PASS 5 ran / 1 skipped, 111.9s
  • pnpm check:public-contract --skip-build (legacy, one hop) → reaches SKIP branch
  • pnpm run check:types (canonical) → tsc clean
  • pnpm run type-check (legacy alias) → tsc clean
  • pnpm run report:public:superdoc (canonical) → tier report
  • pnpm run report:public-contract (legacy alias) → tier report

Extends check:public:superdoc (the wrapper script) to subsume the
package-shape, snapshots, and classification-closure steps that
ci-superdoc.yml, release-superdoc.yml, and release-stable.yml each ran
separately. Adds two stages so all three lanes call a single command.

scripts/check-public-contract.mjs:
- Adds stages 4-6: package-shape-gate, snapshot --all --check,
  check-root-classification-closure. All three reuse the
  packed-and-installed fixture produced by stage 2 (typecheck-matrix),
  so ordering matters: matrix produces the install, the rest reuse it.
- Updated header docstring to enumerate all six stages and explain why
  the post-install gates are grouped here.

.github/workflows/:
- ci-superdoc.yml: drop 3 duplicated steps (package-shape, snapshots,
  closure); the wrapper now covers them. Single step
  `pnpm check:public:superdoc --skip-build`.
- release-superdoc.yml: drop 5 separate steps (matrix, audit,
  package-shape, snapshots, closure); replace with the same single
  wrapper call.
- release-stable.yml: same replacement as release-superdoc.yml.

Net: ~110 lines removed across the three workflows, ~30 added in the
wrapper. A change to the validation chain (new stage, reorder, rename)
now lands in one place and propagates to every lane automatically.

package.json (alias inversion):
- Canonical names now point at the real implementations:
    check:types           -> tsc -b tsconfig.references.json
    check:public:superdoc -> node scripts/check-public-contract.mjs
    check:public:docapi   -> the four docapi check commands
    generate:docapi       -> tsx generate-contract-outputs.ts
    report:public:superdoc -> node scripts/report-public-contract.mjs
- Legacy names delegate to canonical:
    type-check               -> pnpm run check:types
    check:public-contract    -> pnpm run check:public:superdoc
    docapi:check             -> pnpm run check:public:docapi
    docapi:sync              -> pnpm run generate:docapi
    docapi:sync:check        -> generate:docapi && check:public:docapi
    report:public-contract   -> pnpm run report:public:superdoc

  This makes the new names actually canonical (no extra alias hop in
  the hot path) and keeps --skip-build / other args forwarding
  cleanly through both name systems. Verified both
  `pnpm check:public:superdoc --skip-build` and
  `pnpm check:public-contract --skip-build` reach the SKIP branch in
  the wrapper.

AGENTS.md + packages/superdoc/scripts/README.md:
- Reflect that check:public:superdoc now runs all six stages.
- Reflect that all three workflows call the wrapper directly.
- Drop "tracked separately" caveat for the package-shape / snapshots /
  closure folding; that's now done.
- Tag legacy aliases on each canonical command line so contributors
  who know the old name can find the new one.

Verified:
- pnpm check:public:superdoc (canonical) -> PASS 6 stages, 144.2s
- pnpm check:public:superdoc --skip-build -> SKIP branch reached
- pnpm check:public-contract --skip-build (legacy) -> same SKIP path
- pnpm run check:types -> tsc clean
- pnpm run type-check (legacy alias) -> tsc clean
- pnpm run report:public:superdoc -> tier report (canonical)
- pnpm run report:public-contract -> tier report (legacy alias)
…k-wrapper PR-2)

Review-feedback wording correction. The previous text said "stages 3-6
reuse the install produced by typecheck-matrix" but that conflated two
distinct inputs:

- deep-type-audit, snapshot, and check-root-classification-closure
  read from the consumer fixture's node_modules/superdoc/ (installed
  via the tarball).
- package-shape-gate reads the tarball directly
  (packages/superdoc/superdoc.tgz), not the installed fixture.

Updated the script's header docstring and the package-shape-gate
stage blurb to call out the distinction. Updated the matching
paragraph in packages/superdoc/scripts/README.md. No behavior change.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 23, 2026 22:20
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@caio-pizzol caio-pizzol merged commit 5a82373 into main May 23, 2026
74 checks passed
@caio-pizzol caio-pizzol deleted the caio-pizzol/SD-typecheck-wrapper-and-ci branch May 23, 2026 22:42
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.

2 participants