Skip to content

fix(plugin-sdk): emit revision declarations with their own compiler - #181908

Merged
RomneyDa merged 6 commits into
mainfrom
tideclaw/rri-551-plugin-sdk-shipped-surface
Oct 24, 2026
Merged

RomneyDa merged 6 commits into
mainfrom
tideclaw/rri-551-plugin-sdk-shipped-surface

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Problem

pnpm release:candidate on trusted main tooling (1fead915921e, TypeScript 7.1.0-dev.20261016.1) runs pnpm plugin-sdk:api:diff against the published bases. Rendering v2026.10.6 (fe06181dc5ec, TypeScript 7.1.0-dev.20260922.1) failed with TS5088 ("inferred type ... references a type with a cyclic structure") in src/plugins/plugin-instance-owned-values.ts, src/plugins/runtime/execution-frame.ts, and src/plugins/plugin-instance-scope.ts.

Root cause: the declaration-emission subprocess never got a compiler selection. It emitted every revision's declarations with the trusted tooling's newer compiler, which rejects declarations the shipped release accepted. The emitter's existing compilerRoot path had a second problem: it launched the root's tsgo binary but kept the trusted typescript/async client. That mixes two releases' protocol and filesystem contracts (the API moved from unstable/* to stable subpaths between these previews).

