store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DocTypeUpstreamRelease = "upstream_release"
	DocTypeLearning        = "triage_learning"
)

Document type constants.

View Source
const (
	StageNew           = "new"
	StageClarifying    = "clarifying"
	StageResearching   = "researching"
	StageReviewPending = "review_pending"
	StageRevision      = "revision"
	StageApproved      = "approved"
	StageComplete      = "complete"
	StageContextBrief  = "context_brief"
)

Agent session stage constants.

View Source
const (
	GateClarification = "clarification_approval"
	GateResearch      = "research_approval"
	GatePR            = "pr_approval"
	GatePromotePublic = "promote_to_public"
)

Approval gate type constants.

View Source
const (
	ApprovalPending           = "pending"
	ApprovalApproved          = "approved"
	ApprovalRejected          = "rejected"
	ApprovalRevisionRequested = "revision_requested"
)

Approval status constants.

View Source
const (
	ApprovalModeManual     = "manual"     // always require human approval (default)
	ApprovalModeConfidence = "confidence" // auto-approve if quality score >= threshold
)

ApprovalMode controls how the agent handles the review gate.

View Source
const (
	RecencyRecentMonths = 6
	RecencyMidMonths    = 12
)
View Source
const EmbeddingDim = 768

Variables

View Source
var AllSeedableDocTypes = append(
	append(append([]string{"troubleshooting", "configuration"}, EnhancementDocTypes...),
		UpstreamDocTypes...),
	DocTypeLearning,
)

AllSeedableDocTypes is the union of all valid doc_type values for the seed command.

View Source
var EnhancementDocTypes = []string{"roadmap", "adr", "research"}

EnhancementDocTypes lists the document types that Phase 4a searches for enhancement context.

View Source
var UpstreamDocTypes = []string{DocTypeUpstreamRelease, "upstream_issue"}

UpstreamDocTypes lists the document types for upstream dependency docs (e.g. Electron release notes, version-tagged issues).

Functions

func ClampWeeks

func ClampWeeks(w int) int

ClampWeeks normalises a week count to [1, 52], defaulting 0 or negative to 12.

func ConnectPool

func ConnectPool(ctx context.Context, databaseURL string) (*pgxpool.Pool, error)

ConnectPool creates a new pgxpool connection pool from a database URL.

func Migrate added in v0.1.1

func Migrate(ctx context.Context, pool *pgxpool.Pool, logger *slog.Logger) error

Migrate applies any pending SQL migrations embedded under migrations/. Applied migrations are tracked in schema_migrations by filename. Each file is applied inside a transaction. Missing migrations are applied in sorted filename order; filename 005 is intentionally skipped per project history. A session-level PostgreSQL advisory lock serialises concurrent invocations so that overlapping Cloud Run deployments can't race on the migration.

Types

type AgentDetail

type AgentDetail struct {
	ID             int64           `json:"id"`
	Repo           string          `json:"repo"`
	IssueNumber    int             `json:"issue_number"`
	ShadowRepo     string          `json:"shadow_repo"`
	ShadowIssue    int             `json:"shadow_issue"`
	Stage          string          `json:"stage"`
	RoundTripCount int             `json:"round_trip_count"`
	AuditLog       []AuditLogEntry `json:"audit_log"`
	CreatedAt      string          `json:"created_at"`
}

AgentDetail holds full detail for a single agent session including its audit log.

type AgentSession

type AgentSession struct {
	ID                int64
	Repo              string
	IssueNumber       int
	ShadowRepo        string
	ShadowIssueNumber int
	Stage             string
	Context           map[string]any
	RoundTripCount    int
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

AgentSession tracks an agentic issue-resolution session.

type ApprovalGate

type ApprovalGate struct {
	ID         int64
	SessionID  int64
	GateType   string
	Status     string
	Approver   string
	CreatedAt  time.Time
	ResolvedAt *time.Time
}

ApprovalGate represents a human-in-the-loop checkpoint in the agent workflow.

type AuditEntry

type AuditEntry struct {
	ID                int64
	SessionID         int64
	ActionType        string
	InputHash         string
	OutputSummary     string
	SafetyCheckPassed bool
	ConfidenceScore   float32
	QualityScore      *int // holdout judge score (0-100), nil if not evaluated
	CreatedAt         time.Time
}

AuditEntry records a single action taken by the agent for auditability.

type AuditLogEntry

type AuditLogEntry struct {
	ActionType      string  `json:"action_type"`
	OutputSummary   string  `json:"output_summary"`
	SafetyPassed    bool    `json:"safety_passed"`
	ConfidenceScore float64 `json:"confidence_score"`
	CreatedAt       string  `json:"created_at"`
}

AuditLogEntry records a single action taken by the agent, for dashboard drill-down. Named AuditLogEntry to avoid collision with the AuditEntry type in models.go.

type BotComment

type BotComment struct {
	ID          int64
	Repo        string
	IssueNumber int
	CommentID   int64
	PhasesRun   []string
	ThumbsUp    int
	ThumbsDown  int
	CreatedAt   time.Time
}

BotComment tracks a bot comment on a GitHub issue.

type DailyBucket

type DailyBucket struct {
	Date  string `json:"date"`
	Count int    `json:"count"`
}

DailyBucket holds a date string and an event count for time-series charts.

type DashboardStats

type DashboardStats struct {
	TotalComments         int                `json:"total_comments"`
	TotalThumbsUp         int                `json:"total_thumbs_up"`
	TotalThumbsDown       int                `json:"total_thumbs_down"`
	PhaseBreakdown        map[string]int     `json:"phase_breakdown"`
	DocumentCounts        map[string]int     `json:"document_counts"`
	IssueCount            int                `json:"issue_count"`
	RecentComments        []RecentComment    `json:"recent_comments"`
	SafetyStats           *SafetyStats       `json:"safety_stats"`
	RoundTripDistribution []RoundTripBucket  `json:"round_trip_distribution"`
	PhaseHitRate          map[string]float64 `json:"phase_hit_rate"`
	FeedbackStats         *FeedbackStats     `json:"feedback_stats"`
	SynthesisStats        *SynthesisStats    `json:"synthesis_stats"`
	DailyTriageCounts     []DailyBucket      `json:"daily_triage_counts"`
	DailyAgentCounts      []DailyBucket      `json:"daily_agent_counts"`
	DailyFeedbackCounts   []DailyBucket      `json:"daily_feedback_counts"`
}

DashboardStats holds aggregated statistics for the dashboard.

type DocReference

type DocReference struct {
	ID           int64
	Repo         string
	SourceType   string
	SourceID     string
	TargetType   string
	TargetID     string
	Relationship string
}

DocReference represents a cross-reference between documents, issues, or PRs.

func ExtractReferences

func ExtractReferences(content string) []DocReference

ExtractReferences finds issue and ADR references in text content using regex.

type Document

type Document struct {
	ID        int64
	Repo      string
	DocType   string
	Title     string
	Content   string
	Metadata  map[string]any
	Embedding []float32 `json:"-"` // internal vector; never serialized over JSON APIs
	CreatedAt time.Time
	UpdatedAt time.Time
}

Document represents a documentation chunk (troubleshooting, roadmap, ADR, research).

type FeedbackSignal

type FeedbackSignal struct {
	ID          int64
	Repo        string
	IssueNumber int
	SignalType  string
	Details     map[string]any
	CreatedAt   time.Time
}

FeedbackSignal records a user feedback event (edit fill or @mention).

type FeedbackStats

type FeedbackStats struct {
	TotalEditSignals int              `json:"total_edit_signals"`
	TotalMentions    int              `json:"total_mentions"`
	FillRate         *float64         `json:"fill_rate"`
	RecentFeedback   []RecentFeedback `json:"recent_feedback"`
}

FeedbackStats holds aggregated feedback signal statistics.

type FindingSummary

type FindingSummary struct {
	Title      string   `json:"title"`
	Severity   string   `json:"severity"`
	Evidence   []string `json:"evidence"`
	Suggestion string   `json:"suggestion,omitempty"`
}

FindingSummary is a condensed representation of a synthesis finding.

type HealthAlert

type HealthAlert struct {
	Metric    string  `json:"metric"`
	Current   float64 `json:"current"`
	Threshold float64 `json:"threshold"`
	Message   string  `json:"message"`
}

HealthAlert represents a single threshold violation detected by the health monitor.

func EvaluateThresholds

func EvaluateThresholds(m *HealthMetrics) []HealthAlert

EvaluateThresholds checks health metrics against degradation thresholds and returns any alerts. This is a pure function with no side effects.

type HealthMetrics

type HealthMetrics struct {
	ConfidenceRecent7d  *float64 `json:"confidence_recent_7d"`
	ConfidenceAllTime   *float64 `json:"confidence_all_time"`
	StuckSessionCount   int      `json:"stuck_session_count"`
	TotalRecentSessions int      `json:"total_recent_sessions"`
	CheckedAt           string   `json:"checked_at"`
}

HealthMetrics holds operational health metrics queried from existing tables.

type Issue

type Issue struct {
	ID        int64
	Repo      string
	Number    int
	Title     string
	Summary   string
	State     string
	Labels    []string
	Milestone *string
	Embedding []float32 `json:"-"` // internal vector; never serialized over JSON APIs
	CreatedAt time.Time
	UpdatedAt time.Time
	ClosedAt  *time.Time
}

Issue represents a GitHub issue with its embedding.

type PhaseQuerier

type PhaseQuerier interface {
	FindSimilarDocuments(ctx context.Context, repo string, docTypes []string, embedding []float32, limit int) ([]SimilarDocument, error)
	FindSimilarIssues(ctx context.Context, repo string, embedding []float32, excludeNumber int, limit int) ([]SimilarIssue, error)
}

PhaseQuerier defines the database operations that triage phases require.

type RecentComment

type RecentComment struct {
	Repo        string   `json:"repo"`
	IssueNumber int      `json:"issue_number"`
	CommentID   int64    `json:"comment_id"`
	PhasesRun   []string `json:"phases_run"`
	ThumbsUp    int      `json:"thumbs_up"`
	ThumbsDown  int      `json:"thumbs_down"`
	CreatedAt   string   `json:"created_at"`
}

RecentComment represents a recent bot comment for the dashboard.

type RecentFeedback

type RecentFeedback struct {
	Repo        string `json:"repo"`
	IssueNumber int    `json:"issue_number"`
	SignalType  string `json:"signal_type"`
	CreatedAt   string `json:"created_at"`
}

RecentFeedback represents a recent feedback signal for the dashboard.

type RepoEvent

type RepoEvent struct {
	ID        int64
	Repo      string
	EventType string
	SourceRef string
	Summary   string
	Areas     []string
	Metadata  map[string]any
	CreatedAt time.Time
}

RepoEvent represents a recorded repository event in the journal.

type RoundTripBucket

type RoundTripBucket struct {
	RoundTrips int `json:"round_trips"`
	Count      int `json:"count"`
}

RoundTripBucket represents a count of sessions with a given round-trip count.

type SafetyStats

type SafetyStats struct {
	TotalActions  int      `json:"total_actions"`
	Passed        int      `json:"passed"`
	AvgConfidence *float64 `json:"avg_confidence"`
}

SafetyStats holds aggregated safety check statistics.

type SimilarDocument

type SimilarDocument struct {
	Document
	Distance float64
}

SimilarDocument is returned from similarity search with a distance score.

func ApplyHatBoost added in v0.1.1

func ApplyHatBoost(docs []SimilarDocument, keywords []string, boost float64) []SimilarDocument

ApplyHatBoost rescales distances downward (closer) for documents whose title or content contains any of the boost keywords (case-insensitive). Returns a new slice ordered ascending by the adjusted distance.

This is a soft rerank — documents without a keyword match keep their original distance. The adjusted distance is clamped at 0.

If keywords is empty or boost <= 0, the original slice is returned unchanged (same ordering, same distances).

func ApplyVersionBoost added in v0.1.1

func ApplyVersionBoost(docs []SimilarDocument, targetVersion string, exactBoost, adjacentBoost float64) []SimilarDocument

ApplyVersionBoost rescales distances downward for documents whose electron_version metadata matches or is adjacent to the target version. Returns a new slice ordered ascending by the adjusted distance.

type SimilarIssue

type SimilarIssue struct {
	Issue
	Distance float64
}

SimilarIssue is returned from similarity search with a distance score.

func ApplyRecencyBoost added in v0.1.1

func ApplyRecencyBoost(issues []SimilarIssue, recentBoost, midBoost float64) []SimilarIssue

ApplyRecencyBoost rescales distances downward (closer) for recent issues. Issues created within RecencyRecentMonths get recentBoost subtracted; issues within RecencyMidMonths get midBoost subtracted. Returns a new slice ordered ascending by the adjusted distance.

type StaleSession

type StaleSession struct {
	ID                int64
	ShadowRepo        string
	ShadowIssueNumber int
	SessionType       string // "agent" or "triage"
}

StaleSession holds the minimum info needed to close a stale shadow issue.

type Store

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

Store provides database operations for the triage bot.

func New

func New(pool *pgxpool.Pool) *Store

New creates a new Store with the given connection pool.

func (*Store) CheckAndRecordDelivery

func (s *Store) CheckAndRecordDelivery(ctx context.Context, deliveryID string) (bool, error)

CheckAndRecordDelivery atomically checks if a webhook delivery ID has been seen before and records it if not. Returns true if the delivery was already recorded (duplicate).

func (*Store) CleanupOldDeliveries

func (s *Store) CleanupOldDeliveries(ctx context.Context, olderThan time.Duration) (int64, error)

CleanupOldDeliveries deletes webhook delivery records older than the given duration. Returns the number of rows deleted.

func (*Store) CleanupOldEvents

func (s *Store) CleanupOldEvents(ctx context.Context, olderThan time.Duration) (int64, error)

CleanupOldEvents deletes events older than the given duration (retention policy).

func (*Store) ClearPendingPromotion added in v0.1.1

func (s *Store) ClearPendingPromotion(ctx context.Context, id int64) error

ClearPendingPromotion removes the pending-promotion marker, used after a successful retry.

func (*Store) CountEvents

func (s *Store) CountEvents(ctx context.Context, repo string) (int64, error)

CountEvents returns the total number of events for a repo.

func (*Store) CountRecentReferencesInvolving

func (s *Store) CountRecentReferencesInvolving(ctx context.Context, repo, docTitle string, since time.Time) (int, error)

CountRecentReferencesInvolving returns the count of references created since the given time where the document appears as either a source (by title) or a target (by target_id). This lets callers determine whether a document is actively being discussed in recent issues or PRs.

func (*Store) CountReferencesTo

func (s *Store) CountReferencesTo(ctx context.Context, repo, targetType, targetID string) (int, error)

CountReferencesTo returns the count of references to a given target.

func (*Store) CreateApprovalGate

func (s *Store) CreateApprovalGate(ctx context.Context, gate ApprovalGate) (int64, error)

CreateApprovalGate inserts a new approval gate and returns its ID.

func (*Store) CreateAuditEntry

func (s *Store) CreateAuditEntry(ctx context.Context, entry AuditEntry) error

CreateAuditEntry inserts a new audit log entry.

func (*Store) CreateSession

func (s *Store) CreateSession(ctx context.Context, sess AgentSession) (int64, error)

CreateSession inserts a new agent session and returns its ID.

func (*Store) CreateTriageSession

func (s *Store) CreateTriageSession(ctx context.Context, ts TriageSession) error

CreateTriageSession inserts a new triage session record.

func (*Store) DeleteDocumentsByVersion added in v0.1.1

func (s *Store) DeleteDocumentsByVersion(ctx context.Context, repo string, docTypes []string, version string) (int64, error)

DeleteDocumentsByVersion deletes all documents for a repo and doc types where metadata->>'electron_version' matches the given version string.

func (*Store) ExistingIssueNumbers added in v0.1.1

func (s *Store) ExistingIssueNumbers(ctx context.Context, repo string) (map[int]bool, error)

ExistingIssueNumbers returns the set of issue numbers already stored for a repo.

func (*Store) FindReferencesTo

func (s *Store) FindReferencesTo(ctx context.Context, repo, targetType, targetID string) ([]DocReference, error)

FindReferencesTo returns all documents/issues that reference the given target.

func (*Store) FindSimilarBlockedIssues added in v0.1.1

func (s *Store) FindSimilarBlockedIssues(ctx context.Context, repo string, embedding []float32, limit int) ([]SimilarIssue, error)

FindSimilarBlockedIssues returns open issues that carry the "blocked" label and whose embedding is near the given vector, ordered by ascending cosine distance.

func (*Store) FindSimilarDocuments

func (s *Store) FindSimilarDocuments(ctx context.Context, repo string, docTypes []string, embedding []float32, limit int) ([]SimilarDocument, error)

FindSimilarDocuments returns the top-k documents closest to the given embedding, filtered by repo and doc types.

func (*Store) FindSimilarIssues

func (s *Store) FindSimilarIssues(ctx context.Context, repo string, embedding []float32, excludeNumber int, limit int) ([]SimilarIssue, error)

FindSimilarIssues returns the top-k issues closest to the given embedding, excluding the specified issue number.

func (*Store) GetAgentSessionDetail

func (s *Store) GetAgentSessionDetail(ctx context.Context, repo string, issueNumber int) (*AgentDetail, error)

GetAgentSessionDetail returns full detail for the agent session matching repo+issueNumber, including all audit log entries. It returns nil if no session is found.

func (*Store) GetDailyAgentCounts

func (s *Store) GetDailyAgentCounts(ctx context.Context, repo string) ([]DailyBucket, error)

GetDailyAgentCounts returns a 30-day time series of agent session counts.

func (*Store) GetDailyFeedbackCounts

func (s *Store) GetDailyFeedbackCounts(ctx context.Context, repo string) ([]DailyBucket, error)

GetDailyFeedbackCounts returns a 30-day time series of feedback signal counts.

func (*Store) GetDailyTriageCounts

func (s *Store) GetDailyTriageCounts(ctx context.Context, repo string) ([]DailyBucket, error)

GetDailyTriageCounts returns a 30-day time series of triage session counts.

func (*Store) GetDashboardStats

func (s *Store) GetDashboardStats(ctx context.Context, repo string) (*DashboardStats, error)

GetDashboardStats retrieves aggregated triage statistics for a given repo.

func (*Store) GetFeedbackStats

func (s *Store) GetFeedbackStats(ctx context.Context, repo string) (*FeedbackStats, error)

GetFeedbackStats returns aggregated feedback statistics for the dashboard.

func (*Store) GetHealthMetrics

func (s *Store) GetHealthMetrics(ctx context.Context, repo string) (*HealthMetrics, error)

GetHealthMetrics queries operational health metrics from existing tables. Each query is independent; partial results are returned if individual queries fail.

func (*Store) GetPendingGate

func (s *Store) GetPendingGate(ctx context.Context, sessionID int64) (*ApprovalGate, error)

GetPendingGate retrieves the oldest pending approval gate for a session.

func (*Store) GetRecentFindings

func (s *Store) GetRecentFindings(ctx context.Context, repo string, since time.Time) (*SynthesisFindings, error)

GetRecentFindings returns classified synthesis findings from the most recent briefing_posted events for the given repo (up to the last 4 briefings).

func (*Store) GetSession

func (s *Store) GetSession(ctx context.Context, repo string, issueNumber int) (*AgentSession, error)

GetSession retrieves an agent session by repo and issue number.

func (*Store) GetSessionByShadow

func (s *Store) GetSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*AgentSession, error)

GetSessionByShadow retrieves an agent session by shadow repo and shadow issue number.

func (*Store) GetTriageSessionByShadow

func (s *Store) GetTriageSessionByShadow(ctx context.Context, shadowRepo string, shadowIssueNumber int) (*TriageSession, error)

GetTriageSessionByShadow returns the triage session for a given shadow issue, or nil if not found.

func (*Store) GetTriageSessionDetail

func (s *Store) GetTriageSessionDetail(ctx context.Context, repo string, issueNumber int) (*TriageDetail, error)

GetTriageSessionDetail returns full detail for the triage session matching repo+issueNumber. It returns nil if no session is found.

func (*Store) GetWeeklyTrends

func (s *Store) GetWeeklyTrends(ctx context.Context, repo string, weeks int) (*WeeklyTrends, error)

GetWeeklyTrends returns multi-metric weekly time-series data for the given repo. Each query is independent; partial results are returned if individual queries fail.

func (*Store) HasBotCommented

func (s *Store) HasBotCommented(ctx context.Context, repo string, issueNumber int) (bool, error)

HasBotCommented checks if the bot has already commented on the given issue.

func (*Store) HasTriageSession

func (s *Store) HasTriageSession(ctx context.Context, repo string, issueNumber int) (bool, error)

HasTriageSession returns true if a triage session already exists for the given issue.

func (*Store) IsPaused

func (s *Store) IsPaused(ctx context.Context, repo string) (bool, error)

IsPaused returns whether the bot is paused for a given repo.

func (*Store) ListBotComments

func (s *Store) ListBotComments(ctx context.Context, repo string) ([]BotComment, error)

ListBotComments returns all bot comments for a given repo.

func (*Store) ListDocumentsByType

func (s *Store) ListDocumentsByType(ctx context.Context, repo string, docTypes []string) ([]Document, error)

ListDocumentsByType returns all documents of the given types for a repo.

func (*Store) ListEvents

func (s *Store) ListEvents(ctx context.Context, repo string, since time.Time, eventTypes []string, limit int) ([]RepoEvent, error)

ListEvents returns events for a repo within a time window, ordered by created_at DESC.

func (*Store) ListPendingPromotions added in v0.1.1

func (s *Store) ListPendingPromotions(ctx context.Context) ([]TriageSession, error)

ListPendingPromotions returns open triage sessions that have a pending promotion marker set, ordered oldest-first so the cleanup cron attempts them in the order the maintainer approved them.

func (*Store) ListStaleSessions

func (s *Store) ListStaleSessions(ctx context.Context, staleDuration time.Duration) ([]StaleSession, error)

ListStaleSessions returns agent and triage sessions with open shadow issues that haven't been acted on within the given duration.

func (*Store) MarkPendingPromotion added in v0.1.1

func (s *Store) MarkPendingPromotion(ctx context.Context, id int64) error

MarkPendingPromotion stamps a triage session so a later cleanup pass can re-attempt the promotion of a received `lgtm` that failed to post on the source repo (typically a cold-start TLS handshake timeout against api.github.com).

func (*Store) MarkSessionComplete

func (s *Store) MarkSessionComplete(ctx context.Context, id int64) error

MarkSessionComplete sets an agent session's stage to "complete".

func (*Store) MarkTriageSessionClosed

func (s *Store) MarkTriageSessionClosed(ctx context.Context, id int64) error

MarkTriageSessionClosed sets the closed_at timestamp on a triage session.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping verifies database connectivity.

func (*Store) Pool

func (s *Store) Pool() *pgxpool.Pool

Pool returns the underlying connection pool. Used by integration tests for cleanup.

func (*Store) RecentDocumentsByType

func (s *Store) RecentDocumentsByType(ctx context.Context, repo string, docTypes []string, since time.Time) ([]Document, error)

RecentDocumentsByType returns documents of the given types ingested since the given time.

func (*Store) RecentIssuesWithEmbeddings

func (s *Store) RecentIssuesWithEmbeddings(ctx context.Context, repo string, since time.Time) ([]Issue, error)

RecentIssuesWithEmbeddings returns issues opened within the time window that have embeddings.

func (*Store) RecordBotComment

func (s *Store) RecordBotComment(ctx context.Context, comment BotComment) error

RecordBotComment records that the bot commented on an issue.

func (*Store) RecordEvent

func (s *Store) RecordEvent(ctx context.Context, event RepoEvent) error

RecordEvent inserts a single event into the journal.

func (*Store) RecordEvents

func (s *Store) RecordEvents(ctx context.Context, events []RepoEvent) error

RecordEvents inserts a batch of events into the journal.

func (*Store) RecordFeedbackSignal

func (s *Store) RecordFeedbackSignal(ctx context.Context, sig FeedbackSignal) error

RecordFeedbackSignal inserts a feedback signal row.

func (*Store) RecordReferences

func (s *Store) RecordReferences(ctx context.Context, repo, sourceType, sourceID string, refs []DocReference) error

RecordReferences inserts cross-references for a source document or issue.

func (*Store) ResolveApprovalGate

func (s *Store) ResolveApprovalGate(ctx context.Context, id int64, status string, approver string) error

ResolveApprovalGate updates the status, approver, and resolved_at timestamp of an approval gate.

func (*Store) SetPaused

func (s *Store) SetPaused(ctx context.Context, repo string, paused bool, by string) error

SetPaused sets the pause state for a repo.

func (*Store) UpdateIssueLabels added in v0.1.1

func (s *Store) UpdateIssueLabels(ctx context.Context, repo string, number int, labels []string) error

UpdateIssueLabels replaces the labels column for an issue without touching the embedding or any other field. Returns nil if the row does not exist (label events can arrive before the issue has been embedded; the next opened/edited event will populate the row).

func (*Store) UpdateReactions

func (s *Store) UpdateReactions(ctx context.Context, repo string, issueNumber, thumbsUp, thumbsDown int) error

UpdateReactions updates the thumbs up/down counts for a bot comment.

func (*Store) UpdateSessionStage

func (s *Store) UpdateSessionStage(ctx context.Context, id int64, stage string, sessionCtx map[string]any, roundTrips int) error

UpdateSessionStage updates the stage, context, and round-trip count for a session.

func (*Store) UpsertDocument

func (s *Store) UpsertDocument(ctx context.Context, doc Document) error

