fix(plugins): add isCore field to plugin data and deduplicate jobs in useJobFeedStream#100
Conversation
… useJobFeedStream - Updated useJobFeedStream to prevent duplicate job entries by filtering existing jobs based on their ID before adding new ones. - Added isCore field to DiscoveredPlugin interface and updated the discoverPlugins function to include this field from the plugin manifest. - Modified toPluginPackageData function to set isCore based on the plugin data, ensuring accurate representation of core plugins. This improves job management in the job feed stream and enhances plugin metadata handling.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughAdds an Changes
Sequence Diagram(s)sequenceDiagram
participant Startup as Start Script
participant FS as Repo (plugins/*)
participant Sync as sync-plugin-registry.ts
participant DB as Database (Prisma)
participant Logs as logs/sync-plugins.log
Startup->>Sync: invoke sync-plugin-registry.ts (Step 5)
Sync->>FS: read plugins/*/plugin.json
FS-->>Sync: return discovered plugin manifests (includes isCore)
Sync->>DB: upsert WorkflowPlugin / PluginPackage (include isCore)
DB-->>Sync: upsert results
Sync->>DB: disable stale plugin records (unless Vercel preview)
Sync->>Logs: write success/warning/info
Sync-->>Startup: exit status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web-next/package.json`:
- Around line 25-26: Remove the unused dependency "@aws-sdk/client-s3" from the
package.json dependency list (the entry "@aws-sdk/client-s3": "^3.989.0") in the
apps/web-next package, then update the lockfile and reinstall dependencies
(npm/yarn/pnpm install) and rebuild to ensure the client bundle is smaller; also
run a quick grep/tsserver check for any imports referencing "@aws-sdk/client-s3"
to confirm nothing else needs changes and commit the updated package.json and
lockfile.
In `@apps/web-next/src/components/plugin/PluginLoader.tsx`:
- Around line 162-188: The config object in baseContext is replacing
currentShell.config and may drop existing fields; update the creation of
baseContext.config to merge currentShell.config (e.g., spread
currentShell.config) and then override developerApiUrl and baseApiUrl with the
same-origin values (using the existing typeof window !== 'undefined' ?
window.location.origin : '' guard) so you preserve any existing shell config
while applying the same-origin API URLs for embedded plugins.
🧹 Nitpick comments (1)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed. In `@apps/web-next/src/components/plugin/PluginLoader.tsx`: - Around line 162-188: The config object in baseContext is replacing currentShell.config and may drop existing fields; update the creation of baseContext.config to merge currentShell.config (e.g., spread currentShell.config) and then override developerApiUrl and baseApiUrl with the same-origin values (using the existing typeof window !== 'undefined' ? window.location.origin : '' guard) so you preserve any existing shell config while applying the same-origin API URLs for embedded plugins.apps/web-next/src/components/plugin/PluginLoader.tsx (1)
162-188: Merge existing shell config when adding same-origin URLs.
Right nowconfigis a fresh object; ifcurrentShell.configever contains additional fields, they’ll be dropped. Consider spreading it to avoid accidental loss.Suggested diff
- config: { - // Same-origin so embedded plugins use shell's API routes (avoids Failed to fetch when standalone backend isn't running) - developerApiUrl: - typeof window !== 'undefined' ? window.location.origin : '', - baseApiUrl: - typeof window !== 'undefined' ? window.location.origin : '', - }, + config: { + ...(currentShell.config ?? {}), + // Same-origin so embedded plugins use shell's API routes (avoids Failed to fetch when standalone backend isn't running) + developerApiUrl: + typeof window !== 'undefined' ? window.location.origin : '', + baseApiUrl: + typeof window !== 'undefined' ? window.location.origin : '', + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web-next/src/components/plugin/PluginLoader.tsx` around lines 162 - 188, The config object in baseContext is replacing currentShell.config and may drop existing fields; update the creation of baseContext.config to merge currentShell.config (e.g., spread currentShell.config) and then override developerApiUrl and baseApiUrl with the same-origin values (using the existing typeof window !== 'undefined' ? window.location.origin : '' guard) so you preserve any existing shell config while applying the same-origin API URLs for embedded plugins.
- Added `getShellEndpointUrlKey` function to generate endpoint URL keys in the format `${camelCase(pluginName)}EndpointUrl`.
- Updated `PluginLoader` to utilize the new endpoint key for same-origin API calls.
- Refactored `getServiceOrigin` and `getPluginBackendUrl` to use the new endpoint key format, enhancing consistency across the plugin SDK.
- Renamed `publisherApiUrl` to `publisherEndpointUrl` in the shell context for alignment with the new format.
- Updated documentation to reflect changes in endpoint URL resolution.
There was a problem hiding this comment.
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@apps/web-next/src/components/plugin/PluginLoader.tsx`:
- Around line 81-88: The getShellEndpointUrlKey function duplicates camelCase +
"EndpointUrl" logic present in the SDK config; refactor to import and reuse a
single helper instead of keeping local logic. Replace the local
getShellEndpointUrlKey implementation in PluginLoader.tsx with an import of the
shared helper (the same utility used by the SDK config), update usages to call
that helper, and remove the duplicated string/regex logic to prevent drift
between packages.
- Around line 169-197: The code currently replaces the entire config when
building baseContext which drops any existing entries from currentShell.config;
modify the baseContext construction (where config is set) to merge
currentShell.config with the plugin endpoint overrides instead of overwriting it
— e.g., create config by spreading/merging currentShell.config then setting
[pluginEndpointUrlKey] and baseEndpointUrl to sameOriginEndpointUrl so only
those keys are overridden while preserving other shell config values; update
references in PluginLoader where baseContext and
pluginEndpointUrlKey/sameOriginEndpointUrl are used.
🧹 Nitpick comments (2)
🤖 Fix all nitpicks with AI agents
Verify each finding against the current code and only fix it if needed. In `@apps/web-next/src/components/plugin/PluginLoader.tsx`: - Around line 81-88: The getShellEndpointUrlKey function duplicates camelCase + "EndpointUrl" logic present in the SDK config; refactor to import and reuse a single helper instead of keeping local logic. Replace the local getShellEndpointUrlKey implementation in PluginLoader.tsx with an import of the shared helper (the same utility used by the SDK config), update usages to call that helper, and remove the duplicated string/regex logic to prevent drift between packages. - Around line 169-197: The code currently replaces the entire config when building baseContext which drops any existing entries from currentShell.config; modify the baseContext construction (where config is set) to merge currentShell.config with the plugin endpoint overrides instead of overwriting it — e.g., create config by spreading/merging currentShell.config then setting [pluginEndpointUrlKey] and baseEndpointUrl to sameOriginEndpointUrl so only those keys are overridden while preserving other shell config values; update references in PluginLoader where baseContext and pluginEndpointUrlKey/sameOriginEndpointUrl are used.apps/web-next/src/components/plugin/PluginLoader.tsx (2)
81-88: Consider sharing the EndpointUrl key helper to avoid drift.The camelCase +
EndpointUrllogic is now duplicated here and in the SDK config. If possible, centralize this helper to keep key generation consistent across packages.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web-next/src/components/plugin/PluginLoader.tsx` around lines 81 - 88, The getShellEndpointUrlKey function duplicates camelCase + "EndpointUrl" logic present in the SDK config; refactor to import and reuse a single helper instead of keeping local logic. Replace the local getShellEndpointUrlKey implementation in PluginLoader.tsx with an import of the shared helper (the same utility used by the SDK config), update usages to call that helper, and remove the duplicated string/regex logic to prevent drift between packages.
169-197: Preserve any existing shell config when injecting EndpointUrl keys.This overwrites
configentirely. If the shell context already provides other config entries, they’ll be dropped for embedded plugins. Safer to merge and override only the endpoint keys.♻️ Suggested merge
- config: { - // Same-origin so embedded plugins use shell's API routes (avoids Failed to fetch when standalone backend isn't running) - [pluginEndpointUrlKey]: sameOriginEndpointUrl, - baseEndpointUrl: sameOriginEndpointUrl, - }, + config: { + ...(currentShell.config ?? {}), + // Same-origin so embedded plugins use shell's API routes (avoids Failed to fetch when standalone backend isn't running) + [pluginEndpointUrlKey]: sameOriginEndpointUrl, + baseEndpointUrl: sameOriginEndpointUrl, + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web-next/src/components/plugin/PluginLoader.tsx` around lines 169 - 197, The code currently replaces the entire config when building baseContext which drops any existing entries from currentShell.config; modify the baseContext construction (where config is set) to merge currentShell.config with the plugin endpoint overrides instead of overwriting it — e.g., create config by spreading/merging currentShell.config then setting [pluginEndpointUrlKey] and baseEndpointUrl to sameOriginEndpointUrl so only those keys are overridden while preserving other shell config values; update references in PluginLoader where baseContext and pluginEndpointUrlKey/sameOriginEndpointUrl are used.
- Added a step to resolve the plugin directory based on the presence of package.json files in either the plugins or examples directories. - Updated subsequent steps to use the resolved directory variable for running tests and building the UMD bundle, improving the robustness of the CI workflow. This change ensures that the correct plugin path is utilized, preventing potential errors during the CI process.
Summary
This fixes a runtime error with the menu not showing the
Developer API Managerplugin and improves database sync when new plugins are installed. This change also resolves a small error with the generated job data that's currently populated on theOverviewpage by avoiding duplicate job IDsChanges
Type
Plugin(s) Affected
Checklist
npm run lint)npm run build)Breaking Changes
None
None
Screenshots / Recordings
Menu renders with no errors

Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Infrastructure