Skip to content

[P3] Sprint 3.2: Add Database Lab Engine for F1 Reversibility #175

@ariffazil

Description

@ariffazil

Objective

Enable physical reversibility for database operations (F1 Amanah).

Repository

https://github.com/postgres-ai/database-lab-engine

Effort

5 days

Timeline

Future (v57.0+) — after market validation

Implementation

Setup

docker run -p 6432:5432 postgresai/dblab:latest

ReversibleDB Class

import dblab_client

class ReversibleDB:
    async def clone_snapshot(self, session_id: str) -> str:
        """Create thin clone before risky operation"""
        return dblab_client.create_clone(f"session_{session_id}")
    
    async def rollback_to_snapshot(self, clone_id: str):
        """Undo operation by restoring snapshot"""
        return dblab_client.restore_clone(clone_id)

Vault Integration

@mcp.tool()
async def vault_seal(session_id: str, reversible: bool = True) -> dict:
    if reversible:
        clone_id = await ReversibleDB().clone_snapshot(session_id)
    # ... seal logic
    return {"seal": seal, "clone_id": clone_id}

Subtasks

  • Set up Database Lab Engine via Docker
  • Create codebase/floors/f1_reversibility.py
  • Integrate with VAULT-999
  • Add undo command: aaa-mcp-undo --session <session_id>
  • Test database rollback

Acceptance Criteria

  • Database clones created before writes
  • Rollback command restores prior state
  • F1 (Amanah) physically enforced

Blockers

None (future work)

Priority

P3 — Evaluate after v56.0 market validation

Related

  • INTEGRATION_MASTERPLAN.md

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions