Skip to content

feat(settings): persist extension runtime settings - #637

Merged
SantiagoDePolonia merged 6 commits into
mainfrom
feat/runtime-extension-settings
Aug 5, 2026
Merged

feat(settings): persist extension runtime settings#637
SantiagoDePolonia merged 6 commits into
mainfrom
feat/runtime-extension-settings

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a generic runtime-setting contract for extensions
  • persist deployment-wide values in SQLite, PostgreSQL, or MongoDB
  • expose validated GET/PUT admin endpoints and render registered settings in Dashboard → Settings
  • keep environment-managed settings visible but read-only

Why

GoModel Pro needs a deployment-wide prompt-compression level that can change at runtime without putting Pro-specific behavior into open core or browser-local storage.

Verification

  • go test ./...
  • npm test
  • npm run check
  • npm run build
  • pre-commit test-race, lint, dist-sync, and fix checks

Summary by CodeRabbit

  • New Features
    • Added a dashboard page for viewing and updating extension-provided runtime settings.
    • Settings support descriptions, selectable values, validation, persistence, and management status.
    • Added admin API endpoints for listing and updating settings.
    • Added SQL and MongoDB storage support.
    • Environment-managed settings are read-only in the dashboard.
    • Settings synchronize across application instances and restore saved values automatically.
    • Invalid or unavailable updates now provide clear error feedback without changing existing values.

Copilot AI lite review requested due to automatic review settings August 3, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d855b5d4-ddcc-44e3-ac59-c48ba038c7ae

📥 Commits

Reviewing files that changed from the base of the PR and between 16e9711 and a21cc0d.

⛔ Files ignored due to path filters (2)
  • internal/admin/dashboard/static/dist/assets/index-CXQeo5ha.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (2)
  • internal/app/subsystems.go
  • internal/app/subsystems_test.go

📝 Walkthrough

Walkthrough

The change adds extension-defined runtime settings. It introduces registry support, SQL and MongoDB persistence, synchronized validation and updates, admin API routes, application wiring, and a dashboard settings interface.

Changes

Runtime settings

