fix: load settings plugins from database#3053
Conversation
The Settings plugins page still read from the runtime plugin registry, which no longer reflects the persisted source of truth for configured plugins. Fetch non-deleted plugin rows from the plugins table through PostgREST and map stored spec/status fields into the listing used by the page.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 55 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughPlugin listings now use a backend-oriented schema and a database-backed fetch. The settings page updates remote-plugin detection, tooltip text, visible columns, and query wiring to match the new plugin data shape. ChangesPlugin listing and settings page
Sequence Diagram(s)sequenceDiagram
participant PluginsPage
participant getPlugins
participant ConfigDB
PluginsPage->>getPlugins: useQuery runs queryFn
getPlugins->>ConfigDB: ConfigDB.get(select, deleted_at filter, order)
ConfigDB-->>getPlugins: plugin rows
getPlugins-->>PluginsPage: normalized PluginListing[]
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pages/Settings/PluginsPage.tsx`:
- Around line 110-115: The "Source" column accessor in PluginsPage is reading
only from spec.source and spec.address, so it misses the persisted top-level
source field on PluginListing. Update the column definition in PluginsPage so
the accessorFn checks row.source first, then falls back to row.spec?.source and
row.spec?.address, preserving the existing empty-string fallback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a736002f-f62a-41ca-82c3-456a29777f70
📒 Files selected for processing (2)
src/api/services/plugins.tssrc/pages/Settings/PluginsPage.tsx
| { | ||
| header: "Version", | ||
| accessorKey: "version", | ||
| maxSize: 100, | ||
| header: "Source", | ||
| id: "source", | ||
| accessorFn: (row) => row.spec?.source ?? row.spec?.address ?? "", | ||
| enableResizing: true | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find where the plugins table's `source` column and spec.source are written/used
rg -nP --type=ts -C3 '\bsource\b' src/api/services/plugins.ts
rg -nP -C3 'plugins' --iglob '*migration*' --iglob '*.sql'
rg -nP --type=ts -C3 'spec\?\.(source|address)' srcRepository: flanksource/flanksource-ui
Length of output: 842
Align "Source" column logic with the persisted data structure.
The API returns source as a top-level field in PluginListing, but the column's accessorFn ignores it:
Current logic in src/pages/Settings/PluginsPage.tsx
accessorFn: (row) => row.spec?.source ?? row.spec?.address ?? ""This results in the "Source" column displaying an empty string whenever spec.source and spec.address are missing, even if a valid value exists in the top-level row.source. Update the accessor to prioritize the top-level field:
accessorFn: (row) => row.source ?? row.spec?.source ?? row.spec?.address ?? ""🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pages/Settings/PluginsPage.tsx` around lines 110 - 115, The "Source"
column accessor in PluginsPage is reading only from spec.source and
spec.address, so it misses the persisted top-level source field on
PluginListing. Update the column definition in PluginsPage so the accessorFn
checks row.source first, then falls back to row.spec?.source and
row.spec?.address, preserving the existing empty-string fallback.
Settings → Plugins was still fetching from the runtime plugin registry.
The persisted
pluginstable is now the source of truth for configured plugins, so the page now reads non-deleted plugin rows from PostgREST instead. The UI maps DB fields into the existing listing shape and shows namespace/source/version from the stored plugin spec/status.Summary by CodeRabbit
New Features
Bug Fixes