pub struct Gates;Expand description
The gate-file protocol, scoped to a project’s .devflow/gates/ directory.
Implementations§
Source§impl Gates
impl Gates
Sourcepub fn gate_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
pub fn gate_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
Path to the gate request file for a phase + stage.
Sourcepub fn response_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
pub fn response_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
Path to the response file for a phase + stage.
Sourcepub fn ack_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
pub fn ack_path(project_root: &Path, phase: u32, stage: Stage) -> PathBuf
Path to the ack file for a phase + stage.
Sourcepub fn list_open(project_root: &Path) -> Vec<OpenGate>
pub fn list_open(project_root: &Path) -> Vec<OpenGate>
Every open gate (request written, no response yet), sorted by phase
then stage. Request files are NN-{stage}.json; .response.json and
.ack.json siblings are protocol artifacts, not requests, and any
unparsable file is skipped — listing must degrade, not die.
Sourcepub fn respond(
project_root: &Path,
phase: u32,
stage: Stage,
response: &GateResponse,
) -> Result<PathBuf, GateError>
pub fn respond( project_root: &Path, phase: u32, stage: Stage, response: &GateResponse, ) -> Result<PathBuf, GateError>
Answer an open gate by writing its response file atomically — the programmatic form of what a human previously hand-edited. Refuses when no gate request is open for the phase+stage, and when a response is already on disk awaiting the workflow’s poller (silently replacing an unconsumed answer would race the poll).
Sourcepub fn write_gate(
project_root: &Path,
phase: u32,
stage: Stage,
context: &str,
) -> Result<PathBuf, GateError>
pub fn write_gate( project_root: &Path, phase: u32, stage: Stage, context: &str, ) -> Result<PathBuf, GateError>
Write a gate request, creating the gates directory if needed.
Sourcepub fn poll_response(
project_root: &Path,
phase: u32,
stage: Stage,
timeout_secs: u64,
) -> Option<GateResponse>
pub fn poll_response( project_root: &Path, phase: u32, stage: Stage, timeout_secs: u64, ) -> Option<GateResponse>
Poll for a response with exponential backoff (1s → 2s → 4s … capped at
60s), giving up after timeout_secs. Returns the parsed response when it
appears, or None on timeout.