Documentation
¶
Overview ¶
Package codify opens pull requests that graduate repository lessons into steering notes. It never merges one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoClass reports an attempt to codify a lesson that has no task class. ErrNoClass = errors.New("codify: a lesson needs a task class before it can be codified") // ErrInvalidNote reports a steering note or class name that fails steering.Validate. ErrInvalidNote = errors.New("codify: steering note failed validation") // ErrNoConnection reports a repository without a factory GitHub App connection. ErrNoConnection = errors.New("codify: the repository has no factory connection") )
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface {
CodifyingLessons(ctx context.Context) ([]rooms.Lesson, error)
FinishCodify(ctx context.Context, repository string, number int, merged bool) (rooms.Lesson, error)
}
Broker reads lessons awaiting codify PR completion and reports PR outcomes back to the broker; *rooms.Client implements it.
type ErrTooLarge ¶
ErrTooLarge reports that appending the codified lesson would push the steering note past steering.MaxBytes.
type Meta ¶
type Meta struct {
Source string `json:"source,omitempty"`
RecallCount int `json:"recallCount,omitempty"`
}
Meta carries optional provenance metadata included in the pull request body.
type Result ¶
type Result struct {
Number int `json:"number"`
URL string `json:"url"`
Created bool `json:"created"`
}
Result describes the pull request opened or reused for a codified lesson.
type Service ¶
Service opens steering-note pull requests for repository lessons using the factory App.
func (*Service) Open ¶
func (s *Service) Open(ctx context.Context, repository, class, lessonID, text string, meta ...Meta) (Result, error)
Open opens a pull request on repository that appends lessonID/text to the steering note for class, idempotently reusing an already-open pull request on the codify branch.
type Watcher ¶
type Watcher struct {
Broker Broker
Git func(repository string) (promote.Git, bool)
Every time.Duration
RetryEvery time.Duration
Ticker func(d time.Duration) (<-chan time.Time, func())
After func(d time.Duration) <-chan time.Time
Log *slog.Logger
}
Watcher polls active lessons with open codify pull requests and updates the broker when those pull requests merge or close unmerged.