Skip to content

fix(plugin-sdk): strip undeclared __exportAll from published dts - #137012

Merged
obviyus merged 12 commits into
openclaw:mainfrom
leilei3167:fix/tool-plugin-exportall-decl-136881
Sep 3, 2026
Merged

obviyus merged 12 commits into
openclaw:mainfrom
leilei3167:fix/tool-plugin-exportall-decl-136881

Conversation

@leilei3167

@leilei3167 leilei3167 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

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.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M labels Sep 3, 2026
@leilei3167
leilei3167 requested a review from a team as a code owner September 3, 2026 04:56
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 3, 2026
@leilei3167
leilei3167 force-pushed the fix/tool-plugin-exportall-decl-136881 branch from ed6e121 to 5ab26de Compare September 3, 2026 04:57
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 3, 2026
@leilei3167

Copy link
Copy Markdown
Contributor Author

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.
@leilei3167
leilei3167 force-pushed the fix/tool-plugin-exportall-decl-136881 branch from 9509547 to c7f687e Compare September 3, 2026 05:03
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 3, 2026, 3:01 AM ET / 07:01 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 8ed44433b1f1f84c53aaadbfe6f8efa23cd137a2

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and its prior binding concern is covered, but real packed-package behavior remains unproven.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The production owner is canonical declaration staging, whose output reaches the packed Plugin SDK consumer compile in scripts/release-check.ts:817 and scripts/release-check.ts:1049. The PR provides focused Vitest claims and source tests, but no recorded after-fix install and strict compile against a package built from this head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The production owner is canonical declaration staging, whose output reaches the packed Plugin SDK consumer compile in scripts/release-check.ts:817 and scripts/release-check.ts:1049. The PR provides focused Vitest claims and source tests, but no recorded after-fix install and strict compile against a package built from this head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Public package contract: The package exports openclaw/plugin-sdk/tool-plugin through dist/plugin-sdk/tool-plugin.d.ts, so the reported strict-consumer declaration failure is on a published SDK surface.
Canonical owner and caller: writeTsdownDeclarations invokes publishStagedDeclarations after unified declaration generation and before live dist publication; the PR changes that owner boundary.
Staged-output repair: The introduced code sanitizes generated declaration bytes before staging and also normalizes invocation-written staged declarations before dependency-closure validation and publication.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The production owner is canonical declaration staging, whose output reaches the packed Plugin SDK consumer compile in scripts/release-check.ts:817 and scripts/release-check.ts:1049. The PR provides focused Vitest claims and source tests, but no recorded after-fix install and strict compile against a package built from this head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The public Plugin SDK declaration transformation is compatibility-sensitive, and no available evidence shows a strict TypeScript compile against a tarball built from the current PR head.
  • Resolve merge risk (P1) - This bug fix adds 231 production-tooling lines and removes 2; its generic AST sanitizer and all-dist scan need built-package proof that they remove the leak without altering valid generated declarations.
  • Complete next step (P2) - Provide redacted after-fix proof of a strict TypeScript compile against a package built from the current PR head.
Agent review details

Security

None.

PR surface

Tests +118, Other +232. Total +350 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 119 1 +118
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 5 234 2 +232
Total 9 353 3 +350

Review metrics

Metric Value Why it matters
Production versus test delta production tooling +231/-2; tests/test support +122/-1 The fix substantially grows the package-publication path, so artifact-level proof should justify the added generic sanitizer.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #136881
Summary: This PR explicitly implements the linked report’s undeclared published declaration export failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Prove the packed declaration artifact (recommended)
    Build the current head into a package and record a redacted strict TypeScript consumer compile of the tool-plugin entrypoint before merge.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded repair for external Plugin SDK consumers whose strict typechecking currently fails.
  • merge-risk: 🚨 compatibility: The PR changes declaration bytes shipped through a public Plugin SDK entrypoint.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The production owner is canonical declaration staging, whose output reaches the packed Plugin SDK consumer compile in scripts/release-check.ts:817 and scripts/release-check.ts:1049. The PR provides focused Vitest claims and source tests, but no recorded after-fix install and strict compile against a package built from this head. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Public package contract: The package exports openclaw/plugin-sdk/tool-plugin through dist/plugin-sdk/tool-plugin.d.ts, so the reported strict-consumer declaration failure is on a published SDK surface. (package.json:1484, 8ed44433b1f1)
  • Canonical owner and caller: writeTsdownDeclarations invokes publishStagedDeclarations after unified declaration generation and before live dist publication; the PR changes that owner boundary. (scripts/lib/tsdown-declaration-writer.mts:173, 8ed44433b1f1)
  • Staged-output repair: The introduced code sanitizes generated declaration bytes before staging and also normalizes invocation-written staged declarations before dependency-closure validation and publication. (scripts/lib/declaration-stage.mts:81, 8ed44433b1f1)
  • Current-main comparison: Fetched main still copies declaration bytes unchanged at the staging boundary, so the proposed repair is not already present on current main. (scripts/lib/declaration-stage.mts:83, f5e6bd872c92)
  • Release-path consumer check: The release check installs the packed tarball, locates TypeScript, and runs a project compile; the PR extends that consumer fixture, but the PR body says the full packaging/release check was not run. (scripts/release-check.ts:817, 8ed44433b1f1)
  • Focused regression coverage: Tests cover the reported export shape, preserve a declared or directly imported helper, remove generated aliased helper imports, and assert staging behavior for all three declaration extensions. (test/scripts/sanitize-bundler-helper-dts-exports.test.ts:8, 8ed44433b1f1)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted output from a strict TypeScript compile against a tarball built at the current head; update the PR body so ClawSweeper can re-review automatically.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T05:11:31.618Z sha c7f687e :: needs real behavior proof before merge. :: [P2] Preserve imported helper bindings
  • reviewed 2026-09-03T06:38:57.120Z sha f76facf :: needs real behavior proof before merge. :: [P1] Preserve aliased import bindings

@obviyus

obviyus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 3, 2026
@obviyus
obviyus merged commit af9fdc8 into openclaw:main Sep 3, 2026
172 of 173 checks passed
@obviyus

obviyus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks @leilei3167!

Proof: strict packed TypeScript consumer imports openclaw/plugin-sdk/tool-plugin with strict: true and skipLibCheck: false; the final build artifact passed, and a second public SDK import also passed.

  • Bug: Published declarations re-exported an undeclared __exportAll bundler helper.
  • Fix: Declaration staging removes only generated helper aliases from staged and live declaration trees while preserving valid bindings.
Before After
Strict external consumer failed with TS2304. Strict packed consumer passed on the final head.

steipete pushed a commit that referenced this pull request Sep 3, 2026
…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)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: published tool-plugin declarations export undeclared __exportAll

2 participants