fix: unblock plugin-sdk channel runtime context dts build#64972
fix: unblock plugin-sdk channel runtime context dts build#64972100yenadmin wants to merge 0 commit into
Conversation
Greptile SummaryFixes the Confidence Score: 5/5Safe to merge — the inline type matches the canonical definition exactly and value exports are untouched. The only finding is a P2 style suggestion about adding a compile-time drift guard; there are no correctness, data-integrity, or runtime issues introduced by this narrow fix. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/plugin-sdk/channel-runtime-context.ts
Line: 7-11
Comment:
**Type drift risk from manual duplication**
The inline definition is currently byte-for-byte identical to `ChannelRuntimeContextKey` in `src/channels/plugins/channel-runtime-surface.types.ts`, but there's no enforcement keeping them in sync. If `accountId` is tightened, `capability` is narrowed, or a new required field is added to the canonical type, plugin authors will continue to compile against the stale plugin-sdk shape while the infra functions internally accept the updated type — leading to a structural mismatch that TypeScript's duck-typing may not immediately surface.
Consider adding a compile-time assertion near this definition to catch drift early:
```typescript
import type { ChannelRuntimeContextKey as _CanonicalKey } from "../channels/plugins/channel-runtime-surface.types.js";
// Ensure the plugin-sdk shape stays structurally compatible with the internal canonical type.
type _AssertCompat = _CanonicalKey extends ChannelRuntimeContextKey ? ChannelRuntimeContextKey extends _CanonicalKey ? true : never : never;
```
This is a pure type-level check (erased at emit) and wouldn't reintroduce the broken re-export path that triggered the DTS failure.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix: stabilize plugin sdk channel runtim..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Fixes the plugin-sdk/channel-runtime-context declaration (.d.ts) build break by keeping the runtime exports forwarded while defining the ChannelRuntimeContextKey type locally in the plugin-sdk surface, avoiding the failing type re-export.
Changes:
- Stop re-exporting
ChannelRuntimeContextKeyfrom../infra/channel-runtime-context.js. - Define
ChannelRuntimeContextKeydirectly insrc/plugin-sdk/channel-runtime-context.tswhile continuing to forward runtime-context value exports.
|
Current head What changed on top of the original unblock:
Local validation passed:
This remains intentionally narrow shared-CI/typecheck cleanup, not parity logic or runtime-slice scope. |
|
Confirmed on |
b4bcc34 to
bd122aa
Compare
|
Current head Latest local validation:
This head now includes:
The remaining local |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd122aaabe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| type _AssertChannelRuntimeContextKeyCompat = | ||
| CanonicalChannelRuntimeContextKey extends ChannelRuntimeContextKey | ||
| ? ChannelRuntimeContextKey extends CanonicalChannelRuntimeContextKey | ||
| ? true | ||
| : never | ||
| : never; |
There was a problem hiding this comment.
Make compatibility check fail when key types diverge
The _AssertChannelRuntimeContextKeyCompat alias does not actually enforce compatibility: if either extends check fails, the alias simply becomes never, which TypeScript accepts without an error. That means ChannelRuntimeContextKey can silently drift from the canonical key type in channel-runtime-surface.types.ts, and plugin-sdk consumers could compile against a stale contract until runtime behavior diverges. Use an assertion pattern that must resolve to true (for example via a constrained generic or value assignment) so mismatches fail the build.
Useful? React with 👍 / 👎.
bd122aa to
65267c1
Compare
Summary
plugin-sdk/channel-runtime-contextdeclaration build break now reproducing on currentmainWhat changed
src/plugin-sdk/channel-runtime-context.tsChannelRuntimeContextKeyshape directly in the plugin-sdk surface instead of relying on the failing type re-export pathValidation
pnpm exec tsc -p tsconfig.plugin-sdk.dts.json --pretty falseCI=1 pnpm exec vitest run src/infra/channel-runtime-context.test.tspnpm buildScope
This is a narrow shared unblock PR only. It does not change strict-agentic behavior, parity scenarios, docs workflow behavior, or provider mock logic.