Approvals

Submit, approve, and reject staged changes.

Propose for review

Submit a session for review. The session becomes read-only and no further mutations are allowed.

POST /sessions/:id/propose
Request
curl -X POST http://localhost:8080/sessions/sess_abc123/propose
Response
{
  "session_id": "sess_abc123",
  "status": "proposed",
  "mutation_count": 3,
  "proposed_at": "2024-01-15T10:35:00Z"
}

Once proposed, the session cannot accept new mutations. Use this to freeze changes before review.

Approve session

Apply all staged mutations to production. This is an atomic operation — either all changes apply or none do.

POST /sessions/:id/approve
Request
curl -X POST http://localhost:8080/sessions/sess_abc123/approve \
  -H "Content-Type: application/json" \
  -d '{
    "approved_by": "user@example.com"
  }'
Response
{
  "session_id": "sess_abc123",
  "status": "approved",
  "mutation_count": 3,
  "approved_at": "2024-01-15T10:40:00Z",
  "approved_by": "user@example.com"
}

All mutations are applied atomically in a single transaction. An immutable audit record is created.

Reject session

Discard all staged mutations. The shadow tables are cleaned up and no changes are applied.

POST /sessions/:id/reject
Request
curl -X POST http://localhost:8080/sessions/sess_abc123/reject \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Changes not needed after investigation"
  }'
Response
{
  "session_id": "sess_abc123",
  "status": "rejected",
  "rejected_at": "2024-01-15T10:40:00Z",
  "reason": "Changes not needed after investigation"
}

Conflict detection

Before approval, Astapa checks for conflicts between your staged changes and any changes made to production since the session started.

Conflict response (409)
{
  "error": "conflict_detected",
  "message": "Production data has changed since session started",
  "conflicts": [
    {
      "table": "users",
      "row_id": 5,
      "field": "balance",
      "session_base": 100.00,
      "session_new": 150.00,
      "production_current": 75.00
    }
  ]
}

When conflicts occur, reject the session and create a new one with updated base values.