review

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSessionNotFound = errors.New("review session not found")
)

Sentinel errors for review operations.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID          string
	SessionID   string
	StartLine   int
	EndLine     int
	ContextText string
	CommentText string
	CreatedAt   time.Time
}

Comment represents inline feedback on a document section.

type Session

type Session struct {
	ID           string
	DocumentPath string
	ContentHash  string // SHA256 hash of document content
	CreatedAt    time.Time
	FinalizedAt  *time.Time // nil if not finalized
}

Session represents an active review session for a document.

func (Session) IsFinalized

func (s Session) IsFinalized() bool

IsFinalized returns true if the review session has been finalized.

type Store

type Store interface {
	// CreateSession creates a new review session for a document with content hash.
	// Returns error if session for document+hash already exists.
	CreateSession(ctx context.Context, documentPath string, contentHash string) (Session, error)

	// GetSession returns the most recent review session for the given document.
	// Returns ErrSessionNotFound if not found.
	GetSession(ctx context.Context, documentPath string) (Session, error)

	// GetSessionByHash returns a review session for the given document and content hash.
	// Returns ErrSessionNotFound if not found.
	GetSessionByHash(ctx context.Context, documentPath string, contentHash string) (Session, error)

	// CleanupStaleSessions removes review sessions for a document with different content hash.
	// Used to clean up sessions when document content changes.
	CleanupStaleSessions(ctx context.Context, documentPath string, currentHash string) error

	// FinalizeSession marks a review session as finalized.
	// Returns ErrSessionNotFound if not found.
	FinalizeSession(ctx context.Context, sessionID string) error

	// DeleteSession removes a review session and all associated comments.
	// Returns ErrSessionNotFound if not found.
	DeleteSession(ctx context.Context, sessionID string) error

	// SaveComment adds a comment to a review session.
	SaveComment(ctx context.Context, comment Comment) error

	// ListComments returns all comments for a review session, sorted by start line.
	ListComments(ctx context.Context, sessionID string) ([]Comment, error)

	// UpdateComment updates the comment text for an existing comment.
	UpdateComment(ctx context.Context, comment Comment) error

	// DeleteComment removes a specific comment.
	DeleteComment(ctx context.Context, commentID string) error
}

Store defines persistence operations for review sessions and comments.

Jump to

Keyboard shortcuts

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