Layer / File(s) Summary
Setting contracts and registry
ext/ext.go, ext/registry.go, ext/registry_test.go
Adds setting descriptors, options, the RuntimeSetting interface, synchronized registration, defensive snapshots, and registry tests.
Persistence and setting service
internal/runtimesettings/*
Adds SQL and MongoDB stores plus a service that restores, validates, updates, persists, synchronizes, rolls back, locks, lists, and closes runtime settings.
Application and admin integration
internal/app/*, internal/admin/*
Initializes the service, injects it into admin handlers, exposes listing and update routes, maps errors, and tests the API flow.
Dashboard settings interface
web/dashboard/src/pages/settings/RuntimeSettings.svelte, web/dashboard/src/pages/settings/SettingsPage.svelte
Adds runtime setting loading, editing, saving, error handling, lock indicators, responsive styling, and settings-panel integration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Dashboard
  participant AdminHandler
  participant RuntimeSettingsService
  participant RuntimeSettingsStore
  Dashboard->>AdminHandler: Request runtime setting descriptors
  AdminHandler->>RuntimeSettingsService: List settings
  RuntimeSettingsService-->>AdminHandler: Ordered descriptors
  AdminHandler-->>Dashboard: Settings response
  Dashboard->>AdminHandler: Update setting key and value
  AdminHandler->>RuntimeSettingsService: Validate and apply update
  RuntimeSettingsService->>RuntimeSettingsStore: Persist value
  RuntimeSettingsStore-->>RuntimeSettingsService: Save result
  RuntimeSettingsService-->>AdminHandler: Updated descriptor
  AdminHandler-->>Dashboard: Update response
Loading

Possibly related PRs

  • ENTERPILOT/GoModel#454: Both add deployment-wide dashboard-managed runtime settings with persistence and admin APIs.
  • ENTERPILOT/GoModel#566: Both persist dashboard-managed configuration and treat environment-managed values as read-only.
  • ENTERPILOT/GoModel#643: Both modify application subsystem registration and shutdown ordering.

Poem

A rabbit sets each value right,
The registry keeps the choices bright.
Stored settings return when systems start,
Locked values stay apart.
The dashboard saves with steady light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: persisting extension runtime settings.
Description check ✅ Passed The description explains the changes, rationale, and verification steps, and is mostly complete despite using Summary instead of Description.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/runtime-extension-settings

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.

❤️ Share

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

@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 63.76147% with 79 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/runtimesettings/service.go 60.71% 18 Missing and 15 partials ⚠️
internal/runtimesettings/store_mongodb.go 16.66% 15 Missing ⚠️
internal/runtimesettings/sync.go 68.88% 12 Missing and 2 partials ⚠️
internal/runtimesettings/store_sql.go 63.63% 4 Missing and 4 partials ⚠️
internal/admin/handler_runtime_settings.go 83.33% 3 Missing and 1 partial ⚠️
internal/app/app.go 60.00% 3 Missing and 1 partial ⚠️
ext/registry.go 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR is safe to merge; no blocking failure remains.

The exercised admin update flow persisted a valid setting, synchronized it to a separate running instance, and preserved state when an invalid value was submitted.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran the requested general contract validation and noted that local artifact references were not uploaded.

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "fix(settings): stop reconciliation befor..." | Re-trigger Greptile

Comment thread internal/runtimesettings/service.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 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 `@internal/admin/handler_runtime_settings_test.go`:
- Around line 60-99: Add test cases alongside TestRuntimeSettingsListAndUpdate
and TestRuntimeSettingManagedByEnvironmentIsReadOnly covering unknown-key PUTs
returning 404 with runtime_setting_not_found, invalid option values returning
400, and GET/PUT requests on a handler without WithRuntimeSettings returning the
feature-unavailable response. Reuse the existing Echo route setup and runtime
settings test helpers, and verify the setting remains unchanged where
applicable.

In `@internal/runtimesettings/service_test.go`:
- Around line 48-104: Add a test alongside TestServicePersistsAndRestoresSetting
that uses a stub Store whose Set method returns an error, then calls
Service.Update and verifies the setting’s value is restored to its previous
state via Apply. Assert the update returns the store error while preserving the
existing locked and persistence test coverage.

In `@internal/runtimesettings/service.go`:
- Around line 31-72: Reject non-locked settings with empty Options during
registration in Service.New, returning a startup error immediately after the
descriptor.Locked check; update ext/ext.go documentation for
SettingDescriptor/RuntimeSetting to state that Options must include every
accepted value and that empty Options makes an unlocked setting non-editable.
Apply the service.go change at lines 31-72 and the documentation change in
ext/ext.go at lines 84-113.
- Around line 87-111: Update the Service.Update method to add the same
nil-receiver guard used by List and Close before accessing s.mu or other fields.
Return the established nil-service error consistently, while preserving the
existing update behavior for non-nil receivers.

In `@web/dashboard/src/pages/settings/RuntimeSettings.svelte`:
- Around line 37-38: Update the select disabled-state logic in the settings UI
so every select is disabled whenever any save is in flight, not only when
savingKey matches that setting. Keep locked settings disabled as before, and
ensure the save guard in save remains consistent with this global in-flight
behavior.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: cf009c00-ad9d-474f-8eb7-4cc190dd07f7

📥 Commits

Reviewing files that changed from the base of the PR and between 9d54827 and 6fc6415.

⛔ Files ignored due to path filters (4)
  • internal/admin/dashboard/static/dist/assets/index-6sHfhgfb.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/assets/index-B-Rv4AUL.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/assets/index-B_MQg975.css is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (16)
  • ext/ext.go
  • ext/registry.go
  • ext/registry_test.go
  • internal/admin/handler.go
  • internal/admin/handler_runtime_settings.go
  • internal/admin/handler_runtime_settings_test.go
  • internal/admin/routes.go
  • internal/admin/routes_test.go
  • internal/app/app.go
  • internal/runtimesettings/service.go
  • internal/runtimesettings/service_test.go
  • internal/runtimesettings/store.go
  • internal/runtimesettings/store_mongodb.go
  • internal/runtimesettings/store_sql.go
  • web/dashboard/src/pages/settings/RuntimeSettings.svelte
  • web/dashboard/src/pages/settings/SettingsPage.svelte

Comment thread internal/admin/handler_runtime_settings_test.go
Comment thread internal/runtimesettings/service_test.go Outdated
Comment thread internal/runtimesettings/service.go
Comment thread internal/runtimesettings/service.go
Comment thread web/dashboard/src/pages/settings/RuntimeSettings.svelte
Copilot AI review requested due to automatic review settings August 3, 2026 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@internal/runtimesettings/store_mongodb_test.go`:
- Around line 11-29: Extend TestMongoDBStoreRoundTrip with a nil-database call
to NewMongoDBStore and assert that it returns an error, covering the
constructor’s nil-database rejection while preserving the existing
mongotest-backed round-trip checks.

In `@internal/runtimesettings/sync.go`:
- Around line 39-71: Update Service.sync to continue iterating through all keys
after store.Get or setting.Apply fails, while recording each failure and
returning an aggregate error after the loop. Preserve the existing invalid-value
handling and successful application behavior, and include each failure’s setting
key and underlying error in the aggregate.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 004930c0-6783-4be5-8804-c045f4be5749

📥 Commits

Reviewing files that changed from the base of the PR and between 6fc6415 and c6e06a9.

⛔ Files ignored due to path filters (2)
  • internal/admin/dashboard/static/dist/assets/index-D6HB9TkL.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (11)
  • ext/ext.go
  • internal/admin/handler_runtime_settings.go
  • internal/admin/handler_runtime_settings_test.go
  • internal/runtimesettings/service.go
  • internal/runtimesettings/service_test.go
  • internal/runtimesettings/store.go
  • internal/runtimesettings/store_mongodb.go
  • internal/runtimesettings/store_mongodb_test.go
  • internal/runtimesettings/store_sql.go
  • internal/runtimesettings/sync.go
  • web/dashboard/src/pages/settings/RuntimeSettings.svelte

Comment thread internal/runtimesettings/store_mongodb_test.go
Comment thread internal/runtimesettings/sync.go
Copilot AI review requested due to automatic review settings August 3, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…n-settings

# Conflicts:
#	internal/admin/dashboard/static/dist/assets/index-B_MQg975.css
#	internal/admin/dashboard/static/dist/assets/index-CDxZDTJg.css
#	internal/admin/dashboard/static/dist/assets/index-Dv37Tmj5.css
#	internal/admin/dashboard/static/dist/index.html
Copilot AI review requested due to automatic review settings August 4, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@internal/app/subsystems.go`:
- Around line 109-112: Update shutdownOrder so runtimeSettings is stopped before
providers, ensuring no runtime-setting Apply operations can occur during
provider teardown. Preserve the existing subsystem close mechanism and ordering
of the remaining shutdown entries.
🪄 Autofix

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: ASSERTIVE

Plan: Pro Plus

Run ID: aad73ddd-6f42-4dc0-85ae-7c12829202ec

📥 Commits

Reviewing files that changed from the base of the PR and between 8b02639 and 16e9711.

⛔ Files ignored due to path filters (3)
  • internal/admin/dashboard/static/dist/assets/index-5TzGYjSi.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/assets/index-C9yo6Tyg.css is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (3)
  • internal/app/app.go
  • internal/app/subsystems.go
  • internal/app/subsystems_test.go

Comment thread internal/app/subsystems.go Outdated
…n-settings

# Conflicts:
#	internal/admin/dashboard/static/dist/index.html
Copilot AI review requested due to automatic review settings August 4, 2026 18:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 4, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@SantiagoDePolonia
SantiagoDePolonia merged commit 49ee2e5 into main Aug 5, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants