Skip to content

fix(plugins): add isCore field to plugin data and deduplicate jobs in useJobFeedStream#100

Merged
eliteprox merged 4 commits into
mainfrom
feat/fix-plugin-db-upsert
Feb 16, 2026
Merged

fix(plugins): add isCore field to plugin data and deduplicate jobs in useJobFeedStream#100
eliteprox merged 4 commits into
mainfrom
feat/fix-plugin-db-upsert

Conversation

@eliteprox
Copy link
Copy Markdown
Contributor

@eliteprox eliteprox commented Feb 16, 2026

Summary

This fixes a runtime error with the menu not showing the Developer API Manager plugin 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 the Overview page by avoiding duplicate job IDs

Changes

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

Type

  • Feature
  • Bug fix
  • Refactor
  • Documentation
  • CI / Tooling
  • Plugin (new or update)
  • Dependencies

Plugin(s) Affected

  • developer-api
  • community
  • plugin-publisher

Checklist

  • Tests pass locally
  • Lint passes (npm run lint)
  • Build succeeds (npm run build)
  • No new lint warnings introduced
  • Breaking changes documented below
  • Database migration included (if Prisma schema changed)

Breaking Changes

None
None

Screenshots / Recordings

Menu renders with no errors
image

Summary by CodeRabbit

  • New Features

    • Per-plugin same-origin endpoint routing and standardized per-plugin endpoint config keys.
    • Plugin registry now syncs automatically during startup.
  • Enhancements

    • Introduced an isCore flag to mark core (non-removable) plugins.
    • CI now resolves plugin frontend directories for tests/builds.
  • Bug Fixes

    • Job feed deduplicates entries by ID.
  • Infrastructure

    • Added AWS S3 support; plugin cleanup skips Vercel preview environments.

… 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.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
naap-platform Ready Ready Preview, Comment Feb 16, 2026 11:49pm

Request Review

@github-actions github-actions Bot added scope/shell Shell app changes scope/packages Shared package changes scope/infra Infrastructure changes plugin/community Community plugin plugin/developer-api Developer API plugin plugin/plugin-publisher Plugin Publisher plugin size/M Medium PR (51-200 lines) labels Feb 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Adds an isCore flag across plugin manifests, discovery, and registry upserts; adds a startup step to sync the plugin registry; renames shell config keys to {plugin}EndpointUrl and augments PluginLoader with per-plugin endpoint/baseEndpoint; adds S3 SDK dependency and deduplicates job-feed entries by id.

Changes

Cohort / File(s) Summary
Plugin registry & discovery
bin/start.sh, bin/sync-plugin-registry.ts, packages/database/src/plugin-discovery.ts, plugins/community/plugin.json, plugins/developer-api/plugin.json, plugins/plugin-publisher/plugin.json
Adds isCore to plugin manifests and discovery model; sync script upserts isCore into PluginPackage records, performs environment-aware cleanup (skips Vercel previews), and startup now runs the registry sync step.
Shell / plugin endpoint resolution
apps/web-next/src/components/plugin/PluginLoader.tsx, packages/plugin-sdk/src/config/ports.ts, packages/plugin-sdk/src/utils/api.ts, packages/plugin-sdk/src/hooks/usePluginApi.ts, plugins/plugin-publisher/frontend/src/lib/shell-context.ts
Introduces helper to derive camelCase {plugin}EndpointUrl keys; backend URL resolution now prefers EndpointUrl keys; PluginLoader augments shell context with per-plugin EndpointUrl and baseEndpointUrl; docs and ShellContext field renamed to publisherEndpointUrl.
Job feed buffering
apps/web-next/src/hooks/useJobFeedStream.ts
Adds id-based deduplication when prepending new entries to the rolling job feed buffer to avoid duplicate ids.
UI / navigation
apps/web-next/src/components/layout/sidebar.tsx
Removes the Marketplace navigation item from the More section of the sidebar.
Dependencies
apps/web-next/package.json
Adds @aws-sdk/client-s3@^3.989.0 and removes a duplicate listing; whitespace/newline formatting adjusted.
CI / SDK compatibility workflow
.github/workflows/sdk-compat.yml
Resolves plugin frontend directory dynamically by exporting PLUGIN_DIR (checks plugins/<plugin> and examples/<plugin>), and uses it in test/build steps.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

size/L

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the two main changes: adding isCore field to plugin data and deduplicating jobs in useJobFeedStream, matching the changeset content.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/fix-plugin-db-upsert

Comment @coderabbitai help to get the list of available commands and usage tips.

@eliteprox eliteprox changed the title fix(plugins): fix(plugins): add isCore field to plugin data and deduplicate jobs in useJobFeedStream Feb 16, 2026
Comment thread apps/web-next/src/components/plugin/PluginLoader.tsx Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 now config is a fresh object; if currentShell.config ever 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.

Comment thread apps/web-next/package.json
- 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.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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 + EndpointUrl logic 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 config entirely. 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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Feb 16, 2026
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin/community Community plugin plugin/developer-api Developer API plugin plugin/plugin-publisher Plugin Publisher plugin scope/infra Infrastructure changes scope/packages Shared package changes scope/sdk Plugin SDK changes scope/shell Shell app changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant