feat(database): add listDatabases function to list configured databases#226
Conversation
Add `database::listDatabases` returning config details for every configured database: logical name, driver (postgres/mysql/sqlite), credential-redacted connection URL, pool settings, and TLS mode. Config-only by design — no health checks or live pool statistics. - Extend AppState with a live `config` snapshot, swapped together with pools inside apply_config's critical section so hot-reload never exposes new pools paired with stale config - Reuse existing config::redact_url and transaction::driver_system; report ca_cert as a presence boolean to avoid leaking paths - Sort entries by name for deterministic output - 7 unit tests (redaction, TLS path-leak guard, sort/count, envelope) plus 2 integration tests including a hot-reload snapshot guard - Document the function in README and skills/SKILL.md
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
skill-check — worker0 verified, 14 skipped (no docs/).
Four for four. Nicely done. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThis PR adds a new ChangesDatabase List Handler
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Summary
Adds
database::listDatabases— the worker's 12th function — so callers can discover which databases are configured without access to the raw config. Returns config details only (no health checks, no live pool stats):{ "databases": [ { "name": "primary", "driver": "sqlite", "url": "sqlite::memory:", "pool": { "max": 10, "idle_timeout_ms": 30000, "acquire_timeout_ms": 5000 }, "tls": { "mode": "require", "ca_cert_present": false, "trust_native": true } } ], "count": 1 }Design notes
configsnapshot (Arc<RwLock<WorkerConfig>>). Built pools discard their config at build time, so the handler needs this to report details.apply_confignow swaps pools and snapshot inside one critical section — a concurrentlistDatabasescan never observe new pools paired with stale config (and a failed rebuild leaves both untouched, preserving the existing keep-previous-pools contract).config::redact_url(password stripped, username →***);ca_certis reported as a presence boolean only, never the filesystem path.redact_url,transaction::driver_system, andTlsMode's existing kebab-case serialization — no new dependencies.{ items, count }mirrorsshell::list.Test plan
list_databases_reports_configured_primaryandapply_config_updates_list_snapshot(hot-reload regression guard)cargo llvm-cov: 100% line/region/function coverage on the new handler;apply_configfully coveredcargo fmt --allcleaniii trigger database::listDatabases '{}'Summary by CodeRabbit
New Features
database::listDatabasesAPI endpoint to list all configured databases with metadata including driver type, connection pool configuration, and TLS settings.Documentation