reviewservice

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommentNotFound = errors.New("review comment not found")

Functions

This section is empty.

Types

type Catalog

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

func NewCatalog

func NewCatalog(provider ContextProvider, store MutationStore) *Catalog

func (*Catalog) GetCommitDiff added in v0.2.2

func (catalog *Catalog) GetCommitDiff(ctx context.Context, id, oid string) (review.RepositoryDiff, error)

func (*Catalog) GetCommitPatch added in v0.2.2

func (catalog *Catalog) GetCommitPatch(ctx context.Context, id, oid, fileID string) (review.FilePatch, error)

func (*Catalog) GetCommits added in v0.2.2

func (catalog *Catalog) GetCommits(ctx context.Context, id string) (CommitList, error)

func (*Catalog) GetDiff

func (catalog *Catalog) GetDiff(ctx context.Context, id string, scope review.DiffMode) (review.RepositoryDiff, error)

func (*Catalog) GetPatch

func (catalog *Catalog) GetPatch(ctx context.Context, id string, scope review.DiffMode, fileID string) (review.FilePatch, error)

func (*Catalog) ListContexts

func (catalog *Catalog) ListContexts(ctx context.Context, limit int, cursor string, filter ingestion.Filter) (contextservice.Page, error)

func (*Catalog) Review

func (catalog *Catalog) Review(ctx context.Context, id string) (*Service, error)

type Comment

type Comment struct {
	review.ReviewComment
	Applicability review.Applicability `json:"applicability"`
	Actionable    bool                 `json:"actionable"`
}

type CommentNotFoundError

type CommentNotFoundError struct {
	CommentID string
}

func (*CommentNotFoundError) Error

func (err *CommentNotFoundError) Error() string

func (*CommentNotFoundError) Unwrap

func (err *CommentNotFoundError) Unwrap() error

type CommentStore

type CommentStore interface {
	Comments(context.Context, string) ([]review.ReviewComment, error)
	PutComment(context.Context, string, review.ReviewComment) error
	ReplaceComment(context.Context, string, review.ReviewComment) (bool, error)
}

type CommitList added in v0.2.2

type CommitList struct {
	Commits []review.CommitSummary `json:"commits"`
	Omitted int                    `json:"omitted"`
}

CommitList is the context's captured commits, oldest first.

type CommitStore added in v0.2.2

type CommitStore interface {
	ObservationCommits(context.Context, string, string) ([]review.CommitSummary, review.CommitRange, error)
	ObservationCommitSnapshot(context.Context, string, string, string) (review.RepositoryDiff, error)
	ObservationCommitFileVersion(context.Context, string, string, string, string) (reviewdata.FileVersion, error)
	ObservationCommitPatch(context.Context, string, string, string, string, string) (review.FilePatch, error)
}

CommitStore reads an owner's captured branch commits. Commit diffs are a read-only lens: they carry no comments or reviewed marks.

type ContextProvider

type ContextProvider interface {
	ListFiltered(context.Context, int, string, ingestion.Filter) (contextservice.Page, error)
	Resolve(context.Context, string) (reviewsession.Session, error)
}

ContextProvider must resolve IDs within the authenticated user's catalog. Resolve validates ownership and expiry before any review storage is accessed.

type CreateCommentInput

type CreateCommentInput struct {
	DiffID      string          `json:"diffId"`
	VersionID   string          `json:"versionId"`
	FileID      string          `json:"fileId"`
	Scope       review.DiffMode `json:"scope"`
	FileVersion string          `json:"fileVersion"`
	Target      string          `json:"target,omitempty"`
	Side        string          `json:"side"`
	Start       int             `json:"start"`
	End         int             `json:"end"`
	Body        string          `json:"body"`
}

type DeletedComments

type DeletedComments struct {
	Comments []review.ReviewComment `json:"comments"`
	Deleted  int                    `json:"deleted"`
}

type ExportCommentsInput

type ExportCommentsInput struct {
	Revision, Scope, CommentID string
	IncludeResolved            bool
}

type Resolution

type Resolution struct {
	CommentID string `json:"comment_id"`
	Status    string `json:"status"`
}

type Service

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

func New

func New(active reviewsession.Session, store MutationStore) *Service

func (*Service) CarryComment added in v0.2.1

func (service *Service) CarryComment(ctx context.Context, commentID string) (review.ReviewComment, error)

CarryComment keeps an open comment whose code changed or is no longer changed as a file comment on this context's snapshot. It preserves the original code and selection.

