Skip to main content

Module review

Module review 

Source
Expand description

Durable local-review wire types.

A review thread is a comment anchored to a diff line in the /diff overlay, persisted per (project, branch) so it survives overlay close and forge restarts. Pure data shapes; the redb persistence lives in forge-workspace::store::review and the re-anchoring in forge-agent::env::git_diff.

Re-exports§

use serde::Deserialize; 🔒
use serde::Deserialize; 🔒
use serde::Serialize; 🔒
use serde::Serialize; 🔒
use crate::session_slot::SessionSlot; 🔒

Structs§

ReviewAnchor
Durable, drift-robust location of a review thread, re-resolved to a positional index against a fresh diff scan on every overlay open; content_hash + context let the resolver re-anchor a moved line or flag it Outdated.
ReviewComment
One comment in a thread; at is an rfc3339 timestamp. review_id is the ReviewSet that sealed this turn (None = not yet filed); #[serde(default)] loads turns stored before membership moved onto them. Only user turns are ever filed - an agent reply answers a round rather than forming one.
ReviewSet
A submitted review: the sealed grouping of the comments filed under one pass, plus an optional overview. Persisted per (project, branch). number is the human-facing 1-based sequence (R1, R2, …) minted as the branch’s review count + 1; id is the stable key turns carry in ReviewComment::review_id. created_at is rfc3339.
ReviewThread
A persisted review thread: an anchor plus its comment chain and lifecycle state; created_at / updated_at are rfc3339. commit is the sha the thread was authored under (None = whole-diff scope); #[serde(default)] loads pre-scope threads as whole-diff. Review membership lives per-turn on ReviewComment::review_id, so one thread can span several rounds of a conversation.

Enums§

ReviewAuthor
Who wrote a review comment.
ReviewSide
Which side of the diff the anchored line sits on.
ReviewStatus
Lifecycle state of a review thread. A worker reply flips Open -> Addressed; only the user ever Resolveds; Outdated marks a thread whose anchored line drifted out from under it.

Constants§

DOC_SCOPE_PREFIX
A doc-scoped thread’s scope: base_ref is this prefix plus the document’s resolved absolute path, so the scope key a thread set is stored under IS the document.
TREE_SCOPE_PREFIX
A tree scope’s scope prefix: a seat’s own tree as the scope key, so the files page’s comments follow the SEAT (a worker’s worktree, the lead’s checkout) rather than any branch the tree happens to be on.

Functions§

doc_scope_path
The document’s resolved path a doc scope ref carries, or None for a branch scope.
doc_scope_ref
The scope ref a document’s threads are stored under.
is_doc_scope
Whether a scope ref spells a document rather than a branch. The one predicate: the readers that place threads against a diff and the branch sweep all ask this, so a doc scope is skipped in exactly one place. It takes the ref string, not the anchor, because the sweep has only the stored scope in hand.
is_tree_scope
Whether a scope ref spells a seat’s tree rather than a branch. The one predicate, like its doc-scope sibling: the branch sweep and any reader that must skip tree scopes all ask this.
tree_scope_ref
The scope ref a seat’s tree’s threads are stored under. Built from the slot’s accessors, never from display(): that string is for reading, not for parsing or keying.
u64_from_number_or_string 🔒
Accept a u64 as a JSON number or as its decimal string; anything else is refused rather than rounded.