Repository navigation
fix(plugin-sdk): strip undeclared __exportAll from published dts - #137012
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
ed6e121 to
5ab26de
Compare
|
ready for review — happy to iterate if anything looks off. |
Rolldown can mirror the JS __exportAll helper into shared .d.ts export lists without a matching declaration, so strict consumers of openclaw/plugin-sdk/tool-plugin fail with TS2304 (openclaw#136881). Sanitize staged declaration exports before publication, cover the published 2026.8.2 shape in tests, and fail plugin-sdk export checks when undeclared bundler helpers leak into dist.
Exercise skipLibCheck:false with the release-declared @types/ws so the packed Plugin SDK typescript smoke can catch undeclared __exportAll leakage that previously only failed under consumer-strict settings.
Keep the packed Plugin SDK smoke expectations aligned with skipLibCheck:false dependencies, and sanitize undeclared bundler helpers for every declaration extension staged for publication.
Use for-of and Array#toSorted so the undeclared __exportAll sanitizer passes scripts oxlint.
9509547 to
c7f687e
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 3, 2026, 3:01 AM ET / 07:01 UTC. ClawSweeper reviewWhat this changesThe PR removes undeclared bundler helper exports while staging Plugin SDK declaration files and makes the packed-package TypeScript smoke import the affected tool-plugin entrypoint with strict declaration checking. Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open. It targets the linked, reproducible published-package defect at the canonical declaration-staging boundary, and the earlier binding-preservation concern is covered by the current implementation and tests; however, the available evidence is still mock-only and does not show an after-fix strict compile against a tarball built from this head. Priority: P2 Review scores
Verification
How this fits togetherThe declaration build writes generated Plugin SDK type files into a staging area before they become the npm package consumed by external plugin projects. The release check then installs that packed package into a consumer project and compiles its public SDK imports. flowchart LR
A[Plugin SDK source] --> B[Generated declarations]
B --> C[Canonical declaration staging]
C --> D[Published npm package]
D --> E[Strict plugin TypeScript compile]
C --> F[Declaration leak check]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +118, Other +232. Total +350 across 9 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the repair in canonical declaration staging, then attach redacted after-fix evidence from a current-head packed tarball install showing the strict tool-plugin consumer compile succeeds. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the linked report supplies an exact released-package strict TypeScript scenario, and current main still copies raw declaration bytes at the affected staging boundary; this review did not execute the untrusted PR branch. Is this the best way to solve the issue? Unclear. Canonical declaration staging is the correct owner and the focused tests cover the reported and valid-binding shapes, but no current-head packed-artifact compile yet proves the transform is necessary and sufficient. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f5e6bd872c92. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
After staging publishes, sanitize the whole live dist declaration tree so main-tsdown hashed chunks cannot ship undeclared __exportAll. Document why the in-tree plugin-sdk consumer stays on skipLibCheck while packed smoke remains strict.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @leilei3167! Proof: strict packed TypeScript consumer imports
|
…7012) Closes #136881 ## Problem Strict external TypeScript consumers of `openclaw/plugin-sdk/tool-plugin` failed because the published declaration graph re-exported an undeclared bundler helper. ## Fix Normalize generated declaration imports and exports at the canonical declaration staging owner. Remove only mangled `__exportAll` helper aliases, preserve declared and directly imported bindings, and check every published declaration extension for leaks. The packed Plugin SDK smoke now imports `tool-plugin` with `strict: true` and `skipLibCheck: false`, using the release-declared TypeScript and `@types/ws` versions. The declaration staging owner also normalizes hashed root and extension declaration chunks that are outside the staged SDK subset. ## Verification - Current `main` red: the shipped `2026.8.2` package contains the undeclared helper export and the strict consumer reports `TS2304`. - Repaired head: 86 focused declaration-stage and release-check tests pass, and the generated package declaration replay removes all helper imports and exports. - Exact-head Blacksmith CI run `33726488515` passed. - The exact-head build artifact passed a packed strict consumer compile for `tool-plugin` with `skipLibCheck: false`, plus a second public SDK import. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit af9fdc8)
…nclaw#137012) Closes openclaw#136881 ## Problem Strict external TypeScript consumers of `openclaw/plugin-sdk/tool-plugin` failed because the published declaration graph re-exported an undeclared bundler helper. ## Fix Normalize generated declaration imports and exports at the canonical declaration staging owner. Remove only mangled `__exportAll` helper aliases, preserve declared and directly imported bindings, and check every published declaration extension for leaks. The packed Plugin SDK smoke now imports `tool-plugin` with `strict: true` and `skipLibCheck: false`, using the release-declared TypeScript and `@types/ws` versions. The declaration staging owner also normalizes hashed root and extension declaration chunks that are outside the staged SDK subset. ## Verification - Current `main` red: the shipped `2026.8.2` package contains the undeclared helper export and the strict consumer reports `TS2304`. - Repaired head: 86 focused declaration-stage and release-check tests pass, and the generated package declaration replay removes all helper imports and exports. - Exact-head Blacksmith CI run `33726488515` passed. - The exact-head build artifact passed a packed strict consumer compile for `tool-plugin` with `skipLibCheck: false`, plus a second public SDK import. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #136881
Problem
Strict external TypeScript consumers of
openclaw/plugin-sdk/tool-pluginfailed because the published declaration graph re-exported an undeclared bundler helper.Fix
Normalize generated declaration imports and exports at the canonical declaration staging owner. Remove only mangled
__exportAllhelper aliases, preserve declared and directly imported bindings, and check every published declaration extension for leaks.The packed Plugin SDK smoke now imports
tool-pluginwithstrict: trueandskipLibCheck: false, using the release-declared TypeScript and@types/wsversions. The declaration staging owner also normalizes hashed root and extension declaration chunks that are outside the staged SDK subset.Verification
mainred: the shipped2026.8.2package contains the undeclared helper export and the strict consumer reportsTS2304.33726488515passed.tool-pluginwithskipLibCheck: false, plus a second public SDK import.