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: :feat/m7.2c-background-paths
:main
:migrate/ci-breakpilot-tld
:fix/plc-refresh-control-refs
:fix/plc-control-mapping
:fix/refresh-control-refs
:docs/mcp-loop
:fix/mcp-tenant-context
:feat/promote-grounded-controls
:docs/control-mapping
:feat/tune-semantic-retrieval
:fix/embed-batch-chunking
:feat/b3-architectural-controls
:feat/b2-grounded-surface-checks
:feat/b1-cra-semgrep-rules
:feat/semantic-index-cache-autowire
:feat/semantic-control-mapping
:feat/oscal-emit-unmapped-mcp
:feat/grounded-control-check
:feat/oscal-assess-live
:feat/oscal-assessment
:feat/oscal-controls-provider
:feat/werkbank-runnable-loop
:feat/werkbank-exec-crate
:feat/werkbank-runner-endpoints
:feat/werkbank-job-queue
:feat/werkbank-job-contract
:feat/plc-provision-and-test
:docs/plc-runtimes
:docs/plc-soft-plc-architecture
:feat/dast-http-scheme
:feat/enable-optin-scans
:feat/plc-control-logic-scanner
:refactor/rip-out-legacy-repository
:feat/onboarding-validation-edit
:feat/real-nix-firmware-sbom
:fix/bump-tramiton-0.4.1
:feat/firmware-sbom-repro-build
:feat/firmware-sbom-tramiton
:feat/dashboard-targets-dropdowns
:fix/targets-visibility-unified-default
:feat/onboarding-scan-trigger
:fix/ci-concurrency-no-cancel-main
:fix/ci-docker-tramiton-dashboard-mcp
:feat/onboarding-scan-detection
:feat/onboarding-pipeline
:feat/onboarding-wizard
:fix/ci-docker-tramiton-fetch
:feat/onboarding-api
:feat/onboarding-migration
:feat/ci-kellnr-sccache
:feat/onboarding-ingest-classify
:feat/onboarding-foundation
:feat/dashboard-token-refresh
:fix/dashboard-bearer-token
:feat/m7.1-agent-wire
:fix/m7.1-jwks-refresh
:feat/m7.1-smoke-harness
:feat/m7.1-tenant-claims
:feat/light-mode-theme-toggle
:fix/embedding-build-progress
:fix/cve-scan-http-timeout
:fix/scan-resource-limits-and-script-error
:fix/multiple-issues
:feat/cve-alerts
:feat/e2e-tests
:feat/help-chat-widget
:fix/cascade-delete-repo
:feat/refine-llm-prompts
:fix/gitea-pr-review-error-handling
:test/dummy-bad-code
:fix/remove-code-review-from-findings
:feat/pentest-onboarding
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Final slice of M7.2. Removes the transitional single-database handle that M7.2-A introduced alongside the pool, so
compliance-agentnow has a single source of truth for storage: every code path obtains a tenant-scopedDatabasefromagent.db_pool.for_tenant_id(...)orfor_tenant(&ctx). There is no shared "default" database anywhere.Stacked on PR-C (#88) — diff shown is only D's changes.
Changes
ComplianceAgent.db: Databasefield removed.ComplianceAgent::newnow takes only(config, db_pool). Verified by a grep during M7.2-C that no remaining call site readsagent.db.main.rsstops constructing the legacyDatabase. Only the pool is built at startup.TestServersame — dropsDatabase::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 keepsSCHEDULER_TENANT_IDSenv config — registry integration is a separate concern).DatabasePool::drop_tenant(&str)— idempotent tenant offboarding. Drops the per-tenant database and evicts the in-memoryensuredmarker so a later re-provision re-runsensure_indexes. GDPR delete in one call.Test plan
cargo fmt --all -- --checkcleancargo clippy --workspace --exclude compliance-dashboard -- -D warningscleancargo test -p compliance-core --lib— 7 passcargo test -p compliance-agent --lib— 228 passcargo test -p compliance-agent --test tenant_isolation— 6 pass including the newadmin_helpers_list_and_drop_tenant_dbswhich:list_tenant_db_namesreturns bothdrop_tenantcargo test -p compliance-agent --test tenant_status_middleware— 6 passM7.2 closeout state after this lands
Future M7.3 (not in this PR)
SCHEDULER_TENANT_IDSenv.list_tenant_db_names/drop_tenant(likely behind a separate auth path — service account, not customer JWT).🤖 Generated with Claude Code
Superseded — the M7.2 stack was inadvertently included in PR #90 squash-merge (
5648291) on main. The dashboard PR was branched off this PR's descendant and its full diff swept into main as one squash commit. M7.2-A through M7.2-D are all live on main and in production. Closing without merging.Pull request closed