Help us shape the future of Go! Take the 2026 Go Developer Survey

assessmentcomparison

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobKind                        = "assessment_comparison_generate"
	CodeIdempotencyKeyRequired     = "idempotency_key_required"
	CodeIdempotencyBodyMismatch    = "idempotency_body_mismatch"
	CodeIdempotencyRequestPending  = "idempotency_request_in_progress"
	CodeComparisonVersionConflict  = "comparison_version_conflict"
	CodeReviewCandidateMismatch    = "review_candidate_mismatch"
	CodeReviewSourceMissing        = "review_source_observation_missing"
	CodeReviewReasonRejected       = "review_reason_rejected"
	DefaultAssessmentItemPageLimit = 100
	MaxAssessmentItemPageLimit     = 200
)
View Source
const (
	DefaultComparisonBackfillBatch     = 500
	MaxComparisonBackfillBatch         = 2000
	DefaultComparisonBacklogWarning    = 500
	DefaultComparisonBacklogHardLimit  = 1000
	DefaultComparisonOldestActiveLimit = 15 * time.Minute
	DefaultComparisonRepairMaxAttempts = DefaultMaxAttempts
)
View Source
const (
	DefaultMaxAttempts = 3
	MaxAttempts        = 10
	RiskModelVersionV1 = 1
)

Variables

View Source
var (
	ErrComparisonBacklogHardLimit = errors.New("assessment comparison backlog hard limit reached")
	ErrComparisonOldestActive     = errors.New("assessment comparison oldest active job limit exceeded")
)

Functions

func ErrorCode

func ErrorCode(err error) string

Types

type APIError

type APIError struct {
	Code  string
	Cause error
}

func (*APIError) Error

func (err *APIError) Error() string

func (*APIError) Unwrap

func (err *APIError) Unwrap() error

type BackfillRequest

type BackfillRequest struct {
	TenantID          shared.ID
	Actor             string
	DryRun            bool
	RepairFailed      bool
	BatchSize         int
	BacklogWarning    int
	BacklogHardLimit  int
	OldestActiveLimit time.Duration
	AfterUpdatedAt    time.Time
	AfterCycleID      shared.ID
}

type BackfillResult

type BackfillResult struct {
	Processed           int
	Queued              int
	Existing            int
	WouldQueue          int
	Skipped             int
	RepairAttempted     int
	Repaired            int
	WouldRepair         int
	BacklogWarning      bool
	CheckpointUpdatedAt time.Time
	CheckpointCycleID   shared.ID
	Backlog             ports.AssessmentComparisonBacklog
}

type BackfillRunner

type BackfillRunner struct {
	// contains filtered or unexported fields
}

func NewBackfillRunner

func NewBackfillRunner(service comparisonBackfillService, cycles ports.AssessmentCycleListRepository, comparisons ports.AssessmentComparisonRepairRepository, clock ports.Clock, audit ports.AuditLogger) (*BackfillRunner, error)

func (*BackfillRunner) Run

func (runner *BackfillRunner) Run(ctx context.Context, request BackfillRequest) (BackfillResult, error)

type ComparisonView

type ComparisonView struct {
	ID                    shared.ID      `json:"id"`
	CycleID               shared.ID      `json:"cycle_id"`
	BaselineSnapshotID    shared.ID      `json:"baseline_snapshot_id"`
	CurrentSnapshotID     shared.ID      `json:"current_snapshot_id"`
	Mode                  domain.Mode    `json:"mode"`
	InputHash             string         `json:"input_hash"`
	AlgorithmVersion      int            `json:"algorithm_version"`
	FingerprintVersion    int            `json:"fingerprint_version"`
	RiskModelVersion      int            `json:"risk_model_version"`
	CoveragePolicyVersion int            `json:"coverage_policy_version"`
	Status                domain.Status  `json:"status"`
	Version               int64          `json:"version"`
	Attempts              int            `json:"attempts"`
	FailureCode           string         `json:"failure_code,omitempty"`
	ContentHash           string         `json:"content_hash,omitempty"`
	Summary               domain.Summary `json:"summary"`
	CreatedAt             time.Time      `json:"created_at"`
	UpdatedAt             time.Time      `json:"updated_at"`
	CompletedAt           *time.Time     `json:"completed_at,omitempty"`
	SupersededAt          *time.Time     `json:"superseded_at,omitempty"`
	SupersededBy          shared.ID      `json:"superseded_by,omitempty"`
}

type ItemPage

type ItemPage struct {
	Items      []domain.Item `json:"items"`
	NextCursor string        `json:"next_cursor,omitempty"`
}

type Job

