Repository navigation
refactor(plugin-sdk): narrow wildcard barrels to explicit used exports - #108440
Conversation
|
Rebased onto current main and hardened since the first CI round: the dead-files gate exposed that narrowing orphaned src/tools/* (descriptor tool-planning barrel) and src/agents/runtime/proxy.ts — both deleted with their tests (−2,300 LOC total; knip-verified, no prod importers). Autoreview P2 fixed (misplaced @deprecated JSDoc between SecretInput/OpenClawSchemaType). Fresh validation on tbx_01kxkqmjqkwm8j35a63acsgb2g (exit 0): pnpm build + [INEFFECTIVE_DYNAMIC_IMPORT] scan clean (earlier run tbx_01kxkjbbyp6dpqtny2yfywyzy7), src/agents + src/plugins + src/plugin-sdk + discord suites, full tsgo, check:test-types, check-deadcode-unused-files, check:changed. Known unrelated flake: src/agents/session-write-lock.test.ts stale-retry test failed once in-suite, passed 2x standalone (no diff vs main on that module); earlier clawhub stalled-body red was main's own test in the merge run. Final diff vs main: +1,042/−2,436. |
1030bae to
d585a77
Compare
dc05612 to
3902b1d
Compare
3902b1d to
3f26366
Compare
|
Landing refresh for exact head
|
openclaw#108440) * refactor(plugin-sdk): narrow wildcard barrels to explicit used exports * refactor(tools): delete dead tool-planning module exposed by barrel narrowing * fix(plugin-sdk): restore deprecation tag on OpenClawSchemaType alias * test(agents): drop test for deleted runtime proxy module * refactor(tools): trim descriptor types to cache consumers * refactor(deadcode): harvest exports orphaned by barrel narrowing * refactor(deadcode): harvest exports orphaned by barrel narrowing (rest) * fix(agents): restore sdk imports and test markers via public predicate * fix(plugin-sdk): named type re-exports in plugin-entry; trim types barrel precisely * chore(plugin-sdk): account unmasked deprecated provider types in budgets * fix(plugins): name star-only type rows for dts bundling * fix(plugins): restore host-hook surface; unexport internal api compositions * fix(plugins): named type imports for api composition; restore needed source exports * fix(plugins): knip-visible type imports for registry surfaces * test: adapt tests to privatized media and command internals * fix(qa-lab): re-export snapshot conversation type * style: format sessions sdk imports * fix(plugins): restore smoke entry export; pin budgets to exact actuals * fix(plugins): canonical smoke-entry import; drop orphaned root shims * fix(plugins): allowlist manifest probe, repoint qa web import, drop dead browser barrels * fix(plugin-sdk): pin codex auth marker and scaffold provider type * fix(qa-lab): keep web-facing model-selection shim within boundary rules * fix(plugin-sdk): preserve merged contracts through narrowed barrels * chore(plugin-sdk): pin post-rebase surface budgets
The 15 clean cherry-picks were written against a pre-resync tree, so applying without conflict did not mean applying correctly. Autoreview and the lanes found five real defects: - skill-forge distiller referenced processVsOutcomeSection out of scope and read candidate.processVsOutcome, which the pick never added (git dropped the detector.ts third of that commit while reporting success). Derive the rubric in the distiller instead: the detector would have to import the evaluator to carry it, and the evaluator already type-imports Candidate. - Delegation latency balancing returned a 0 penalty for unmeasured providers, so an unknown provider outranked every measured healthy one — the inverse of both its purpose and its own doc comment — and a provider that only ever errored was never demoted, since the early return skipped the error penalty. Return "no opinion" instead and let the stable sort keep priority order, and count errors even without latency samples. Adds the three tests the exported resetLatencyState hook implied but never had. - The tool audit store redacted args but persisted errorMessage verbatim and uncapped, so a secret stripped from args_summary re-entered through the error column. - Non-numeric --threshold became NaN, and every rate <= NaN is false, silently failing the judge audit instead of erroring. - The weight-optimization script carried two unused symbols (red tsgo:extensions). Also drops src/tools/index.ts rather than resurrecting it: upstream deleted that barrel in openclaw#108440 and the audit store is imported directly.
openclaw#108440) * refactor(plugin-sdk): narrow wildcard barrels to explicit used exports * refactor(tools): delete dead tool-planning module exposed by barrel narrowing * fix(plugin-sdk): restore deprecation tag on OpenClawSchemaType alias * test(agents): drop test for deleted runtime proxy module * refactor(tools): trim descriptor types to cache consumers * refactor(deadcode): harvest exports orphaned by barrel narrowing * refactor(deadcode): harvest exports orphaned by barrel narrowing (rest) * fix(agents): restore sdk imports and test markers via public predicate * fix(plugin-sdk): named type re-exports in plugin-entry; trim types barrel precisely * chore(plugin-sdk): account unmasked deprecated provider types in budgets * fix(plugins): name star-only type rows for dts bundling * fix(plugins): restore host-hook surface; unexport internal api compositions * fix(plugins): named type imports for api composition; restore needed source exports * fix(plugins): knip-visible type imports for registry surfaces * test: adapt tests to privatized media and command internals * fix(qa-lab): re-export snapshot conversation type * style: format sessions sdk imports * fix(plugins): restore smoke entry export; pin budgets to exact actuals * fix(plugins): canonical smoke-entry import; drop orphaned root shims * fix(plugins): allowlist manifest probe, repoint qa web import, drop dead browser barrels * fix(plugin-sdk): pin codex auth marker and scaffold provider type * fix(qa-lab): keep web-facing model-selection shim within boundary rules * fix(plugin-sdk): preserve merged contracts through narrowed barrels * chore(plugin-sdk): pin post-rebase surface budgets
What Problem This Solves
31 permanent (non-deprecated) public
openclaw/plugin-sdk/*entrypoints were wildcard barrels (export * from) that published 3,136 exports while external plugins used 5–70 symbols each. The bloat was self-inflicted: internal star re-exports and whole-module-object escapes pinned entire surfaces public. Every wildcard-published symbol is future API contract we owe for nothing.Why This Change Was Made
Round-5 contract-reduction ("do both" maintainer directive). Method per entrypoint, evidence-first: fresh AST-level usage extraction (77-package external corpus + all internal src/extensions/packages importers + symbols referenced in docs) → replace each wildcard with explicit
export { … } fromlists of exactly the used union → pin the 36 fragile symbols that externals reach through deep wildcard chains as deliberate direct re-exports → remove internal public-SDK star re-exports (qa-channel/qa-lab protocol barrels, agents runtime index, three packages/plugin-sdk mirrors).Numbers: the 31 converted entrypoints drop 3,136 → 748 exports. Public SDK total 10,612 → 7,919 exports (callable 5,344 → 4,426); wildcard re-exports 209 → 106; deprecated-barrel list 13 → 6. Every corpus-imported symbol keeps its specifier and value/type kind — verified zero missing, zero kind drift. Unused security-runtime helper implementations are kept (un-exported) in an internal module; deleting newly-dead internals is follow-up work once they've been un-exported for a window.
User Impact
None observed-breaking: all externally-imported symbols (including larksuite's enumerated namespace members) remain exported unchanged. The public contract shrinks by ~2,700 exports; barrels become explicit, reviewable lists — adding to the public surface is now a deliberate diff line, not a side effect of exporting from an internal module.
Evidence
tbx_01kxkjbbyp6dpqtny2yfywyzy7, exit 0, 28 min): fullpnpm buildtwice with[INEFFECTIVE_DYNAMIC_IMPORT]scan (module graph changed for all 31 entrypoints — none found),pnpm test src/plugins src/plugin-sdk extensions/discord extensions/openai, fullpnpm tsgo,pnpm check:test-types,pnpm check:changed(incl. deprecation-hygiene lanes, surface budgets, API baseline).