feat(m7.2-D): drop transitional agent.db, add admin helpers #89
Closed
sharang
wants to merge 1 commits from
feat/m7.2d-drop-legacy-db into feat/m7.2c-background-paths
pull from: feat/m7.2d-drop-legacy-db
merge into: sharang:feat/m7.2c-background-paths
sharang:main
sharang:feat/m7.3-scheduler-tenant-registry-v2
sharang:feat/m7.3-admin-endpoints
sharang:feat/m7.3-mcp-tokens-ui
sharang:fix/remove-stale-api-webhook-routes
sharang:feat/m7.3-mcp-tenant-tokens
sharang:feat/dashboard-token-refresh
sharang:fix/dashboard-bearer-token
sharang:feat/m7.1-agent-wire
sharang:fix/m7.1-jwks-refresh
sharang:feat/m7.1-smoke-harness
sharang:feat/m7.1-tenant-claims
sharang:feat/light-mode-theme-toggle
sharang:fix/embedding-build-progress
sharang:fix/cve-scan-http-timeout
sharang:fix/scan-resource-limits-and-script-error
sharang:fix/multiple-issues
sharang:feat/cve-alerts
sharang:feat/e2e-tests
sharang:feat/help-chat-widget
sharang:fix/cascade-delete-repo
sharang:feat/refine-llm-prompts
sharang:fix/gitea-pr-review-error-handling
sharang:test/dummy-bad-code
sharang:fix/remove-code-review-from-findings
sharang:feat/pentest-onboarding
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
08c4ec4cff |
feat(m7.2-D): drop transitional agent.db, add admin helpers
CI / Check (pull_request) Successful in 9m27s
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
Final slice of M7.2. Removes the transitional single-database handle that M7.2-A introduced alongside the pool, so the compliance-agent now has a single source of truth for storage: every code path obtains a tenant-scoped Database from `agent.db_pool.for_tenant_id(...)` or `for_tenant(&ctx)`. There is no shared "default" database anywhere. Changes - ComplianceAgent: `db: Database` field removed. ComplianceAgent::new now takes only `(config, db_pool)`. Verified by an earlier grep during M7.2-C that no remaining call site reads `agent.db`. - main.rs: stops constructing the legacy Database. Only the pool is built at startup. - TestServer: same — drops Database::connect/ensure_indexes, builds only the pool. cleanup() now drops every `<db_name>_*` per-tenant database (no longer touches a bare `<db_name>`). - DatabasePool::list_tenant_db_names() — lists Mongo databases matching the pool's prefix. For admin endpoints + scheduler tenant enumeration in a future M7.3 (this PR keeps SCHEDULER_TENANT_IDS env config — registry integration is a separate concern). - DatabasePool::drop_tenant(&str) — idempotent tenant offboarding. Drops the per-tenant database and evicts the in-memory `ensured` marker so a later re-provision re-runs ensure_indexes. Test plan - cargo fmt --all clean - cargo clippy --workspace --exclude compliance-dashboard -- -D warnings clean - cargo test -p compliance-core --lib — 7 pass - cargo test -p compliance-agent --lib — 228 pass - cargo test -p compliance-agent --test tenant_isolation — 6 pass including new `admin_helpers_list_and_drop_tenant_dbs` - cargo test -p compliance-agent --test tenant_status_middleware — 6 pass M7.2 closeout state after this lands - M7.1 (auth + status) — done - M7.2-A (pool) — done - M7.2-B (handlers) — done - M7.2-C (background paths) — done - M7.2-D (legacy db removed, admin helpers) — done (this PR) - Future M7.3: scheduler pulls tenants from tenant-registry instead of SCHEDULER_TENANT_IDS env; cross-tenant admin HTTP endpoints built on list_tenant_db_names / drop_tenant. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |