Skip to content

Policy Rollout API ​

The rollout API provides controlled policy lifecycle management — from proposed plan to live policy with full audit trail.

Authentication ​

All endpoints require Authorization: Bearer <API_KEY> header or gitwire-session cookie.


Lifecycle ​

text
draft → validated → review_ready → approved → promoted
                                    ↘ rejected
   ↘ cancelled (from draft, validated, approved)
promoted → rolled_back

Terminal states: rolled_back, rejected, cancelled


POST /api/rollouts ​

Create a new rollout plan in draft state.

Request ​

json
{
  "repo": "Octo-Lex/GitWire",
  "proposed_config": {
    "dry_run": true,
    "pillars": {
      "triage": { "enabled": true }
    }
  },
  "created_by": "nalajmah"
}

Response (201) ​

Returns the created plan with redacted normalized config.


GET /api/rollouts ​

List rollout plans with optional filters.

Query parameters ​

ParamTypeDefaultDescription
repostring—Filter by repo full_name
statusstring—Filter by lifecycle status
created_bystring—Filter by creator
limitnumber50Max results (capped at 200)
offsetnumber0Pagination offset

Response ​

json
{
  "data": [...],
  "total": 5
}

GET /api/rollouts/:id ​

Get a single rollout plan by ID.

Returns full plan with all metadata, evidence, and config snapshots (redacted).


PATCH /api/rollouts/:id/evidence ​

Attach evidence summaries to a plan. Only allowed in draft or validated state.

Request ​

json
{
  "validation_result": { "valid": true, ... },
  "simulation_summary": { "would_act": 4, ... },
  "diff_impact_summary": { "changes": { ... }, ... },
  "recommendations_summary": { "summary": { "critical": 0, ... }, ... }
}

POST /api/rollouts/:id/approve ​

Approve a rollout plan. Requires all evidence and critical recommendation acknowledgement.

Approval rules ​

CheckRule
StateMust be review_ready
EvidenceAll 4 types attached
ValidationMust be valid
Critical recommendationsMust be explicitly acknowledged

Request ​

json
{
  "actor": "nalajmah",
  "reason": "Reviewed all evidence. Rolling out in dry-run first.",
  "acknowledged_recommendations": [
    "enable-dry-run-for-new-risky-policy"
  ]
}

Response ​

Returns plan with approved_by, approved_at, approval_reason, acknowledged_recommendations, and reviewed_evidence audit snapshot.


POST /api/rollouts/:id/reject ​

Reject a rollout plan. Transitions to rejected (terminal).

Request ​

json
{
  "actor": "nalajmah",
  "reason": "Critical risk not mitigated."
}

POST /api/rollouts/:id/promote ​

The only path that writes policy. Promotes the approved proposed config as the active repo policy.

Promotion rules ​

CheckRule
StateMust be approved
Approval metadataapproved_by, approved_at present
EvidenceAll 4 types attached
ValidationStill valid
Proposed configPresent

Execution sequence ​

  1. Capture previous config snapshot
  2. Write proposed config via setConfigOverrides
  3. If write fails → state remains approved (no transition)
  4. Transition to promoted

Request ​

json
{
  "actor": "nalajmah",
  "reason": "Promoting approved dry-run policy after successful review."
}

Response ​

Returns plan with promoted_by, promoted_at, promotion_reason, and previous_config snapshot.


POST /api/rollouts/:id/rollback ​

Restore the previous policy captured before promotion.

Rollback rules ​

CheckRule
StateMust be promoted
Previous configSnapshot must exist
ActorRequired
ReasonRequired

Execution sequence ​

  1. Capture current config as replaced evidence
  2. Write previous_config back as active policy
  3. If write fails → state remains promoted (no transition)
  4. Transition to rolled_back (terminal)

Rollback evidence ​

json
{
  "restored_previous_config": true,
  "replaced_config_captured": true,
  "previous_config_hash": "sha0:abc12345",
  "promoted_config_hash": "sha0:def67890",
  "replaced_config_hash": "sha0:ghi13579"
}

Request ​

json
{
  "actor": "nalajmah",
  "reason": "Observed unexpected live behavior after promotion."
}

POST /api/rollouts/:id/transition ​

Generic transition endpoint for non-specialized transitions (validated, review_ready, cancelled).

Blocks approved, rejected, promoted, rolled_back — those must go through dedicated endpoints.


Dashboard ​

The /rollouts dashboard page provides:

  • List view with filters and state badges
  • Detail view with lifecycle timeline, evidence cards, audit trail
  • State-driven actions with confirmation modal
  • Critical recommendation acknowledgement on approve
  • Collapsible redacted config snapshots

Released under the MIT License.