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: platform:feat/m7.2c-background-paths
platform:main
platform:feat/customer-branding
platform:fix/plc-empty-sbom-text
platform:feat/demo-plc-controller
platform:fix/tenant-erasure-confirm
platform:chore/release-0.4.19
platform:fix/target-limit-delete-text
platform:fix/demo-target-claim
platform:feat/entry-plan-target-limit
platform:feat/siemens-devices-ui
platform:feat/siemens-order-number-match
platform:chore/release-0.4.18
platform:feat/control-names-no-offsite-links
platform:fix/vex-not-from-scan
platform:chore/release-0.4.16
platform:docs/t83-dast-decision
No Reviewers
Labels
Clear labels
P0-demo
bug
cra:annex-i
critical
cve
enhancement
eol-tables
epic
high
infrastructure
onboarding
performance
pruefwerk
risk:accepted
security
severity:critical
severity:high
severity:low
severity:medium
v0.3.0
CERTifAI P0 demo build tickets (CS-*)
CRA Anhang I, wesentliche Cybersicherheitsanforderungen / CRA Annex I
Bekannte Schwachstelle in einer Abhängigkeit / known vulnerability in a dependency
Bundled end-of-life tables need an update
Tracking issue spanning multiple sub-issues
Multi-target onboarding wizard redesign
Befund aus Prüfwerk / Prüfwerk finding
Risiko akzeptiert, nicht behoben / accepted risk, not fixed
Schweregrad kritisch / critical
Schweregrad hoch / high
Schweregrad niedrig / low
Schweregrad mittel / medium
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: platform/pruefwerk#89
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