Documentation
¶
Index ¶
- Constants
- Variables
- func RegisteredCodes() []string
- type CheckResult
- type DetectedProject
- type DiagnosticCheck
- type Finding
- type InvalidSessionIdentityCheck
- type ManualSessionNameProjectMismatchCheck
- type OrphanedObservationSessionCheck
- type ProjectReclassifyAction
- type Registry
- type RepairCounts
- type RepairMode
- type RepairPlan
- type RepairSkip
- type Report
- type Runner
- type SQLiteLockContentionCheck
- type Scope
- type SessionProjectDirectoryMismatchCheck
- type Summary
- type SyncMutationRequiredFieldsCheck
- type UnownedSessionProjectCheck
Constants ¶
const ( CheckSessionProjectDirectoryMismatch = "session_project_directory_mismatch" CheckManualSessionNameProjectMismatch = "manual_session_name_project_mismatch" CheckSyncMutationRequiredFields = "sync_mutation_required_fields" CheckInvalidSessionIdentity = "invalid_session_identity" CheckOrphanedObservationSession = "orphaned_observation_session" CheckUnownedSessionProject = "unowned_session_project" CheckSQLiteLockContention = "sqlite_lock_contention" )
const ( StatusOK = "ok" StatusWarning = "warning" StatusBlocked = "blocked" StatusError = "error" SeverityInfo = "info" SeverityWarning = "warning" SeverityError = "error" SeverityBlocking = "blocking" )
const ReasonQuarantinedPulledSessionIdentity = "quarantined_pulled_session_identity"
ReasonQuarantinedPulledSessionIdentity marks a finding of CheckInvalidSessionIdentity that describes a pulled session mutation the apply path skipped rather than a corrupt local source row.
Variables ¶
var ErrInvalidCheck = errors.New("invalid diagnostic check")
Functions ¶
func RegisteredCodes ¶
func RegisteredCodes() []string
Types ¶
type CheckResult ¶
type CheckResult struct {
CheckID string `json:"check_id"`
Result string `json:"result"`
Severity string `json:"severity"`
ReasonCode string `json:"reason_code"`
Message string `json:"message"`
Why string `json:"why"`
Evidence json.RawMessage `json:"evidence"`
SafeNextStep string `json:"safe_next_step"`
RequiresConfirmation bool `json:"requires_confirmation"`
Findings []Finding `json:"findings,omitempty"`
}
type DetectedProject ¶
type DiagnosticCheck ¶
type Finding ¶
type Finding struct {
CheckID string `json:"check_id"`
Severity string `json:"severity"`
ReasonCode string `json:"reason_code"`
Message string `json:"message"`
Why string `json:"why"`
Evidence json.RawMessage `json:"evidence"`
SafeNextStep string `json:"safe_next_step"`
RequiresConfirmation bool `json:"requires_confirmation"`
}
type InvalidSessionIdentityCheck ¶
type InvalidSessionIdentityCheck struct{}
func (InvalidSessionIdentityCheck) Code ¶
func (InvalidSessionIdentityCheck) Code() string
func (InvalidSessionIdentityCheck) Run ¶
func (c InvalidSessionIdentityCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type ManualSessionNameProjectMismatchCheck ¶
type ManualSessionNameProjectMismatchCheck struct{}
func (ManualSessionNameProjectMismatchCheck) Code ¶
func (ManualSessionNameProjectMismatchCheck) Code() string
func (ManualSessionNameProjectMismatchCheck) Run ¶
func (c ManualSessionNameProjectMismatchCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type OrphanedObservationSessionCheck ¶
type OrphanedObservationSessionCheck struct{}
func (OrphanedObservationSessionCheck) Code ¶
func (OrphanedObservationSessionCheck) Code() string
func (OrphanedObservationSessionCheck) Run ¶
func (c OrphanedObservationSessionCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type ProjectReclassifyAction ¶
type ProjectReclassifyAction struct {
SessionID string `json:"session_id"`
FromProject string `json:"from_project"`
ToProject string `json:"to_project"`
ReasonCode string `json:"reason_code"`
EvidenceSource string `json:"evidence_source,omitempty"`
EvidencePath string `json:"evidence_path,omitempty"`
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func DefaultRegistry ¶
func DefaultRegistry() Registry
func NewRegistry ¶
func NewRegistry(checks ...DiagnosticCheck) Registry
func (Registry) Checks ¶
func (r Registry) Checks() []DiagnosticCheck
type RepairCounts ¶
type RepairCounts struct {
SessionsPlanned int64 `json:"sessions_planned"`
ObservationsPlanned int64 `json:"observations_planned"`
PromptsPlanned int64 `json:"prompts_planned"`
SessionsApplied int64 `json:"sessions_applied"`
ObservationsApplied int64 `json:"observations_applied"`
PromptsApplied int64 `json:"prompts_applied"`
}
type RepairMode ¶
type RepairMode string
const ( RepairModePlan RepairMode = "plan" RepairModeDryRun RepairMode = "dry_run" RepairModeApply RepairMode = "apply" )
type RepairPlan ¶
type RepairPlan struct {
Project string `json:"project"`
Check string `json:"check"`
Mode RepairMode `json:"mode"`
Status string `json:"status"`
Actions []ProjectReclassifyAction `json:"actions"`
Skipped []RepairSkip `json:"skipped,omitempty"`
Counts RepairCounts `json:"counts"`
BackupPath string `json:"backup_path,omitempty"`
}
func BuildRepairPlan ¶
func BuildRepairPlan(ctx context.Context, scope Scope, report Report, check string, mode RepairMode) (RepairPlan, error)
type RepairSkip ¶
type Report ¶
type Report struct {
Status string `json:"status"`
Project string `json:"project,omitempty"`
Summary Summary `json:"summary"`
Checks []CheckResult `json:"checks"`
}
func ErrorReport ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunnerWithRegistry ¶
type SQLiteLockContentionCheck ¶
type SQLiteLockContentionCheck struct{}
func (SQLiteLockContentionCheck) Code ¶
func (SQLiteLockContentionCheck) Code() string
func (SQLiteLockContentionCheck) Run ¶
func (c SQLiteLockContentionCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type SessionProjectDirectoryMismatchCheck ¶
type SessionProjectDirectoryMismatchCheck struct{}
func (SessionProjectDirectoryMismatchCheck) Code ¶
func (SessionProjectDirectoryMismatchCheck) Code() string
func (SessionProjectDirectoryMismatchCheck) Run ¶
func (c SessionProjectDirectoryMismatchCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type SyncMutationRequiredFieldsCheck ¶
type SyncMutationRequiredFieldsCheck struct{}
func (SyncMutationRequiredFieldsCheck) Code ¶
func (SyncMutationRequiredFieldsCheck) Code() string
func (SyncMutationRequiredFieldsCheck) Run ¶
func (c SyncMutationRequiredFieldsCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
type UnownedSessionProjectCheck ¶
type UnownedSessionProjectCheck struct{}
func (UnownedSessionProjectCheck) Code ¶
func (UnownedSessionProjectCheck) Code() string
func (UnownedSessionProjectCheck) Run ¶
func (c UnownedSessionProjectCheck) Run(ctx context.Context, scope Scope) (CheckResult, error)
Run reports the sessions that identify no project. A database upgraded from the schema where sessions.project was nullable keeps those rows intact, and they are the population the ownership errors send to doctor, so leaving them unreported would answer that referral with an empty report.
The listing is deliberately unscoped even when scope.Project is set: an unowned session belongs to no project, so a project-scoped query can never return it, and a user who runs `engram doctor --project <name>` after an ownership failure must still be shown the rows that caused it.