afterupdate

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package afterupdate is the moment after an abcd update (spc-2610170635097509, step 6): the one line per release saying what changed, from the digest inside the binary, and the offer to run setup again where the update brings something this repository needs; and the record of what was shown and answered.

The record lives in abcd's user-level home, never in the repository:

~/.abcd.noindex/after-update/<root-sha>/<tag>.json  this repository's answer for one release
~/.abcd.noindex/after-update/news-seen              the newest release whose news this computer was shown

An answer is created exclusively, so of two sessions answering together the first wins; news-seen is replaced atomically under a lock and only ever raised. Only Record and MarkSeen write. Pending, Moment and Full read, so a session with no person to answer it (which runs neither) records nothing.

Nothing here reaches the network, and no word of the repository's tracked files reaches a line: versions pass launch.ParseReleaseTag, counts are numbers, titles are core's, and change lines come from the digest alone. The package returns values and never prints.

Index

Constants

View Source
const (
	AnswerYes    = "yes"
	AnswerNotNow = "not-now"
)

The answers the offer takes.

View Source
const FullCommand = "abcd update news --full"

FullCommand is the command that shows the full summary, named on every news line.

Variables

View Source
var (
	// ErrNotRelease is the refusal of a running binary that is not a release
	// (a dev build): it takes no part in the moment.
	ErrNotRelease = errors.New("this abcd is not a release build, so there is no update to record")
	// ErrNoOffer is Record's refusal where no offer applies: the repository's
	// setup version is not an older release than the running one, or the
	// repository has no root commit to key the answer on.
	ErrNoOffer = errors.New("no setup offer applies to this repository for this release")
	// ErrAlreadyAnswered is Record's refusal of a second answer for one
	// repository and release: the first stands.
	ErrAlreadyAnswered = errors.New("the offer for this release was already answered in this repository")
	// ErrBadAnswer is Record's refusal of an answer that is neither yes nor not-now.
	ErrBadAnswer = errors.New("the answer is yes or not-now")
)

Functions

func Answers added in v0.17.0

func Answers() []string

Answers returns the answers the offer takes: the one list Record checks an answer against and `update news --answer` declares.

func MarkSeen

func MarkSeen() error

MarkSeen records that this computer was shown the news up to the running release, raising news-seen and never lowering it.

Types

type Answer

type Answer struct {
	SchemaVersion int    `json:"schema_version"`
	Release       string `json:"release"`
	Answer        string `json:"answer"`
}

Answer is one repository's recorded answer for one release.

func Record

func Record(cwd, answer string) (Answer, error)

Record records the person's answer to the offer for the repository at cwd and the running release, and raises news-seen to that release, since the answer was given to the moment that showed it. The answer is created exclusively: a second answer for the same repository and release is ErrAlreadyAnswered and changes nothing.

type FullSummary

type FullSummary struct {
	Summary releasedigest.Summary `json:"summary"`
	Waiting ahoy.WaitingSet       `json:"waiting"`
	Lines   []string              `json:"lines"`
	Partial bool                  `json:"partial"`
}

FullSummary is the full summary: every release in the range, each entry needing action first with the record ids to read more, the releases the digest cannot describe, and what waits here.

func Full

func Full(cwd, from string) (FullSummary, error)

Full composes the full summary for the repository at cwd, reading only, so it can be shown again at any time. from is the release the range starts after; "" starts it at the binary record's previous release, else the repository's setup version, else the running release alone. What waits is listed where the repository's setup version is an older release.

type MomentLines

type MomentLines struct {
	News    *releasedigest.Summary `json:"news,omitempty"`
	Lines   []string               `json:"lines"`
	Offer   *Offer                 `json:"offer,omitempty"`
	Partial bool                   `json:"partial"`
}

MomentLines is what the agent relays in its first reply: a line per release whose news is unseen on this computer (and one naming any release the digest cannot describe), then the offer line, if one is due here.

func Moment

func Moment(cwd string) (MomentLines, error)

Moment composes the moment for the repository at cwd, reading only.

type Offer

type Offer struct {
	From    string          `json:"from"`
	To      string          `json:"to"`
	Waiting ahoy.WaitingSet `json:"waiting"`
	Line    string          `json:"line"`
}

Offer is the offer to run setup again: the release the repository was set up with, the one running, and what waits.

type PendingState

type PendingState struct {
	News  bool `json:"news"`
	Offer bool `json:"offer"`
}

PendingState says what an after-update moment holds here: News, that this computer has not been shown what changed up to the running release; Offer, that setup should be offered in this repository for it.

func Pending

func Pending(cwd string, det ahoy.DetectionResult) (PendingState, error)

Pending reports, reading only, what the moment holds for the repository at cwd, whose detection the caller already holds (the session start runs one): Pending runs none of its own. A dev build holds nothing.

func (PendingState) Any

func (p PendingState) Any() bool

Any reports whether the moment holds anything.

Jump to

Keyboard shortcuts

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