loom-pr · pr
Source declarations, signatures and documentation for pr.
Source: sigil/weave/tools/loom-pr/src/pr.rs. SHA-256: f67efff1d03f0c3c544aa3edc8c50e366f6725057458287b009269a04a8a6f0f.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
pr::PrId
A 16-char hex BLAKE3-prefix uniquely identifying a PR. Content-
addressed over the OpenPayload so two agents that open "the same"
PR (same head/base/title/description) collide on purpose; otherwise
every PR gets a fresh id without coordination.
pub type PrId = String;Source line: 9.
pr::PrStatus
Lifecycle states.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PrStatus {
/// Open and accepting reviews.
Open,
/// Successfully merged via [`crate::MergePolicy`].
Merged,
/// Closed without merging.
Closed,
}Source line: 14.
pr::OpenPayload
The deterministic payload signed (and hashed for the id) when a PR is
opened. Order of fields is fixed and matches the serde declaration —
serde_json preserves field declaration order so serde_json::to_vec
of this struct is canonical.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct OpenPayload {
/// Schema version.
pub version: u32,
/// Repo identifier (matches `RepoConfig::repo_id`). Bound into the id
/// so the same head/base from different repos gets distinct ids.
pub repo_id: String,
/// Branch the PR is requesting to merge into the base.
pub head_branch: String,
/// Loom commit sequence number at the head branch tip when the PR
/// was opened. Approvers pin their signature to this; if the head
/// advances, approvals on the prior commit no longer count toward
/// threshold.
pub head_commit_seq: u64,
/// Branch to merge into.
pub base_branch: String,
/// Loom commit sequence number at the base branch tip when the PR
/// was opened.
pub base_commit_seq: u64,
/// PR title (one line).
pub title: String,
/// PR description (free-form Markdown).
pub description: String,
/// DID that opened the PR.
pub author_did: String,
/// UNIX millis when the PR was opened.
pub created_ms: u64
}Source line: 28.
pr::OpenPayload::id
Compute the canonical 16-char hex PR id.
pub fn id(&self) -> Result<PrId, serde_json::Error>;Source line: 58.
pr::Pr
The full PR document persisted in Lens.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Pr {
/// Schema version.
pub version: u32,
/// Content-addressed PR id (16-char hex).
pub id: PrId,
/// Title.
pub title: String,
/// Free-form description (Markdown).
pub description: String,
/// Head branch name.
pub head_branch: String,
/// Head commit seq when the PR was opened.
pub head_commit_seq: u64,
/// Base branch name.
pub base_branch: String,
/// Base commit seq when the PR was opened.
pub base_commit_seq: u64,
/// Author DID.
pub author_did: String,
/// Repo id (matches `RepoConfig::repo_id`).
pub repo_id: String,
/// Lifecycle status.
pub status: PrStatus,
/// UNIX millis when the PR was opened.
pub created_ms: u64,
/// UNIX millis of the most recent status change or rewrite.
pub updated_ms: u64,
/// Set when the PR is merged: the seq number of the merge commit on
/// the base branch.
pub merged_commit_seq: Option<u64>
}Source line: 67.
pr::Pr::open
Construct a fresh Pr from an [OpenPayload]. Mints the id and
stamps the created/updated timestamps from the payload itself.
pub fn open(payload: &OpenPayload) -> Result<Self, serde_json::Error>;Source line: 102.