Approvals
Review and approve session changes via the proxy API.
The approval flow
Sessions accumulate changes while in "active" status. When ready for review, propose the session to move it to "pending_review". Reviewers inspect the diff and either approve (atomic merge to production) or reject (discard all changes).
active→pending_review→approvedorrejected
API endpoints
| Endpoint | Action |
|---|---|
| POST /sessions/:id/propose | Move session from active to pending_review |
| GET /sessions/:id/diff | Review changes (inserts, updates, deletes by table) |
| POST /sessions/:id/approve | Apply changes atomically to production |
| POST /sessions/:id/reject | Discard all changes and drop session schema |
Approval actions
Approve
Runs conflict detection, validates foreign keys, then applies changes atomically. Deletes are applied first, then shadow rows are upserted. Session schema is dropped.
Reject
Discards all accumulated changes. The session schema is dropped. No changes are made to production.
Conflict detection
When approving, the proxy checks for conflicts between the session's fork point and the current production state. Approval fails if any conflict is detected.
| Conflict type | Cause |
|---|---|
| Row modified | Row was changed in production since session started |
| Row deleted | Row was deleted in production since session started |
| FK violation | Foreign key constraint would be violated after merge |
Example: propose and approve
terminal
# Propose session for review
curl -X POST http://localhost:8080/sessions/abc123/propose
# Review the diff
curl http://localhost:8080/sessions/abc123/diff
# Approve (applies changes atomically)
curl -X POST http://localhost:8080/sessions/abc123/approve
# Or reject (discards all changes)
curl -X POST http://localhost:8080/sessions/abc123/reject