cireceipt

package
v1.2.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cireceipt is the run receipt the ci-ok job of .github/workflows/ci.yml writes at the end of every run: one ev:github row of the workflow_run shape, sender "runner", appended through internal/ghevent. The signed webhook receiver sits behind a tailscale funnel kept off by design, so the runner is the event source: our runners are self-hosted on the tailnet and run as the bench seat, and the run reports itself from inside, with no GitHub call.

The row's reader is ghevent.Reader (internal/ghevent), which blocks on ev:github for the pull requests it names and reads repo, number, kind, action, head, sender and at. The fields are exactly the ones `nova-sprint ci github --from-runner` wrote, so that reader is unchanged. The ci:<repo>:<sha>:gh fold and the pr:<repo>:<n> claim that verb also wrote are not written here: their only readers were nova-sprint's own (land pr, read brief --pr, its Lua).

A refused receipt names every refused field and what each wants in one error; a failed write is an error the verb turns into a red ci-ok, because a receipt that silently did not happen must never read as one that did. Repeat receipts from retries or reruns are acceptable wake hints for stream consumers.

Index

Constants

View Source
const Sender = "runner"

Sender is the ev:github sender of a row the runner appended.

Variables

This section is empty.

Functions

func Line

func Line(r Receipt, id string) string

Line is the verb's one line for a written receipt.

func Write

func Write(ctx context.Context, rdb *redis.Client, r Receipt) (string, error)

Write validates r and appends its row in one XADD, returning the entry id. It needs a seat with XADD on ev:github and writes no other key.

Types

type Receipt

type Receipt struct {
	Repo       string // owner/name
	SHA        string // the head the run tested: the PR head, else github.sha
	RunID      string // decimal github.run_id
	PR         string // the pull request number, "" when the event names none
	Workflow   string // github.workflow; runs of blanks become one dash
	Conclusion string // job.status of ci-ok: success, failure or cancelled
	At         string // RFC3339; "" means Now()
	// Now is the clock an empty At is stamped from; nil means time.Now.
	Now func() time.Time
}

Receipt is one run's result as the runner reports it.

func (Receipt) Entry

func (r Receipt) Entry() ghevent.Entry

Entry is the ev:github row of a validated receipt.

func (*Receipt) Validate

func (r *Receipt) Validate() error

Validate normalizes r and names every field a receipt cannot be written from, each with what the field wants, in one error (joined with "; ") so a caller fixes the call once.

Jump to

Keyboard shortcuts

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