func (*Service) ClearMarks

func (service *Service) ClearMarks(ctx context.Context, mode review.DiffMode) error

func (*Service) Comments

func (service *Service) Comments(ctx context.Context) ([]review.ReviewComment, error)

Comments returns the stream's comments placed in this context.

func (*Service) CommitContents added in v0.2.2

func (service *Service) CommitContents(ctx context.Context, oid, fileID, fileVersion string) (review.FileContents, error)

func (*Service) CommitPatch added in v0.2.2

func (service *Service) CommitPatch(ctx context.Context, oid, fileID, fileVersion string) (review.FilePatch, error)

CommitPatch validates the file reference before reading its stored preview.

func (*Service) CommitSnapshot added in v0.2.2

func (service *Service) CommitSnapshot(ctx context.Context, oid string) (review.RepositoryDiff, error)

CommitSnapshot reads a captured commit's diff against its first parent.

func (*Service) Commits added in v0.2.2

func (service *Service) Commits(ctx context.Context) (CommitList, error)

func (*Service) CreateComment

func (service *Service) CreateComment(ctx context.Context, body CreateCommentInput) (review.ReviewComment, error)

func (*Service) CurrentContents added in v0.2.1

func (service *Service) CurrentContents(ctx context.Context, mode review.DiffMode, diffID, versionID, fileID, fileVersion string) (review.FileContents, error)

func (*Service) CurrentFile

func (service *Service) CurrentFile(ctx context.Context, mode review.DiffMode, diffID, versionID, fileID, fileVersion string) (review.RepositoryDiff, review.ChangedFile, error)

func (*Service) CurrentPatch added in v0.2.1

func (service *Service) CurrentPatch(ctx context.Context, mode review.DiffMode, diffID, versionID, fileID, fileVersion string) (review.FilePatch, error)

CurrentPatch validates the caller's immutable scope and file references before reading the preview. Scope conflicts take precedence over missing file errors.

func (*Service) DeleteComment

func (service *Service) DeleteComment(ctx context.Context, id string) (bool, error)

func (*Service) DeleteComments

func (service *Service) DeleteComments(ctx context.Context, selection string) (DeletedComments, error)

func (*Service) DeleteMark

func (service *Service) DeleteMark(ctx context.Context, mode review.DiffMode, id string) error

func (*Service) ExportComments

func (service *Service) ExportComments(ctx context.Context, input ExportCommentsInput) (string, error)

func (*Service) ImportComments

func (service *Service) ImportComments(ctx context.Context, input []review.ReviewComment) ([]review.ReviewComment, error)

func (*Service) ListComments

func (service *Service) ListComments(ctx context.Context, includeResolved bool) ([]Comment, error)

ListComments returns the stream's comments placed in this context. Only open comments that render on current lines are actionable.

func (*Service) Marks

func (service *Service) Marks(ctx context.Context, mode review.DiffMode) ([]review.ReviewMark, error)

func (*Service) OwnsDiff added in v0.2.1

func (service *Service) OwnsDiff(id string) bool

OwnsDiff reports whether a diff identity belongs to this context.

func (*Service) Patch added in v0.2.1

func (service *Service) Patch(ctx context.Context, mode review.DiffMode, fileID string) (review.FilePatch, error)

Patch reads a stored file preview without materializing the scope manifest.

func (*Service) PutMark

func (service *Service) PutMark(ctx context.Context, mode review.DiffMode, fileID, versionID, fileVersion string) (review.ReviewMark, error)

func (*Service) ResolveComment

func (service *Service) ResolveComment(ctx context.Context, commentID string) (Resolution, error)

func (*Service) Session added in v0.2.1

func (service *Service) Session() reviewsession.Session

Session is the resolved context the service is bound to.

func (*Service) Snapshot

func (service *Service) Snapshot(ctx context.Context, mode review.DiffMode) (review.RepositoryDiff, error)

Snapshot reads and capability checks belong to the application, shared by transports.

func (*Service) UpdateComment

func (service *Service) UpdateComment(ctx context.Context, commentID string, body UpdateCommentInput) (review.ReviewComment, error)

func (*Service) Version added in v0.2.1

func (service *Service) Version(ctx context.Context, diffID, versionID string) (review.RepositoryDiff, error)

Version reads a stored snapshot version of one of this context's diffs.

type UpdateCommentInput

type UpdateCommentInput struct {
	Body   *string `json:"body"`
	Status *string `json:"status"`
}

Jump to

Keyboard shortcuts

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