type Job struct {
	ComparisonID shared.ID `json:"comparison_id"`
}

type ListItemsInput

type ListItemsInput struct {
	TenantID     shared.ID
	ComparisonID shared.ID
	Cursor       string
	Limit        int
	Scope        domain.Scope
	Presence     string
	ChangeFlag   domain.ChangeFlag
	Severity     shared.Severity
	ProducerKind string
	FindingKind  string
	Disposition  string
	ReviewState  string
}

type QueueInput

type QueueInput struct {
	TenantID           shared.ID
	BaselineSnapshotID shared.ID
	CurrentSnapshotID  shared.ID
	Mode               assessmentcomparison.Mode
	FingerprintVersion int
	RiskModelVersion   int
	Actor              string
}

type QueueResult

type QueueResult struct {
	Comparison ComparisonView `json:"comparison"`
	Created    bool           `json:"created"`
}

type ReplaceInput

type ReplaceInput struct {
	TenantID     shared.ID
	ComparisonID shared.ID
	Actor        string
}

type RetainedRequest

type RetainedRequest struct {
	TenantID       shared.ID
	Actor          string
	Route          string
	IdempotencyKey string
}

type RetainedResponse

type RetainedResponse struct {
	StatusCode int
	Body       []byte
	Replayed   bool
}

type RetestVerificationReader

type RetestVerificationReader struct {
	// contains filtered or unexported fields
}

RetestVerificationReader projects append-only Finding retest decisions onto immutable lineage identities. The newest decision along the supplied Snapshot order is the single effective decision for an identity.

func (*RetestVerificationReader) ListEffectiveComparisonVerifications

func (reader *RetestVerificationReader) ListEffectiveComparisonVerifications(ctx context.Context, tenantID, cycleID shared.ID, snapshotIDs []shared.ID) ([]ports.AssessmentComparisonVerification, error)

type ReviewAction

type ReviewAction string
const (
	ReviewConfirm ReviewAction = "confirm"
	ReviewUnlink  ReviewAction = "unlink"
)

type ReviewInput

type ReviewInput struct {
	Request             RetainedRequest
	ComparisonID        shared.ID
	ItemID              shared.ID
	CandidateID         shared.ID
	SourceObservationID shared.ID
	TargetObservationID shared.ID
	ExpectedVersion     int64
	Action              ReviewAction
	Reason              string
}

type ReviewResult

type ReviewResult struct {
	OverrideEventID         shared.ID     `json:"override_event_id"`
	SupersededComparisonID  shared.ID     `json:"superseded_comparison_id"`
	ReplacementComparisonID shared.ID     `json:"replacement_comparison_id"`
	ReplacementStatus       domain.Status `json:"replacement_status"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) Generate

func (service *Service) Generate(ctx context.Context, input WorkInput) (assessmentcomparison.Comparison, error)

func (*Service) Get

func (service *Service) Get(ctx context.Context, tenantID, comparisonID shared.ID) (ComparisonView, error)

func (*Service) GetSummary

func (service *Service) GetSummary(ctx context.Context, tenantID, comparisonID shared.ID, scope domain.Scope) (domain.Summary, error)

func (*Service) HandleJob

func (service *Service) HandleJob(ctx context.Context, payload []byte) error

func (*Service) ListItems

func (service *Service) ListItems(ctx context.Context, input ListItemsInput) (ItemPage, error)

func (*Service) OnDeadLetter

func (service *Service) OnDeadLetter(ctx context.Context, payload []byte) error

func (*Service) QueueRetained

func (service *Service) QueueRetained(ctx context.Context, request RetainedRequest, input QueueInput) (RetainedResponse, error)

func (*Service) Recover

func (service *Service) Recover(ctx context.Context, input WorkInput) (assessmentcomparison.Comparison, error)

func (*Service) Repair

func (service *Service) Repair(ctx context.Context, input WorkInput) (assessmentcomparison.Comparison, error)

func (*Service) Replace

func (service *Service) Replace(ctx context.Context, input ReplaceInput) (assessmentcomparison.Comparison, bool, error)

func (*Service) Review

func (service *Service) Review(ctx context.Context, input ReviewInput) (RetainedResponse, error)

func (*Service) SetAPIStores

func (service *Service) SetAPIStores(requests ports.AssessmentCycleRequestStore, jobs ports.JobQueue, reviewer *lineageuc.Service)

func (*Service) SetObserver

func (service *Service) SetObserver(observer ports.AssessmentComparisonObserver)

type WorkInput

type WorkInput struct {
	TenantID     shared.ID
	ComparisonID shared.ID
	Actor        string
	MaxAttempts  int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL