ExamplesAccess Request

Access Request Workflow

Primary commercial example for adopting Causet beside an existing app. Full guide: Retrofit an Existing App.


Old fragile flow

POST /api/access-requests
  → validate
  → write DB row
  → call approval service
  → send email
  → update status
  → maybe fail halfway

Logs cannot reliably answer what completed.


Causet version

POST /api/access-requests
  → validate
  → submit request_access
  → return compatibility or 202 accepted

Causet timeline
  → access_requested
  → approval_required
  → access_approved
  → notification_sent | notification_failed

Existing app
  → updates its DB from events / projections
  → frontend keeps reading existing tables

Sample intent

actions:
  request_access:
    state: access_request
    entity_id_expr: intent.request_id
    input:
      request_id: { type: string, required: true }
      email:      { type: string, required: true }
      reason:     { type: string, required: true }

Sample events

access_requested
approval_required
access_approved
notification_sent
notification_failed

Sample query

queries:
  access_request_status:
    from: access_request_status
    where:
      request_id: { eq: input.request_id }

Timeline output

request_access (ar_123)
  ✓ access_requested
  ✓ approval_required
  ✓ access_approved
  ✗ notification_failed

What you can inspect

  • Which events committed
  • Whether approval ran before notification
  • Side-effect failure reason on the timeline

What you can replay or repair

  • Re-run notification on a fork with corrected config
  • Rebuild stale access_request_status projection
  • Bridge repaired status back to the app DB

See Replay walkthrough.