Skip to content

feat: remove MongoDB legacy code - #295

Merged
remyluslosius merged 2 commits into
mainfrom
feat/mongodb-deprecation
Feb 19, 2026
Merged

feat: remove MongoDB legacy code#295
remyluslosius merged 2 commits into
mainfrom
feat/mongodb-deprecation

Conversation

@remyluslosius

Copy link
Copy Markdown
Contributor

Summary

  • Delete all MongoDB repository classes (10 repositories: base, compliance, enhanced, health, intelligence, plugin_models, plugin, remediation_job, remediation, scan)
  • Delete MongoDB models (mongo_models.py, enhanced_mongo_models.py) and clean MongoDB imports from remaining models
  • Delete MongoDB-dependent services (compliance_rules/ package, content/import_/ package, content/transformation/transformer.py, mongo_integration_service.py, scan_template_service.py, health_monitoring_tasks.py)
  • Delete MongoDB-dependent CLI tools (load_compliance_rules.py, migrate_oval_references.py) and routes (scans/config.py)
  • Clean all MongoDB imports (motor, pymongo, beanie, bson) from 12+ remaining service files across plugins/, framework/, rules/, engine/, routes/
  • Convert Beanie Document models to Pydantic BaseModel in all plugin service model files
  • Stub repository-dependent methods with logger.warning() and sensible defaults (empty lists, zero counts, None)
  • Replace MongoDB queries with in-memory storage for orchestration jobs and governance audit events
  • Update health monitoring to PostgreSQL-only checks
  • Remove MongoDB packages (motor, beanie, pymongo, bson) from requirements.txt

80 files changed, 611 insertions(+), 19,488 deletions(-)

Context

MongoDB was deprecated following Aegis integration (see docs/plans/MONGODB_DEPRECATION_PLAN.md). MongoDB containers were already removed from CI and docker-compose. This PR removes all remaining MongoDB code from backend/app/, completing the deprecation.

Aegis YAML rules replace the MongoDB compliance_rules collection. PostgreSQL replaces all other MongoDB collections. Plugin services that depended on MongoDB repositories now log warnings and return safe defaults until they are reimplemented against PostgreSQL.

Test plan

  • All pre-commit hooks pass (black, isort, flake8, mypy, bandit, secrets)
  • py_compile passes on all modified files
  • Zero remaining from app.repositories imports (except empty __init__.py)
  • Zero remaining motor/pymongo/beanie/bson imports
  • No direct Beanie ODM calls (.find(), .to_list(), etc.)
  • CI pipeline passes
  • Backend starts successfully in Docker

🤖 Generated with Claude Code

…ncies

Complete removal of MongoDB from backend/app/:

- Delete all MongoDB repository classes (base, compliance, enhanced,
  health, intelligence, plugin_models, plugin, remediation_job,
  remediation, scan repositories)
- Delete MongoDB models (mongo_models.py, enhanced_mongo_models.py)
- Delete MongoDB-dependent services (compliance_rules/, content/import_/,
  content/transformation/transformer.py, mongo_integration_service.py,
  scan_template_service.py, health_monitoring_tasks.py)
- Delete MongoDB-dependent CLI tools (load_compliance_rules.py,
  migrate_oval_references.py)
- Delete MongoDB-dependent routes (scans/config.py)
- Clean all MongoDB imports (motor, pymongo, beanie, bson) from
  remaining service files
- Convert Beanie Document models to Pydantic BaseModel in plugin
  service models
- Stub repository-dependent methods with logger warnings and
  sensible defaults
- Replace MongoDB queries with in-memory storage where needed
  (orchestration jobs, governance audit events)
- Update health monitoring to PostgreSQL-only checks
- Remove MongoDB config from app config and requirements.txt

80 files changed, 686 insertions(+), 19,475 deletions(-)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove tests/unit/repositories/ directory (test_base_repository.py,
test_compliance_repository.py, conftest.py) which imported the deleted
base_repository and compliance_repository modules, causing CI
collection errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@remyluslosius
remyluslosius merged commit 0c0d3c5 into main Feb 19, 2026
28 checks passed
@remyluslosius
remyluslosius deleted the feat/mongodb-deprecation branch February 19, 2026 02:57
remyluslosius added a commit that referenced this pull request Mar 7, 2026
complianceAdapter.ts calls /api/compliance/rules which was removed
with MongoDB (PR #295). Not imported by any live component — replaced
by ruleReferenceAdapter.ts. Also remove barrel export and architecture
spec reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant