---
slug: policy/delete
version: "0.1"
title: Policy — Delete
summary: Delete a Rego policy module; takes effect on the next request evaluation.
status: draft
targetFrameworkVersion: "0.5.0"
category: governance
keywords:
  - policy
  - delete
authors:
  - Glenn Gore (https://github.com/stormer78)
parties:
  - role: vault consumer
    requirement: REQUIRED
    member: issuer
  - role: vault maintainer
    requirement: REQUIRED
    member: recipient
proofRequirement:
  requirement: REQUIRED
  rationale: Removing a policy changes the maintainer's security posture; producer identity MUST be verifiable for audit.
issuedAtRequirement:
  requirement: REQUIRED
  rationale: Deleting a policy is irreversible and leaves whatever it governed under the fallback. Replayed after a replacement policy was created under the same name, it deletes the replacement.
sideEffects:
  level: destructive
  rationale: "Deletes a Rego policy module; it stops shaping evaluation immediately and is gone from the maintainer."
consequences:
  - "Requests are evaluated without this policy from the next request on, until it is re-created."
subjectPath: /id
exposure:
  discloses: none
  actsAsSubject: false
errorCodes:
  - code: policy/delete:notFound
    meaning: No policy with this id.
    retryable: false
  - code: policy/delete:versionConflict
    meaning: "`expectedVersion` mismatch."
    retryable: true
  - code: policy/delete:wouldOrphanContexts
    meaning: Deleting this policy would leave one or more contexts with no applicable policy. The maintainer's policy on this is configurable — if deny-by-default is in place, this is benign; if the policy was the only `allow` for the context, you'd be locking yourself out. Override by setting an `ext` flag.
    retryable: false
    detailsSchema:
      type: object
      additionalProperties: false
      properties:
        orphanedContexts: { type: "array", items: { "type": "string" } }
---

## Abstract

Removes a policy module. The maintainer SHOULD warn (via `wouldOrphanContexts`) if the deletion would leave any context with no applicable policy that allows access; the user can override via `ext` flag if they understand the implications.

## Conformance

Producer: populate `id`; SHOULD populate `expectedVersion`. Consumer: verify `PolicyAdmin`, check orphan condition, emit `sync/event/0.2` with kind `policy.changed`, hot-unload from evaluator cache.

## Security & Privacy

**Orphan check.** Same intent as the upsert audit retention: a misclick should not silently lock the user out. The deny-by-default fallback is the safety net; the orphan warning is the first line.

**Audit.** Logged with `{ who, when, policyId, reason? }`. The deleted policy's source SHOULD be retained in audit-only storage for rollback.
