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:19
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:33
const (
KindReadyForReview Kind = "ready_for_review"
KindAttemptRunning Kind = "attempt_running"
KindAttemptStale Kind = "attempt_stale"
KindAttemptFailed Kind = "attempt_failed"
KindReviewFailed Kind = "review_failed"
KindReviewNeedsOperatorDecision Kind = "review_needs_operator_decision"
KindReviewPassed Kind = "review_passed"
KindReviewStaleAfterBuild Kind = "review_stale_after_build"
KindReviewStaleAfterSpec Kind = "review_stale_after_spec"
KindReviewStaleAfterWorkspace Kind = "review_stale_after_workspace"
KindCompletedAuthorized Kind = "completed_authorized"
KindInvalid Kind = "invalid"
)Functions
func AbandonedAttemptEntry(attempt Attempt, reason string) session.Entry
Source: internal/core/reviewgate/projection.go:499
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:489
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:425
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:494
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:410
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:457
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:137
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 RepairPacketCommand(taskID string, path string) string
Source: internal/core/reviewgate/projection.go:698
RepairPacketCommand records a locally repaired ReviewDossier without spending another external review call.
func ReviewRerunMaterialScope(ledger session.Session) []string
Source: internal/core/reviewgate/projection.go:320
ReviewRerunMaterialScope returns the scope needed to decide whether a post-build review rerun is meaningful after a failed review. An empty result means no current failed-review repair window needs material comparison.
func RunningAttemptEntry(input AttemptEntryInput) session.Entry
Source: internal/core/reviewgate/projection.go:466
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:94
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
ReviewedHead string
ReviewedDirty string
ReviewedDiff string
ReviewedSpec string
ReviewedScope []string
ReviewedMaterialDigest string
}Fields
Entry session.EntryAttemptID stringStatus stringRunning boolStale boolLeaseExpiresAt time.TimeHasLease boolProvider stringModel stringMode corereview.ModePassCount intReason stringDiagnosticPath stringReviewedHead stringReviewedDirty stringReviewedDiff stringReviewedSpec stringReviewedScope []stringReviewedMaterialDigest string
type AttemptEntryInput
Source: internal/core/reviewgate/projection.go:117
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
ReviewedHead string
ReviewedDirty string
ReviewedDiff string
ReviewedSpec string
ReviewedScope []string
ReviewedMaterialDigest string
}Fields
AttemptID stringLeaseExpiresAt time.TimeMode corereview.ModeProvider stringModel stringPassCount intReason stringOutput stringReviewedHead stringReviewedDirty stringReviewedDiff stringReviewedSpec stringReviewedScope []stringReviewedMaterialDigest 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:30
Kind is the stable review gate projection state.
type Kind stringtype Options
Source: internal/core/reviewgate/projection.go:56
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:66
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
ReviewRerunBlocked bool
OperatorDecisionRequired bool
Authority Authority
LatestAttempt Attempt
HasAttempt bool
LatestReview session.Entry
HasReview bool
Dossier corereview.Dossier
HasDossier bool
PriorFailedReview session.Entry
HasPriorFailedReview bool
PriorFailedDossier corereview.Dossier
HasPriorFailedDossier bool
BlockerFingerprints []string
}Fields
Kind KindTaskID stringReason stringActual stringNext stringEvidence []stringBlockers []stringCanStartReview boolShouldAbandonAttempt boolReviewBlockedUntilBuild boolReviewRerunBlocked boolOperatorDecisionRequired boolAuthority AuthorityLatestAttempt AttemptHasAttempt boolLatestReview session.EntryHasReview boolDossier corereview.DossierHasDossier boolPriorFailedReview session.EntryHasPriorFailedReview boolPriorFailedDossier corereview.DossierHasPriorFailedDossier boolBlockerFingerprints []string
type WorkspaceSeal
Source: internal/core/reviewgate/projection.go:49
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
