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

EndpointAction
POST /sessions/:id/proposeMove session from active to pending_review
GET /sessions/:id/diffReview changes (inserts, updates, deletes by table)
POST /sessions/:id/approveApply changes atomically to production
POST /sessions/:id/rejectDiscard 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 typeCause
Row modifiedRow was changed in production since session started
Row deletedRow was deleted in production since session started
FK violationForeign 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