The earlier version of this PR used a Node resolve hook to map typescript/* to the revision package. That broke on 20260922 because the package has no ./async export. It also broke historical TypeScript 6 tags, copied a linux-x64-only fixture, and was missing from compiled worker artifacts (checks-node-compact-small-1 ERR_MODULE_NOT_FOUND). All of that is removed.

Solution

  • compileNativeProject owns compiler selection. With a compilerRoot, it loads that root's TypeScript package as a set: the executable, the ./async API client (or ./unstable/async on earlier previews), and that client's own serverFS.fakeStat sentinel. It imports the client through its realpath, so a linked package keeps a single module instance.
  • If a root has no TypeScript, or has TypeScript 6 with no native API, it keeps the installed trusted compiler. This preserves the strategy used for historical TS6 tags (refactor(plugin-sdk): replace API baselines with diffs #123036, v2026.8.1-beta.1).
  • The declaration subprocess request carries compilerRoot. renderPluginSdkApiRoot passes the rendered root, so each revision's declarations come from its own locked compiler. The renderer code itself (api-baseline, api-diff, the worker script) stays trusted tooling code.
  • Declares the emitter's computed API import (compilerModuleUrl) in tsdown-declaration-generator-inputs.mts. Its targets are the installed package manifest plus its ./async and ./fs exports, so declaration build caches still key on them.
  • Refreshes scripts/lib/plugin-sdk-shipped-surface.json to v2026.10.6. Regenerating with this fix via pnpm plugin-sdk:shipped-surface:gen -- --release v2026.10.6 reproduces it byte-for-byte (151 typed subpaths, 3,645 named exports).

ClawSweeper findings: (1) the compiler selection, including the API module, now reaches the subprocess. (2) TS6 and roots without TypeScript fall back to the trusted compiler. (3) and (4) no longer apply because the fixture copying and the loader file are gone.

Evidence

The real release command, run from this branch, succeeds:

pnpm plugin-sdk:api:diff -- --head 157d8c2bc3ea2fa183afdc11088e69690bf8e64e \
  --bases-json '{"beta":"v2026.10.10-beta.3","latest":"v2026.10.6"}' --evidence E --json J --summary S
  • All three revisions rendered: fe06181, 15dffe5, and 157d8c2. Exit 0, about 8.7 min wall.
  • beta: v2026.10.10-beta.3 → 157d8c2bc3ea: API changes reported, acknowledgement digest dd1b7efd.
  • latest: v2026.10.6 → 157d8c2bc3ea: 206 affected exports (35 reachable declaration changes), acknowledgement digest 7cb70969.
  • On unfixed main tooling 1fead915921e, the same command fails rendering fe06181 with the TS5088 errors above.
  • TS6 historical tag: pnpm plugin-sdk:api:diff -- --base v2026.8.1-beta.1 --head 157d8c2bc3ea... exits 0. The base renders through the trusted-compiler fallback and the head through its own compiler. Digest e16729b0.

The new regression test loads the compiler root's own pre-stable native API fails on main's emitter and passes here.

Targeted tests, pnpm test <file> --maxWorkers=1, local wall time:

File Result Wall
test/scripts/native-declaration-subprocess.test.ts 3 passed 3s
test/scripts/native-declaration-boundary.test.ts 11 passed, 3 skipped 8s
test/scripts/extension-boundary-cache.test.ts 1 passed 3s
src/plugin-sdk/api-baseline.test.ts 20 passed 16s
test/scripts/plugin-sdk-api-diff.test.ts 11 passed 29s
test/scripts/build-all.test.ts 61 passed 41s
test/scripts/write-unified-entry-dts.test.ts 11 passed 26s

The two new tests add about 0.5s of CI time. A local pnpm build passes (3m12s).

node scripts/check-changed.mjs passes typecheck (core, scripts, tests), lint, and guards. The only failure is the dead-export scan, which reports unused exports in untouched files (scripts/control-ui-parity/scenarios.ts, extensions/github/src/targets.ts, and others). That scan already fails on main.

Closes RRI-551.

@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Oct 23, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR emits revision declarations with that revision’s compiler and API client, preserves the historical compiler fallback, and refreshes the shipped SDK inventory.

Example: Compare v2026.10.6 with candidate 157d8c2 using plugin-sdk:api:diff.

  • Before: Trusted tooling’s newer TypeScript compiler rejects the released revision with TS5088.
  • After: The released revision uses its locked compiler, and the reported comparison completes with an API-change digest.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Documented CLI results cover the reported failure and historical fallback; the focused implementation resolves the previous findings and passes exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR records real plugin-sdk:api:diff runs using the changed emitter against v2026.10.6, the beta base, and a historical TS6 tag, with successful render results and comparison digests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Release operators cannot compare the shipped SDK when newer tooling rejects declarations accepted by the released compiler.
Reason: The maintainer-authored direction restores an existing release workflow and preserves historical revision support.

Merge readiness

✅ Ready for maintainer review

This PR fixes a release-tooling failure still present on main. The earlier findings are resolved, exact-head CI passes, and no actionable defect remains in the reviewed diff.

Priority: P2
Reviewed head: 1fa2dfd10d61810fd767297f2d6d00f4bf8bd3cc

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin SDK comparison tooling renders declarations from frozen repository revisions and turns their public signatures into release-review reports.

flowchart TD
  A[SDK comparison CLI] --> B[Frozen revision checkout]
  B --> C[Trusted SDK renderer]
  C --> D[Declaration subprocess]
  D --> E[Revision compiler and API client]
  E --> F[Declaration output]
  F --> G[SDK difference report]
Loading

Technical review

Best possible solution:

Keep compiler selection in the existing emitter, pairing each native executable with its own client while retaining the historical fallback.

Do we have a high-confidence way to reproduce the issue?

The reported TS5088 failure on v2026.10.6 matches main’s emission path, which omits revision compiler selection; this review verified that path in source.

Is this the best way to solve the issue?

The patch repairs the existing compiler owner and subprocess contract without adding a parallel renderer or changing the public SDK.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0a9d5cc49d91.

Provenance checked

  • Native compiler selection and in-memory emission changes intended behavior with a stated reason (c8eab36: The compiler migration established checkout-local native compiler selection; subsequent nested-checkout work retained bounded in-memory emission.)
  • Declaration subprocess lifecycle keeps the original intent (7b9615f: Failed emission must drain the native compiler before reporting failure; forwarding compilerRoot preserves that lifecycle.)
  • Declaration generator inputs keeps the original intent (4015f0b: Cache identity follows executable generator inputs, including explicitly owned computed imports.)
  • Historical SDK rendering keeps the original intent (d2afbd0: Trusted current tooling renders historical revisions without requiring scripts from those revisions.)
  • Shipped SDK inventory keeps the original intent (d0426cd: Stable closeout records the shipped public surface so later changes cannot silently authorize its removal.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Compiler selection reaches the production owner: The SDK renderer supplies compilerRoot, the subprocess validates and forwards it, and the emitter selects the executable, API client, and filesystem sentinel together. (src/plugin-sdk/api-baseline.ts:148, 1fa2dfd10d61)
  • Historical rendering remains supported: The emitter recognizes stable and pre-stable native API exports and retains the installed compiler when the revision has no native API. (scripts/lib/native-declaration-emitter.mts:74, 1fa2dfd10d61)
  • Real CLI results supplied: The full PR body reports successful comparisons against v2026.10.6 and v2026.10.10-beta.3, reproduces the original TS5088 failure with unfixed tooling, and records a successful v2026.8.1-beta.1 fallback comparison. (1fa2dfd10d61)
  • Exact-head CI passes: The CI gate, artifact builds, changed-boundary tests, compiled compact tests, types, lint, dependency review, and security-sensitive review pass. The cancelled check is ClawSweeper Dispatch, not a failed product check. (1fa2dfd10d61)
  • Trusted-renderer contract preserved: The design recorded in refactor(plugin-sdk): replace API baselines with diffs #123036 uses trusted tooling to render historical revisions; this patch keeps the renderer and comparison code in that owner. (scripts/plugin-sdk-api-diff.mts:206, 1fa2dfd10d61)
  • Inventory refresh follows release policy: The release guide requires regenerating the shipped SDK inventory after stable releases; the diff changes only its release and commit identifiers, preserving its export inventory. Public docs: docs/reference/RELEASING.md. (docs/reference/RELEASING.md:347, 1fa2dfd10d61)

Likely related people:

  • Peter Steinberger: Raw commit c8eab36 adds src/plugin-sdk/api-baseline.ts:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c8eab360206b; files: src/plugin-sdk/api-baseline.ts)
  • Vincent Koc: Raw commit 4e1447e adds scripts/lib/tsdown-declaration-generator-inputs.mts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4e1447e18665; files: scripts/lib/tsdown-declaration-generator-inputs.mts)

PR surface

Source +3, Tests +48, Other +98. Total +149 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 0 +3
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 114 16 +98
Total 6 165 16 +149

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The failure blocks SDK comparisons in release preparation, with limited impact outside maintainer tooling.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-23T20:41:38.822Z sha cec4b5b :: needs real behavior proof before merge. :: [P1] Keep the release candidate from supplying its own verified surface | [P2] Remove the newly unused repoRoot parameter
  • reviewed 2026-10-24T01:56:24.434Z sha ba26e91 :: needs changes before merge. :: [P2] Carry revision compiler selection into declaration emission | [P2] Preserve rendering for historical TypeScript 6 revisions | [P2] Copy the compiler package for the fixture's actual platform
  • reviewed 2026-10-24T02:02:43.312Z sha ba26e91 :: needs changes before merge. :: [P2] Carry revision compiler selection into declaration emission | [P2] Preserve rendering for historical TypeScript 6 revisions | [P2] Copy the compiler package for the fixture's actual platform | [P2] Include the revision loader in compiled worker artifacts
  • reviewed 2026-10-24T02:09:00.416Z sha ba26e91 :: needs changes before merge. :: [P2] Carry revision compiler selection into declaration emission | [P2] Preserve rendering for historical TypeScript 6 revisions | [P2] Copy the compiler package for the fixture's actual platform | [P2] Include the revision loader in compiled worker artifacts

Reviewed October 24, 2026, 2:33 AM ET / 06:33 UTC (Revision 5).

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa
RomneyDa force-pushed the tideclaw/rri-551-plugin-sdk-shipped-surface branch from ba26e91 to c3c2a16 Compare October 24, 2026 06:02
@RomneyDa RomneyDa changed the title fix(plugin-sdk): render shipped surfaces with revision tooling fix(plugin-sdk): emit revision declarations with their own compiler Oct 24, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 24, 2026
@RomneyDa
RomneyDa merged commit 17a8d22 into main Oct 24, 2026
143 of 144 checks passed
@RomneyDa
RomneyDa deleted the tideclaw/rri-551-plugin-sdk-shipped-surface branch October 24, 2026 06:36
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…penclaw#181908)

* fix(plugin-sdk): render shipped surfaces with revision tooling

Co-authored-by: RomneyDa <[email protected]>

* fix(plugin-sdk): drop stale renderer argument

Co-authored-by: RomneyDa <[email protected]>

* fix(release): keep SDK renderer trusted

Co-authored-by: RomneyDa <[email protected]>

* fix(release): render SDK revisions with Node under Bun

Co-authored-by: RomneyDa <[email protected]>

* fix(plugin-sdk): emit revision declarations with their own compiler

* fix(build): declare the emitter's compiler API edge as a declaration input

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants