internal/core/reviewgate
import "github.com/nilstate/scafld/v2/internal/core/reviewgate"
Package reviewgate projects review-attempt and review evidence into the single gate state used by review, status, handoff, and completion commands.
Constants
Source: internal/core/reviewgate/projection.go:17
const (
// EntryReviewAttempt records a leased provider review lifecycle attempt.
EntryReviewAttempt = "review_attempt"
AttemptStatusRunning = "running"
AttemptStatusAccepted = "accepted"
AttemptStatusFailed = "failed"
AttemptStatusAbandoned = "abandoned"
DefaultAttemptLease = 2 * time.Hour
)Source: internal/core/reviewgate/projection.go:31
const (
KindReadyForReview Kind = "ready_for_review"
KindAttemptRunning Kind = "attempt_running"
KindAttemptStale Kind = "attempt_stale"
KindAttemptFailed Kind = "attempt_failed"
KindReviewFailed Kind = "review_failed"
KindReviewPassed Kind = "review_passed"
KindReviewStaleAfterBuild = "review_stale_after_build"
KindReviewStaleAfterSpec = "review_stale_after_spec"
KindReviewStaleAfterWorkspace = "review_stale_after_workspace"
KindCompletedAuthorized = "completed_authorized"
KindInvalid = "invalid"
)Functions
func AbandonedAttemptEntry(attempt Attempt, reason string) session.Entry
Source: internal/core/reviewgate/projection.go:345
AbandonedAttemptEntry closes a stale running attempt before a new attempt starts.
func AcceptedAttemptEntry(attempt Attempt, reason string) session.Entry
Source: internal/core/reviewgate/projection.go:335
AcceptedAttemptEntry explicitly closes a provider attempt that produced an accepted ReviewDossier. The following review entry carries the authority.
func CurrentReviewGate(ledger session.Session) Authority
Source: internal/core/reviewgate/authority.go:101
CurrentReviewGate validates the latest review gate that can currently authorize completion. Later build, criterion, phase, approval, fail, cancel, baseline, or review-attempt evidence invalidates older reviews.
func DecodeAttempt(entry session.Entry, opts Options) Attempt
Source: internal/core/reviewgate/projection.go:283
DecodeAttempt normalizes attempt metadata from a session entry.
func EntryReference(entry session.Entry) string
Source: internal/core/reviewgate/authority.go:360
EntryReference returns a stable human-readable evidence reference.
func FailedAttemptEntry(attempt Attempt, reason string, diagnosticPath string) session.Entry
Source: internal/core/reviewgate/projection.go:340
FailedAttemptEntry closes a provider attempt that did not produce an accepted dossier.
func LatestAttempt(ledger session.Session, opts Options) (Attempt, bool)
Source: internal/core/reviewgate/projection.go:268
LatestAttempt returns the newest review attempt in the current review window.
func NewAttemptID(taskID string, now time.Time) string
Source: internal/core/reviewgate/projection.go:309
NewAttemptID returns a deterministic attempt identifier for the task and start time.
func Project(ledger session.Session, model spec.Model, opts Options) State
Source: internal/core/reviewgate/projection.go:115
Project reduces a session ledger plus current task state into the review gate state. Readers should treat this as read-only; mutating commands append recovery entries based on the projected state.
func RunningAttemptEntry(input AttemptEntryInput) session.Entry
Source: internal/core/reviewgate/projection.go:318
RunningAttemptEntry builds the opening review_attempt entry.
func TerminalAuthority(ledger session.Session) Authority
Source: internal/core/reviewgate/authority.go:107
TerminalAuthority validates the review gate that authorized the latest complete event in an archived task ledger.
Types
type Attempt
Source: internal/core/reviewgate/projection.go:84
Attempt is normalized metadata for the latest current review attempt.
type Attempt struct {
Entry session.Entry
AttemptID string
Status string
Running bool
Stale bool
LeaseExpiresAt time.Time
HasLease bool
Provider string
Model string
Mode corereview.Mode
PassCount int
Reason string
DiagnosticPath string
}Fields
Entry session.EntryAttemptID stringStatus stringRunning boolStale boolLeaseExpiresAt time.TimeHasLease boolProvider stringModel stringMode corereview.ModePassCount intReason stringDiagnosticPath string
type AttemptEntryInput
Source: internal/core/reviewgate/projection.go:101
AttemptEntryInput contains the typed metadata stamped onto review_attempt entries.
type AttemptEntryInput struct {
AttemptID string
LeaseExpiresAt time.Time
Mode corereview.Mode
Provider string
Model string
PassCount int
Reason string
Output string
}Fields
AttemptID stringLeaseExpiresAt time.TimeMode corereview.ModeProvider stringModel stringPassCount intReason stringOutput string
type Authority
Source: internal/core/reviewgate/authority.go:13
Authority describes the review evidence that authorizes completion.
type Authority struct {
Found bool
Completed bool
Valid bool
HumanReviewed bool
Reason string
Actual string
Evidence []string
ReviewEntry session.Entry
ReceiptEntry session.Entry
CompleteEntry session.Entry
Dossier corereview.Dossier
HasDossier bool
Receipt receipt.Envelope
HasReceipt bool
}Fields
Found boolCompleted boolValid boolHumanReviewed boolReason stringActual stringEvidence []stringReviewEntry session.EntryReceiptEntry session.EntryCompleteEntry session.EntryDossier corereview.DossierHasDossier boolReceipt receipt.EnvelopeHasReceipt bool
func Kind() string
Source: internal/core/reviewgate/authority.go:39
Kind returns a stable label for the completion authority.
func Provider() string
Source: internal/core/reviewgate/authority.go:53
Provider returns the provider that produced the authorizing review.
func RefusalSuffix() string
Source: internal/core/reviewgate/authority.go:81
RefusalSuffix summarizes terminal authority for commands that cannot operate on archived work.
func Status() string
Source: internal/core/reviewgate/authority.go:31
Status returns valid or invalid for display surfaces.
func Summary() string
Source: internal/core/reviewgate/authority.go:69
Summary returns the best available human-readable authority summary.
func Verdict() string
Source: internal/core/reviewgate/authority.go:61
Verdict returns the authorizing review verdict.
type Kind
Source: internal/core/reviewgate/projection.go:28
Kind is the stable review gate projection state.
type Kind stringtype Options
Source: internal/core/reviewgate/projection.go:53
Options configures review gate projection.
type Options struct {
Now time.Time
AttemptLease time.Duration
WorkspaceSeal WorkspaceSeal
HasWorkspaceSeal bool
MaterialSeal reviewevidence.MaterialSeal
HasMaterialSeal bool
}Fields
Now time.TimeAttemptLease time.DurationWorkspaceSeal WorkspaceSealHasWorkspaceSeal boolMaterialSeal reviewevidence.MaterialSealHasMaterialSeal bool
type State
Source: internal/core/reviewgate/projection.go:63
State is the single read model for review gate lifecycle decisions.
type State struct {
Kind Kind
TaskID string
Reason string
Actual string
Next string
Evidence []string
Blockers []string
CanStartReview bool
ShouldAbandonAttempt bool
ReviewBlockedUntilBuild bool
Authority Authority
LatestAttempt Attempt
HasAttempt bool
LatestReview session.Entry
HasReview bool
Dossier corereview.Dossier
HasDossier bool
}Fields
Kind KindTaskID stringReason stringActual stringNext stringEvidence []stringBlockers []stringCanStartReview boolShouldAbandonAttempt boolReviewBlockedUntilBuild boolAuthority AuthorityLatestAttempt AttemptHasAttempt boolLatestReview session.EntryHasReview boolDossier corereview.DossierHasDossier bool
type WorkspaceSeal
Source: internal/core/reviewgate/projection.go:46
WorkspaceSeal is the current workspace seal used to decide whether a passing review still covers the files being completed.
type WorkspaceSeal struct {
Head string
Dirty string
Diff string
}Fields
Head stringDirty stringDiff string
