swg_gate
Verify a file is still unchanged and its grant still valid before acting on a prior read. Prevents stale-write overwrites by denying action if the file moved or the grant was reclaimed.
Instructions
Verify a file is STILL unchanged and still under the same grant. Pass BOTH comparands from your earlier swg_read — expected_version AND expected_generation (its owner_generation). Call this immediately BEFORE any irreversible external action you decided from that read (sending a webhook, opening a PR, running a deploy, posting a message). Returns decision=proceed, or DENIES with reason=stale_view if the file moved OR the grant you read it under was reclaimed (the version alone cannot see a reclaim) OR either comparand is unconfirmed. On a deny: do NOT take the action — swg_reacquire, re-read, re-decide. SINGLE-HOST only. Out of guarantee and NOT detected in v1: writers on different hosts or across a synced/network mount, divergent-history reconciliation, semantic correctness, server-enforced auto-merge.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| expected_version | Yes | ||
| expected_generation | Yes |