fix(platform-api-docs): prefer source over build output when deduplicating - #10085
fix(platform-api-docs): prefer source over build output when deduplicating#10085cryptodev-2s wants to merge 2 commits into
Conversation
8236f2a to
0b32e92
Compare
|
@mcmire In case you have missed to look at this ? |
|
@cryptodev-2s Ah sorry I did miss this, I haven't reviewed this yet. I will review this shortly. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b32e92. Configure here.
| patterns.push(`${root}/*/dist/**/*.d.cts`); | ||
| } | ||
|
|
||
| const sourceFiles = addSourceFiles(project, patterns); |
There was a problem hiding this comment.
Merged globs drop declaration files
Medium Severity
Collecting scan-dir, package, and node_modules globs into one addSourceFiles call lets source-tree dist and node_modules exclusions apply to published .d.cts files. A scan directory that is an ancestor of those declaration files drops them, so capabilities from published packages vanish from the docs.
Reviewed by Cursor Bugbot for commit 0b32e92. Configure here.
There was a problem hiding this comment.
This seems like a fair point, but is this an intentional change?
Are the changes to the way that source files are collected necessary to fix the bug with deduplicationScore mentioned in the PR description?


Explanation
A capability declared in a package's source is also visible in the
distbuilt from it, and a cross-package import resolves to thatdistrather than to the sibling's source. Whichever was reached first won, so 83 of 1164 source links pointed at.d.ctsbuild output instead of code you can read and edit.Deduplication now scores source above build output, so the outcome no longer depends on traversal order. All 1164 links point at source, and namespace, action and event counts are unchanged.
Both clients generate byte-identical docs, since they only ever see published packages and score every candidate the same way.
References
Checklist
Note
Low Risk
Changes only affect generated documentation links and dedup tie-breaking in the docs generator, with no runtime product or security impact.
Overview
Generated platform API docs were often linking messenger capabilities to
node_modules/.../dist/*.d.ctsinstead of the editablepackages/*/srcdeclaration, because cross-package imports resolve to build output and whichever duplicate was seen first won during deduplication.Deduplication scoring now adds a
sourceScorethat favors paths outside/dist/, so when the sametypeStringappears in both source and compiled declarations, the source file wins regardless of scan order. JSDoc and “home package” preferences are unchanged.scanSourcescollects all scan globs into one pattern list before a singleaddSourceFilescall (same bulk-load behavior, slightly cleaner structure). A regression test reproduces the monorepoa-controller→@metamask/b-controllerdist ordering case; the changelog records the fix under Fixed.Reviewed by Cursor Bugbot for commit 0b32e92. Bugbot is set up for automated code reviews on this repo. Configure here.