0168: vc queue is a Rust mechanism with policy as data
Status: Accepted
Context
The local version control plan needs atomic refs, durable queue receipts, filesystem locks and in-process parsing and merging. Current cli plugin filesystem primitives do not supply these mechanisms. The queue must validate the combined tree and retain an exact source identity across crashes.
Decision
Implement the queue mechanism in the Rust toolchain.
Store-local config selects the protected branch, gate command,
toolchain probes and gate-owned paths. OWNERS from the protected
tip selects approvers. Every listed owner on the last matching
OWNERS rule must approve the exact queued source.
vc approve takes its self-reported identity from
HARNESS_VC_BY agent=<owner>; configured admin
uid restrictions additionally check the open approval reference
file descriptor's ownership.
The runner holds one OS-released lock, claims the earliest pending entry by rename, merges against the current protected tip, validates approvals against the actual merged diff and gates a fresh materialization with a scrubbed environment. Only queue-origin receipts matching the merged tree and toolchain key authorize protected advancement. Each landing stores its source; restart finds that source in protected history and finishes the branch/ref receipt update once. The branch remains frozen until a durable terminal receipt exists and the active entry is removed.
Consequences
Queue correctness is independent of any agent runtime. Policy remains inspectable data. Approvals and provenance are self-reported unless the configured admin runs under a distinct OS uid. Representing a structured module as raw data does not bypass ownership of its removed units. A future ADR may move policy evaluation into Harness once the necessary filesystem primitives exist; it must preserve these authority and recovery boundaries.
Alternatives
- Implementing the queue in Harness now requires expanding the cli platform before proving the local version control workflow.
- Gating branch tips independently permits mutually incompatible changes to reach the protected branch.
- Trusting worktree gate receipts permits branch-controlled validation state to authorize protected advancement.