feat(resource): add database resources #674

Merged
freemo merged 1 commits from feature/m7-post-resource-db into master 2026-03-10 19:35:41 +00:00
Owner

Summary

  • Add 4 database resource types (postgres, mysql, sqlite, duckdb) with connection arguments, auth handling, and credential masking
  • Implement TransactionSandbox for transaction_rollback strategy using BEGIN/ROLLBACK/COMMIT wrappers with SQLite concrete backend
  • Wire TransactionSandbox into SandboxFactory, replacing the NotImplementedError stub
  • Register database types as built-in types in bootstrap_builtin_types()
  • Add comprehensive Behave BDD tests (35 scenarios), Robot Framework integration tests (8 test cases), and ASV benchmarks

Key Changes

File Change
src/cleveragents/resource/handlers/database.py New: DatabaseResourceHandler + 4 type defs + connection args + validation
src/cleveragents/infrastructure/sandbox/transaction_sandbox.py New: TransactionSandbox implementing Sandbox protocol
src/cleveragents/infrastructure/sandbox/factory.py Wire transaction_rollback to TransactionSandbox
src/cleveragents/application/services/resource_registry_service.py Register 4 DB types in builtin bootstrap
src/cleveragents/domain/models/core/resource_type.py Add DB names to BUILTIN_NAMES
features/database_resources.feature 35 BDD scenarios covering all functionality
robot/database_resources.robot 8 integration test cases
benchmarks/db_resource_bench.py ASV performance benchmarks

Test Results

  • lint: passed
  • typecheck: 0 errors
  • unit_tests: 9764 scenarios passed, 0 failed
  • integration_tests: 1353 tests passed, 0 failed
  • coverage: 98.4% (threshold: 97%)

ISSUES CLOSED: #342

## Summary - Add 4 database resource types (postgres, mysql, sqlite, duckdb) with connection arguments, auth handling, and credential masking - Implement `TransactionSandbox` for `transaction_rollback` strategy using `BEGIN`/`ROLLBACK`/`COMMIT` wrappers with SQLite concrete backend - Wire `TransactionSandbox` into `SandboxFactory`, replacing the `NotImplementedError` stub - Register database types as built-in types in `bootstrap_builtin_types()` - Add comprehensive Behave BDD tests (35 scenarios), Robot Framework integration tests (8 test cases), and ASV benchmarks ## Key Changes | File | Change | |------|--------| | `src/cleveragents/resource/handlers/database.py` | New: DatabaseResourceHandler + 4 type defs + connection args + validation | | `src/cleveragents/infrastructure/sandbox/transaction_sandbox.py` | New: TransactionSandbox implementing Sandbox protocol | | `src/cleveragents/infrastructure/sandbox/factory.py` | Wire transaction_rollback to TransactionSandbox | | `src/cleveragents/application/services/resource_registry_service.py` | Register 4 DB types in builtin bootstrap | | `src/cleveragents/domain/models/core/resource_type.py` | Add DB names to BUILTIN_NAMES | | `features/database_resources.feature` | 35 BDD scenarios covering all functionality | | `robot/database_resources.robot` | 8 integration test cases | | `benchmarks/db_resource_bench.py` | ASV performance benchmarks | ## Test Results - **lint**: passed - **typecheck**: 0 errors - **unit_tests**: 9764 scenarios passed, 0 failed - **integration_tests**: 1353 tests passed, 0 failed - **coverage**: 98.4% (threshold: 97%) ISSUES CLOSED: #342
freemo added this to the v3.6.0 milestone 2026-03-10 08:40:01 +00:00
freemo force-pushed feature/m7-post-resource-db from 68341c1da4 to 3c02e01426 2026-03-10 17:56:27 +00:00 Compare
freemo force-pushed feature/m7-post-resource-db from 3c02e01426 to c054675167 2026-03-10 19:29:30 +00:00 Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-10 19:29:48 +00:00
freemo merged commit c054675167 into master 2026-03-10 19:35:41 +00:00
freemo deleted branch feature/m7-post-resource-db 2026-03-10 19:35:42 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#674