startreview

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package startreview turns a verified "Start review" button click into a recorded review plus an in-place update of the PR's Slack message.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Composer

type Composer interface {
	ReviewingMarker(userID string, since time.Time) slack.Block
}

Composer renders the reviewer marker block.

type Handler

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

Handler consumes a parsed Slack interaction and, for a "start_review" click, records the click's user as a reviewer and appends a marker line to the PR message. Multiple distinct users may review the same PR; a user clicking again is a no-op (guarded in the app and enforced by the DB unique index).

func NewHandler

func NewHandler(reviews Reviews, messages Messages, slackUpdater SlackUpdater, composer Composer, logger *slog.Logger, now func() time.Time) *Handler

NewHandler builds a Handler. now is injected for deterministic tests.

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, interaction slackhook.Interaction) error

Handle implements slackhook.InteractionSink. Unactionable input is logged and ignored (returns nil); a returned error is reserved for genuine infrastructure failures. The HTTP layer responds 200 regardless.

type Messages

type Messages interface {
	Messages(ctx context.Context, repository string, prNumber int) ([]store.Message, error)
}

Messages confirms notifycat owns a message for the PR before acting on a click.

type Reviews

type Reviews interface {
	ActiveForUser(ctx context.Context, repository string, prNumber int, slackUserID string) (store.CodeReview, error)
	Start(ctx context.Context, repository string, prNumber int, slackUserID, slackUserName string) error
}

Reviews records and inspects per-PR review sessions.

type SlackUpdater

type SlackUpdater interface {
	UpdateMessageRawBlocks(ctx context.Context, channel, ts string, blocks []json.RawMessage, fallback string) error
}

SlackUpdater edits the PR message in place, passing the original blocks through untouched with the reviewer marker appended.

Jump to

Keyboard shortcuts

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