feat(types): add declaration reachability report (SD-2952 step 3)#3167
Merged
caio-pizzol merged 1 commit intomainfrom May 5, 2026
Merged
feat(types): add declaration reachability report (SD-2952 step 3)#3167caio-pizzol merged 1 commit intomainfrom
caio-pizzol merged 1 commit intomainfrom
Conversation
e434a8b to
ae23702
Compare
Walks the public type graph from every typed package.json exports
target and counts how many emitted .d.ts files are reachable from a
consumer's TypeScript. The output is data for the SD-2952 trim slice
(step 4); not a CI gate per the SD-2952 acceptance.
Initial measurement on the post-SD-2953 dist:
Reachable declarations: 442 / 2012 (22.0%) from 11 typed exports
document-api 132 / 140 (94.3%) - reach-driven emit, healthy
layout-engine 71 / 137 (51.8%) - moderate
shared 0 / 3 (0.0%) - tsc-postbuild emit reachable
only via currently-unreachable
CommentsLayer/types.d.ts
super-editor 221 / 1642 (13.5%) - 1421 unreachable, primary
trim target for step 4
superdoc 18 / 90 (20.0%) - 72 internal helpers shipping
to no consumer benefit
Walker resolves relative imports + self-package `superdoc/<subpath>`
via the package's exports map. External package specifiers (vue,
prosemirror-*, @tiptap/*) are ignored - they don't live in dist.
Private workspace specifiers (@superdoc/*) are ignored too; any
surviving one is already a build failure via audit Rule 1.
Script is a sibling to audit-declarations.cjs (gate) - this one is
metric-only. Wired into postbuild after check-export-coverage.cjs.
Failure semantics: exit 1 on missing dist, malformed package.json,
unreadable type entry, or unreadable .d.ts files. Never exits non-
zero on a low ratio.
Verified end-to-end: clean run prints metrics + bucket breakdown;
synthetic missing-dist exits 1; synthetic malformed `types` target
exits 1; matrix stays 53/0/0.
a2ccaf0 to
b7ca7c6
Compare
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.60 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0-next.104 |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.102 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-cli v0.8.0-next.76 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc v1.30.0-next.59 The release is available on GitHub release |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.59 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3165. SD-2952 step 3: instrument the dist with reachability data so we can decide which emitted declarations to trim in step 4.
Walks the public type graph from every typed
package.jsonexports target (10 entries plus the converter/docx-zipper/file-zipper additions from #3165) and counts how many emitted.d.tsfiles are reachable from a consumer's TypeScript. Metric only - no CI gate on the ratio, per SD-2952's explicit guidance.Initial measurement on the post-SD-2953 dist:
The 13.5% on super-editor is where step 4 (trim) should focus. The 0/3 on shared is informative about a dead-weight chain (CommentsLayer/types.d.ts holds the bare
@superdoc/commonreference that triggers the comments-types emit, but CommentsLayer/types.d.ts itself isn't on the public surface).Script semantics:
superdoc/<subpath>via the package's exports map@superdoc/*) ignored too; any surviving one is already a build failure via audit Rule 1audit-declarations.cjs(gate) - this one is metric-onlycheck-export-coverage.cjsFailure semantics: exit 1 on missing dist, malformed
package.json, unreadable type entry, or unreadable .d.ts. Never exits non-zero on a low ratio.Verified:
typestarget → exit 1