UpsertDocument inserts or updates a document and its embedding.

func (*Store) UpsertIssue

func (s *Store) UpsertIssue(ctx context.Context, issue Issue) error

UpsertIssue inserts or updates an issue and its embedding. If issue.CreatedAt is set (non-zero), it is used as the issue creation timestamp; otherwise the database default (now()) applies. On conflict, created_at is never overwritten.

type SynthesisFindings

type SynthesisFindings struct {
	AsOf     string           `json:"as_of"`
	Clusters []FindingSummary `json:"clusters"`
	Drift    []FindingSummary `json:"drift"`
	Upstream []FindingSummary `json:"upstream"`
}

SynthesisFindings holds classified findings from recent synthesis briefings.

type SynthesisStats added in v0.1.1

type SynthesisStats struct {
	TotalBriefings    int            `json:"total_briefings"`
	TotalFindings     int            `json:"total_findings"`
	FindingsByType    map[string]int `json:"findings_by_type"`
	RecentBriefing    string         `json:"recent_briefing,omitempty"`
	ProposalsAccepted int            `json:"proposals_accepted"`
	ProposalsRejected int            `json:"proposals_rejected"`
}

SynthesisStats tracks synthesis briefing activity.

type TriageDetail

type TriageDetail struct {
	ID            int64    `json:"id"`
	Repo          string   `json:"repo"`
	IssueNumber   int      `json:"issue_number"`
	ShadowRepo    string   `json:"shadow_repo"`
	ShadowIssue   int      `json:"shadow_issue"`
	TriageComment string   `json:"triage_comment"`
	PhasesRun     []string `json:"phases_run"`
	Promoted      bool     `json:"promoted"`
	CreatedAt     string   `json:"created_at"`
}

TriageDetail holds full detail for a single triage session.

type TriageSession

type TriageSession struct {
	ID                 int64
	Repo               string
	IssueNumber        int
	ShadowRepo         string
	ShadowIssueNumber  int
	TriageComment      string
	PhasesRun          []string
	CreatedAt          time.Time
	PendingPromotionAt *time.Time
}

TriageSession tracks a shadow issue created for triage review.

type WeeklyAgents

type WeeklyAgents struct {
	Week     string `json:"week"`
	Total    int    `json:"total"`
	Approved int    `json:"approved"`
	Rejected int    `json:"rejected"`
	Pending  int    `json:"pending"`
	Complete int    `json:"complete"`
}

WeeklyAgents tracks agent session outcomes per week.

type WeeklyFeedback

type WeeklyFeedback struct {
	Week      string `json:"week"`
	EditFills int    `json:"edit_fills"`
	Mentions  int    `json:"mentions"`
}

WeeklyFeedback tracks feedback signals per week.

type WeeklyPhases

type WeeklyPhases struct {
	Week               string  `json:"week"`
	MissingInfo        float64 `json:"missing_info"`
	DocSearch          float64 `json:"doc_search"`
	EnhancementContext float64 `json:"enhancement_context"`
}

WeeklyPhases tracks phase hit rates per week.

type WeeklyResponse

type WeeklyResponse struct {
	Week       string  `json:"week"`
	AvgSeconds float64 `json:"avg_seconds"`
}

WeeklyResponse tracks average response time per week.

type WeeklySynthesis

type WeeklySynthesis struct {
	Week      string `json:"week"`
	Briefings int    `json:"briefings"`
	Findings  int    `json:"findings"`
}

WeeklySynthesis tracks synthesis output per week.

type WeeklyTrends

type WeeklyTrends struct {
	Repo      string            `json:"repo"`
	Weeks     int               `json:"weeks"`
	Triage    []WeeklyTriage    `json:"triage"`
	Phases    []WeeklyPhases    `json:"phases"`
	Response  []WeeklyResponse  `json:"response_time"`
	Agents    []WeeklyAgents    `json:"agents"`
	Synthesis []WeeklySynthesis `json:"synthesis"`
	Feedback  []WeeklyFeedback  `json:"feedback"`
}

WeeklyTrends holds multi-metric weekly time-series data for trend reports.

type WeeklyTriage

type WeeklyTriage struct {
	Week     string  `json:"week"`
	Total    int     `json:"total"`
	Promoted int     `json:"promoted"`
	Rate     float64 `json:"rate"`
}

WeeklyTriage tracks triage volume and promotion rate per week.

Jump to

Keyboard shortcuts

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