Skip to main content

Module policy_patch

Module policy_patch 

Source
Expand description

Slice 6: one policy patch applied to the private index with git apply --cached --3way. What: One policy-proposed patch applied to the private commit index with git apply --cached --3way. Why: Corrections land in the private index, never the real one. A patch that no longer applies is a patch-conflict for the transaction, not a silent skip. The incumbent applies the same command in applyPrivatePatch (src/policy-engine/commit-transaction-git.ts).

In TS you’d write (pseudocode):

await applyPrivatePatch({ workspace, gitPath, cwd, patch, candidateRevision, ordinal });

Structs§

PolicyPatch
What: A policy patch proposal for one ordinary text path. Why: The path and bytes are exactly what the policy proposed, and are validated before Git runs.
PrivatePatchInput
What: Inputs of one private patch application. Why: One object keeps the Git context, the private index and the patch separate at the call site.

Enums§

PatchError
What: Why a policy patch was not applied. Why: The convergence loop maps Rejected to a grammar failure and Conflict to patch-conflict.

Functions§

apply_private_patch
What: Validate a policy patch, write it privately, and apply it to the private index. Why: The patch file is created exclusively with private permissions, so a re-run never overwrites an earlier one.