selfupdate

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 105 Imported by: 1 module, 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

Index

Constants

View Source
const (
	ChannelMain   = "main"
	ChannelStable = "stable"
	ChannelCanary = "canary"
)
View Source
const (

	// Hidden first arguments a main or TestMain routes to the custody launchers through DispatchCustodyLauncher
	CustodyReapEntry      = "__icebath_custody_reap__"
	CustodyCustodianEntry = "__icebath_custody_custodian__"
	CustodyJoinEntry      = "__icebath_custody_join__"
)
View Source
const (
	RecoveryClosureManifest = "MANIFEST"
	RecoveryClosureInit     = "icebath_cli/__init__.py"
)
View Source
const (
	StewardDocker    = "docker"
	StewardNix       = "nix"
	StewardAptTermux = "apt-termux"
	StewardHomebrew  = "homebrew"
	StewardScoop     = "scoop"
	StewardWinGet    = "winget"
	StewardDpkg      = "dpkg"
	StewardRPM       = "rpm"
	StewardPacman    = "pacman"
	StewardApk       = "apk"
	StewardChoco     = "chocolatey"
	StewardPip       = "pip"
)
View Source
const (
	SourceCompletionEntry = "source-completion"
	UpdateCompletionEntry = "update-completion"
)

Hidden entries that run the completion tails, each a tail process identity

View Source
const BootstrapReceipt = ".icebath-bootstrap-complete"

Installers' receipt file a published checkout identity moves with it

View Source
const CommitBuildUpdateMessage = "This build doesn't get updates. Ask the developer who gave it to you for a new build."
View Source
const CompletionRetryBackoffAttempts = 2

Relaunch driven completion retries back off after this many consecutive failures

View Source
const CompletionRetryBackoffSeconds = 15 * 60

Seconds a backed off completion tail waits before it runs again

View Source
const CompletionRetryMaxAttempts = 6

Consecutive completion failures after which a launch leaves the tail to an explicit update

View Source
const DebugGatewayPrivacyNotice = "⚠️ **Privacy notice:** This uploads system info + recent log tails " +
	"(may contain conversation fragments) to a public paste service. " +
	"Full logs are NOT included from the gateway — use `icebath debug share` " +
	"from the CLI for full log uploads.\n" +
	"Pastes auto-delete after 6 hours (dpaste.com fallback pastes: kept for " +
	"1 day, cannot be deleted)."

Gateway variant of the privacy notice the debug slash command prints before it uploads

View Source
const ImportHealthEntry = pm.ImportHealthEntry

Hidden entry the install binary answers the import health probe on

View Source
const InterruptedPullMarker = pm.InterruptedPullMarker

Marker a killed update's git move leaves beside the git dir

View Source
const OfficialRepository = "nickheyer/icebath"
View Source
const RecoveryClosureDir = "icebath-update-recovery"

Directory under the git dir holding the published repair closure of a commit

View Source
const RelaunchedFlag = "--icebath-relaunched"

Hidden leading argument marking the one child a relaunch starts, never the processes it spawns

View Source
const SourceOnTermuxUpdateCommand = config.TermuxInstallCommand
View Source
const SourceOnTermuxUpdateMessage = "✗ This icebath is a source checkout running under Termux.\n" +
	"\n" +
	"Source installs are not supported on Termux — `icebath update` would\n" +
	"build Python packages on the device. Install icebath in a Debian userland instead:\n" +
	"  " + config.TermuxInstallCommand
View Source
const (
	StateModules = "pkg/state/*.go"
)
View Source
const (
	UpdateAvailableNoCount = updaterecord.UpdateAvailableNoCount
)
View Source
const UpdateFinishEntry = "update-finish"

Hidden entry finishing an update a historical takeover prepared in the selected checkout

View Source
const UpdateRestartRecoveryEntry = "update-restart-recovery"

Hidden entry restarting supervised gateway profiles from a fresh process

View Source
const ZipSwapJournal = ".icebath-update-zip-swap"

Journal in the install root naming every entry a ZIP swap stages or renames

Variables

View Source
var (
	TidyBudgetSeconds = 60.0
	PackCountTarget   = 50
)

Tidy budget seconds and the promisor pack count the merges work down to, both patched by tests

View Source
var BannerUpdateCheck func(ctx context.Context) (*pyjson.Object, error)

Passive update check the banner runs, set by the updater and nil in a build without it

View Source
var BootHomeSteps = []PostUpdateStep{
	{"adopt_blessed_checkout", func(ctx context.Context) (map[string]any, error) { return StepAdoptBlessedCheckout(ctx, "") }},
	{"migrate_config", StepMigrateConfig},
	{"state_db_guard", StepStateDBGuard},
	{"drop_live_plugin_catalog", StepDropLivePluginCatalog},
	{"expose_cli", StepExposeCLI},
	{"install_default_plugins", defaults.StepInstall},
}

Home steps boot runs in their order, gated by the per home record, every entry point syncing skills itself

View Source
var DevNull devNull

Null device stream for ChildOptions Stdin, Stdout or Stderr

View Source
var ImageProvenancePath = "/etc/icebath/image-provenance.json"

Marker an image bakes outside the home and the checkout, a var so tests and other image builders repoint it

View Source
var LoadCronJobsHook func(ctx context.Context, h string) ([][2]string, error)

Installed by cmd/icebath, returns the id and name of every job in the cron store of a home in load order

View Source
var QuarantineRestoreBackoffMS = []int{0, 100, 250, 500, 1000}

Backoff in milliseconds between restore attempts of a quarantined shim

View Source
var RecoveryClosure = []string{"icebath_cli/_early_recovery.py", "icebath_cli/update_lock.py", "icebath_cli/update_custody.py"}

Files of the repair closure an updater publishes beside the marker

View Source
var RunCLIHook func(argv []string) int

Runs the CLI main of this binary over an argv in process and returns its exit status, assigned at startup

View Source
var StewardUpdateMessages = map[string]string{
	StewardNix: "✗ This icebath runs from the Nix store.\n" +
		"\n" +
		"The store path is immutable. Update through your flake:\n" +
		"  nix flake update && rebuild your profile or system",
	StewardAptTermux: "✗ This icebath runs from a Termux package tree, and no icebath release is a Termux package.\n" +
		"\n" +
		"Install icebath in a Debian userland, where the Linux release updates itself:\n" +
		"  " + config.TermuxInstallCommand,
	StewardHomebrew: "✗ This icebath was installed by Homebrew.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  brew upgrade --cask icebath",
	StewardScoop: "✗ This icebath was installed by Scoop.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  scoop update icebath",
	StewardWinGet: "✗ This icebath was installed by WinGet.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  winget upgrade --id nickheyer.icebath",
	StewardDpkg: "✗ This icebath was installed by a Debian package.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  sudo apt update && sudo apt install --only-upgrade icebath",
	StewardRPM: "✗ This icebath was installed by an RPM package.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  sudo dnf upgrade icebath",
	StewardPacman: "✗ This icebath was installed by an Arch package.\n" +
		"\n" +
		"The package manager owns the binary. Update through your AUR helper:\n" +
		"  paru -Syu icebath-bin",
	StewardApk: "✗ This icebath was installed by an Alpine package.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  apk upgrade icebath",
	StewardChoco: "✗ This icebath was installed by Chocolatey.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  choco upgrade icebath",
	StewardPip: "✗ This icebath was installed from the icebath-cli wheel.\n" +
		"\n" +
		"The package manager owns the binary. Update with:\n" +
		"  pipx upgrade icebath-cli",
}

Functions

func AdoptRetiredChannel

func AdoptRetiredChannel(ctx context.Context, request map[string]any) (bool, error)

Adopts a retired channel's destination after verified completion when the subscription is unchanged

func ArmCompletion

func ArmCompletion(ctx context.Context, projectRoot string) (string, error)

Persists the tail obligation before a new dependency generation is selected

func BackupExisting

func BackupExisting(paths []string) ([]string, error)

Backup copies of the regular files among paths for callers outside the package, in path order

func BlobID

func BlobID(data []byte, like string) string

Git's object id of a blob holding data in the object format of like

func BootLaunch

func BootLaunch(ctx context.Context, root string, args []string) (int, bool)

Finishes a source update and activates the committed dependencies before the app runs, the exit status when it must stop

func BootRecordPath

func BootRecordPath(ctx context.Context, projectRoot string) string

Per install and per profile bootstrap record under the default home's installs tree

func ChannelRecord

func ChannelRecord(cfg any, projectRoot string) map[string]any

Returns the path and channel record config holds for the install, empty when absent or malformed

func CheckForUpdates

func CheckForUpdates(ctx context.Context, opts SourceCheckOptions) (*pyjson.Object, error)

Presentation ready source update status of one install and profile, never fetching or writing git state

func CheckMacosFullDiskAccess

func CheckMacosFullDiskAccess(w io.Writer) error

CheckMacosFullDiskAccess reports the Full Disk Access grant that silences every macOS folder prompt, silent elsewhere

func CheckRuntime

func CheckRuntime(ctx context.Context, projectRoot string) (string, error)

One passive PM verdict on startup, the problem text or empty when the install is current or a developer checkout

func CheckoutContains

func CheckoutContains(ctx context.Context, sha string) (bool, error)

True when sha is an ancestor of or equal to the code this checkout runs, false on any probe failure

func ClassifyFetchFailure

func ClassifyFetchFailure(detail string) string

One line diagnosis of a release fetch failure text

func CleanupQuarantinedExes

func CleanupQuarantinedExes(ctx context.Context, root, scriptsDir string)

Sweeps and rescues quarantined exe shims of earlier updates, a live update's quarantine left alone

func ClearCompletion

func ClearCompletion(ctx context.Context, root string) error

Drops the pending marker and its attempt record

func CmdSecurityAudit

func CmdSecurityAudit(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

Audits the venv, plugin and MCP pins against OSV, exit 1 when a finding meets the fail on tier

func CmdUpdate

func CmdUpdate(ctx context.Context, u UpdateInvocation) (int, error)

Runs the update command and returns its exit status, an exit raised inside it becoming that status

func CmdUpdateTakeover

func CmdUpdateTakeover(ctx context.Context, ns map[string]any, w io.Writer) (int, error)

Finishes an update a historical updater handed off, returning the status the waiting updater reports

func CollectFleetVersions

func CollectFleetVersions(preRestartPIDs []int, selfRestartPending []int) []*pyjson.Object

Every profile gateway's code identity against the running install, down rows only for pre restart pids

func CompareVersions

func CompareVersions(a, b string) int

Semver precedence of two tags, build metadata ignored and unparseable versions ranked lowest

func CompleteSourceCheckout

func CompleteSourceCheckout(ctx context.Context, root string, o SourceCompletion) (bool, error)

Publishes commands then runs post update maintenance under the shared update lock

func CompletionPendingPath

func CompletionPendingPath(ctx context.Context, projectRoot string) string

Marker of a source update whose dependency sync committed but whose tail has not finished

func CompletionRetryState

func CompletionRetryState(ctx context.Context, projectRoot string, now func() float64) (bool, *big.Int, int64)

Whether the owed tail may run now, its attempts and the backoff seconds, never failing

func CurrentInstallIdentity

func CurrentInstallIdentity(ctx context.Context, projectRoot string) string

What code this install is, the stamp commit for sealed trees, git HEAD for checkouts, empty for broken trees

func DefaultChannel

func DefaultChannel(projectRoot string) (string, error)

Channel an unconfigured install tracks, stable for official releases and main otherwise

func DescribeActiveWorkUnit

func DescribeActiveWorkUnit(ctx context.Context, unit any, h string) (string, error)

One human line of an active work entry, the drain report wording the gateway CLI prints

func DescribeRestartMechanism

func DescribeRestartMechanism(mechanism, profile string) string

Human readable description of a restart mechanism id, the gateway restart command when the table has none

func DispatchCustodyLauncher

func DispatchCustodyLauncher()

Runs a custody launcher and exits when argv carries its entry, otherwise records that this binary handles them

func DoctorCheckConfigFile

func DoctorCheckConfigFile(ctx context.Context, h, projectRoot string, shouldFix bool, w io.Writer) (int, error)

Runs the config file check of one home and project root, returning the number of fixes it applied

func EnsureWindowsBinLaunchers

func EnsureWindowsBinLaunchers(root string, windows *bool, userPathEntries []string) []string

Re stages the Windows launchers when they vanish or still boot through the venv, the restored paths returned

func ExposePMGit

func ExposePMGit(ctx context.Context, projectRoot string) error

Puts the pm git on PATH and in its facts for a Windows checkout without a git of its own

func FallbackCheckCommand

func FallbackCheckCommand(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

FallbackCheckCommand is icebath fallback check, the readiness table or JSON of every chain entry without an agent session, 1 when any entry is not ready

func GatewayDebugLocalReport

func GatewayDebugLocalReport(ctx context.Context) (string, error)

Redacted share bundle report for a local session's debug local, collected with no network call

func GatewayDebugUploadReply

func GatewayDebugUploadReply(ctx context.Context) (string, error)

Uploads only the summary report and returns the chat reply with its link, retention and hints

func GitCount

func GitCount(ctx context.Context, args []string, root string) (int64, bool)

Integer a successful count style git query in root prints, false when git failed or printed no integer

func GitOperationInProgress

func GitOperationInProgress(root string) (string, error)

The active Git operation controlling root, empty when none

func GitStdout

func GitStdout(args []string, root string) string

Stripped stdout of a read only git query in root within five seconds, empty when git failed

func GitStdoutWithin

func GitStdoutWithin(ctx context.Context, args []string, root string, timeout time.Duration) (string, bool)

Stripped stdout of a read only git query in root within the timeout, false when git failed

func GitlockRunGit

func GitlockRunGit(ctx context.Context, gitCmd, args []string, o pysubprocess.Options) (*pysubprocess.Completed, error)

Runs an updater git for the tools git lock in the update's custody, the run_git the process wiring assigns

func HandleMetadataArgs

func HandleMetadataArgs(ctx context.Context, stdout io.Writer, installIDFlag bool, setChannel *string, projectRoot string) (bool, error)

Prints the install id or persists a channel before any update side effect, true when handled

func ImportHealthMain

func ImportHealthMain(argv []string, stdout io.Writer) int

Answers the import health probe with the marker and the empty failure list of a binary that started whole

func InstallID

func InstallID(projectRoot string) string

Sixteen hex digit key of the install at projectRoot, the running install when empty

func IsCanaryTag

func IsCanaryTag(tag any) bool

Reports whether tag is a stable version carrying a full UTC canary build timestamp

func IsCommitBuild

func IsCommitBuild(projectRoot string) bool

Reports whether the install stamp at projectRoot names a commit build that never updates

func IsObjectID

func IsObjectID(value string) bool

Whether a value is a commit id and never a revision or a path

func IsValueError

func IsValueError(err error) bool

Reports whether err is of the ValueError family, ChannelError included

func LegacyPostSwapMain

func LegacyPostSwapMain(ctx context.Context, handoffPath string, argvTail []string, stderr io.Writer) int

Exit status of a shipped updater's post swap hand off finished by a takeover child, an uncaught failure printed

func MaybeRunBootBootstrap

func MaybeRunBootBootstrap(ctx context.Context, projectRoot string)

The one call boot paths use, a bootstrap problem logged and never stopping the launch

func NeedsBootstrap

func NeedsBootstrap(ctx context.Context, projectRoot string) string

The new identity when this install changed since its last bootstrap, empty otherwise or for a broken tree

func PassiveCheckForUpdates

func PassiveCheckForUpdates(ctx context.Context, installRoot, home string) (*pyjson.Object, error)

Passive source update status of an install for the version output

func PopenPostCommit

func PopenPostCommit(ctx context.Context, argv []string, label string, opts ChildOptions) (*exec.Cmd, error)

Starts a checkout writer after the commit point, a refused job bind is printed and receipted and it still runs

func PrepareLaunch

func PrepareLaunch(ctx context.Context, projectRoot string, argv []string) (string, error)

Finishes a self managed source update before the app runs, the install binary to relaunch into or empty

func PrintFleetVersionMatrix

func PrintFleetVersionMatrix(fleet []*pyjson.Object) bool

Prints the post update fleet matrix, true when a gateway is provably stale or down

func QuarantineStampMS

func QuarantineStampMS(name string) (int64, bool)

The .old.<unix-ms> stamp of a quarantine file name, false for a name this code never made

func ReadGitHead

func ReadGitHead(ctx context.Context, root string) string

Commit SHA of the checkout at root, asked of git, empty when git cannot answer

func ReadLastKnown

func ReadLastKnown(path string) map[string]any

The last bootstrap record, empty when missing, unreadable or not an object

func RecoverPausedGateways

func RecoverPausedGateways(ctx context.Context, argv []string)

Recovers gateways a killed update left paused, the update command and a booting gateway excepted

func RecoveryClosureDirOf

func RecoveryClosureDirOf(root, pre string) (string, error)

Closure directory of a commit under the git dir, a ValueError for anything but a commit id

func RecoveryClosureVerified

func RecoveryClosureVerified(closure, pre string) bool

Every closure file present with exactly the bytes its manifest names and nothing missing

func RedactDebugSupportText

func RedactDebugSupportText(value any) string

Scrubs one debug or support value fail closed, any redactor failure returning the shared sentinel

func RedactDebugSupportTextCapped

func RedactDebugSupportTextCapped(value any, maxChars int) string

Scrubs like RedactDebugSupportText then keeps at most maxChars characters

func RefuseForeignOwnedVenv

func RefuseForeignOwnedVenv(ctx context.Context, projectRoot string) error

Refuses cross user mutation before PM changes the selected environment

func RelaunchAfterRestore

func RelaunchAfterRestore(argv []string) int

Re runs this command from the restored tree, the exit code of the child on Windows and never returning elsewhere

func RelaunchCommand

func RelaunchCommand(binary string, argv []string) []string

Argv re-entering this program through the install binary, its arguments kept and the relaunch marked

func ResolveUpdateChannel

func ResolveUpdateChannel(cfg any, projectRoot string) (string, error)

Channel this install updates from, its record first, then the default

func RestoreInterruptedPull

func RestoreInterruptedPull(ctx context.Context, projectRoot string, afterFailure bool) bool

Puts back the files a killed icebath update had half moved to the new commit, true when the tree changed

func RestoreInterruptedZipSwap

func RestoreInterruptedZipSwap(root string, stream io.Writer) bool

Finishes or rolls back a ZIP swap whose owner died, true when the tree changed and a relaunch is due

func RestoreQuarantinedShims

func RestoreQuarantinedShims(moved [][2]string, stream io.Writer, backoffMS []int) [][2]string

Renames quarantined shims back, retrying a lock, the pairs still quarantined after the retries returned

func RidesDefaultChannel

func RidesDefaultChannel(record map[string]any, channel, projectRoot string) (bool, error)

Reports whether no channel was ever persisted and channel is the install's default

func RunBootBootstrap

func RunBootBootstrap(ctx context.Context, projectRoot string) (map[string]any, error)

Bounds home maintenance to one attempt per installed revision

func RunDebug

func RunDebug(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

Routes the debug subcommands, sweeping expired pastes on every call

func RunDoctor

func RunDoctor(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

Runs every doctor check in order, then the live probes when asked, and returns one when an issue remains

func RunDump

func RunDump(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

Writes the compact copy pasteable setup summary of the dump command

func RunPostUpdateMaintenance

func RunPostUpdateMaintenance(ctx context.Context, o PostUpdateMaintenance) (bool, error)

Post build housekeeping and the completion line, the SQLite runtime verdict of the next process

func RunSteps

func RunSteps(ctx context.Context, steps []PostUpdateStep) map[string]map[string]any

Runs steps in order, a failing or raising step recorded without stopping the rest

func SealedSteward

func SealedSteward(projectRoot string) *string

Steward of a sealed tree, nil for a git checkout, an installer stamped release tree or a WinGet nested install

func SetHolderValueFlags

func SetHolderValueFlags(source func() []string)

Installs the top level parser's value consuming option strings, called by the command tree

func SetInstallChannel

func SetInstallChannel(ctx context.Context, channel, projectRoot string) (string, error)

Persists channel for this install in config.yaml and returns its id, refusing commit builds and owned installs

func ShowStatus

func ShowStatus(ctx context.Context, h string, ns map[string]any, w io.Writer) (int, error)

One screen summary by default, every section under the full or deep flag

func SourceCompletionMain

func SourceCompletionMain(ctx context.Context, argv []string, stdout, stderr io.Writer) int

Installer and launch entry of the tail, bootstrapping into the checkout's binary before any product work

func SourceUpdateChannel

func SourceUpdateChannel(ctx context.Context, pinned bool, transient *string, projectRoot string) (string, error)

Channel this run updates from, main for a pinned version, then the transient flag, then the install record

func StepAdoptBlessedCheckout

func StepAdoptBlessedCheckout(ctx context.Context, projectRoot string) (map[string]any, error)

One time adoption of a shipped stampless checkout at a blessed root, writing its birth certificate

func StepDropLivePluginCatalog

func StepDropLivePluginCatalog(ctx context.Context) (map[string]any, error)

Drops the active home's cached live plugin catalog after a code change

func StepExposeCLI

func StepExposeCLI(ctx context.Context) (map[string]any, error)

Publishes the durable commands, over this checkout

func StepMigrateConfig

func StepMigrateConfig(ctx context.Context) (map[string]any, error)

Migrates config.yaml to the current schema non interactively, backups restored when the version does not advance

func StepStateDBGuard

func StepStateDBGuard(ctx context.Context) (map[string]any, error)

Verifies the active home's state.db is intact, damage reported loudly and never repaired here

func StewardUninstallMessage

func StewardUninstallMessage(steward string) string

The uninstall refusal text for a sealed tree

func StewardUpdateMessage

func StewardUpdateMessage(steward string) string

The icebath update refusal text for a sealed tree

func SweepExpiredPastes

func SweepExpiredPastes(ctx context.Context, now *float64) (int, int, error)

Deletes pending pastes whose expiry passed, returning how many were reaped and how many remain

func SweepStaleBytecodeIfCheckoutChanged

func SweepStaleBytecodeIfCheckoutChanged()

Clears stale bytecode caches once when the checkout fingerprint changed since the last sweep, never failing

func TakeRelaunchMarker

func TakeRelaunchMarker(args []string) []string

Records a relaunch marker leading the arguments and returns the arguments without it

func UpdateCompletionMain

func UpdateCompletionMain(ctx context.Context, args []string, stdout, stderr io.Writer) int

Entry of the completion process the source update runs in the selected tree, its exit status

func UpdateFinishMain

func UpdateFinishMain(ctx context.Context, contextPath, resultPath string, stdout, stderr io.Writer) int

Finishes a historical takeover in a fresh process of the selected checkout and writes its acknowledgement

func UpdateInternalCommand

func UpdateInternalCommand(argv []string) bool

Reports an argv the update spawned for one of its children, the hidden verb leading it

func UpdateRestartRecoveryMain

func UpdateRestartRecoveryMain(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) int

Restarts the payload's profiles and prints the outcome JSON, the child exit status

func ValidateChannelName

func ValidateChannelName(value any) (string, error)

Returns a lowercase hyphenated channel name of at most 32 characters that names no reserved device

func VenvSyncMain

func VenvSyncMain(ctx context.Context, argv []string, stdout, stderr io.Writer) int

Reports or syncs a tree's dependencies as text or JSON, nonzero when the sync failed

func WarnPendingFleetRestartOnStartup

func WarnPendingFleetRestartOnStartup(ctx context.Context, h string, w io.Writer)

Startup hint about a fleet restart a previous update still owes, never restarting and never failing

func WithRetryingReads

func WithRetryingReads(ctx context.Context) context.Context

Lets channel reads under ctx wait out a CDN blip with the pm bounded retries, explicit updates only

func WriteDurableText

func WriteDurableText(path, text string) error

Writes text at path as one durable record through an exclusively created random sibling

func WriteSourceStamp

func WriteSourceStamp(root string, adopted bool) (*pyjson.Object, error)

Replaces install-stamp.json with identity read from the checkout itself, nil when git cannot identify it

func WriteZipSwapJournal

func WriteZipSwapJournal(root, phase string, entries []any, gen string, temps map[string]string) error

Publishes the swap journal with its phase, entries, generation tag and backup temps

func ZipEntryIdentity

func ZipEntryIdentity(path string, filling bool) string

The entry's own identity from lstat, empty when absent or unidentifiable, size and mtime added for a settled file

Types

type CalledProcessError

type CalledProcessError struct {
	ReturnCode int
	Cmd        []string
	Output     string
	Stderr     string
}

Custody child that exited nonzero under a checked run

func (*CalledProcessError) Error

func (e *CalledProcessError) Error() string

type ChannelError

type ChannelError struct{ Msg string }

func (*ChannelError) Error

func (e *ChannelError) Error() string

type ChannelNotFound

type ChannelNotFound struct{ ChannelError }

ChannelNotFound is the missing channel object, still a ChannelError to every caller

func (*ChannelNotFound) Unwrap

func (e *ChannelNotFound) Unwrap() error

type ChannelOpener

type ChannelOpener func(req *http.Request) (*http.Response, error)

ChannelOpener performs one channel archive request, the urllib opener seam

type ChannelReader

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

ChannelReader reads channel objects over HTTPS from one archive authority with digest checks

func NewChannelReader

func NewChannelReader(baseURL string, repository *string, opener ChannelOpener) (*ChannelReader, error)

Reader for an archive base and an optional repository authority, refusing redirects

func (*ChannelReader) ReadBytes

func (r *ChannelReader) ReadBytes(ctx context.Context, key string, sha *string) ([]byte, error)

Bytes of one channel object, size bounded and matched to sha256 when one is pinned

func (*ChannelReader) ReadRecord

func (r *ChannelReader) ReadRecord(ctx context.Context, name string) (*pyjson.Object, error)

Validated record of one named channel under the reader's repository authority

func (*ChannelReader) Resolve

func (r *ChannelReader) Resolve(ctx context.Context, name string) (*ChannelResolution, error)

Requested and terminal records with the verified manifest, a retirement pinned to its qualified destination

type ChannelResolution

type ChannelResolution struct {
	Requested, Terminal, Manifest *pyjson.Object
}

Requested record, the record it resolves to, and that record's verified build manifest

type ChildOptions

type ChildOptions struct {
	Dir        string
	Env        []string
	Input      *string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Capture    bool
	Text       bool
	Timeout    time.Duration
	Check      bool
	ExtraFiles []*os.File
	Attr       *syscall.SysProcAttr
}

Subprocess options of one custody child, a nil stream inherits this process's own

type CompletedProcess

type CompletedProcess struct {
	Args       []string
	ReturnCode int
	Stdout     string
	Stderr     string
}

Outcome of one finished custody child

func Run

func Run(ctx context.Context, argv []string, inheritLock bool, opts ChildOptions) (*CompletedProcess, error)

Runs argv to completion in the update tree's custody with the lock files for a mutator

func RunGit

func RunGit(ctx context.Context, gitCmd, args []string, opts ChildOptions) (*CompletedProcess, error)

Runs git in the updater's custody, the lock files only into local mutators, a partial clone prefetched first

type Contained

type Contained struct {
	Argv       []string
	ExtraFiles []*os.File
	Attr       *syscall.SysProcAttr
	// contains filtered or unexported fields
}

Command a runner that hides its child starts, kept in checkout custody by a launcher

func ContainedCommand

func ContainedCommand(ctx context.Context, argv []string, inheritLock bool, root string) (*Contained, error)

Argv and spawn options for a checkout writer run by a runner that hides its child, under a custody launcher

func (*Contained) Close

func (c *Contained) Close() error

Ends the contained run, returning the refusal a launcher reported when the command never ran

type DebugShareResult

type DebugShareResult struct {
	URLKeys           []string
	URLs              map[string]string
	Failures          []string
	Redacted          bool
	AutoDeleteSeconds int
	Report            string
}

Outcome of a debug share upload, the label to url map, optional upload failures and the redaction flag

func BuildDebugShare

func BuildDebugShare(ctx context.Context, logLines, expiry int, redact bool) (*DebugShareResult, error)

Collects the report and full logs, uploads each and returns their urls, the report upload being required

type Doctor

type Doctor struct {
	W           io.Writer
	Home        string
	ProjectRoot string
	DisplayHome string
}

Doctor is one doctor run, the stdout rows print to plus the home, project root and display home checks read

type Finding

type Finding struct {
	Issues       []string
	ManualIssues []string
	Fixed        int
}

Finding is what one doctor check contributed, auto fixable issues, manual only issues and fixes applied

func (*Finding) Merge

func (f *Finding) Merge(other *Finding)

Merge appends the issues and adds the fix count of another finding

type ImageProvenance

type ImageProvenance struct {
	Schema         int
	DeploymentKind string
	Manager        string
	Image          *string
	Version        *string
	Revision       *string
	MarkerPath     string
	Valid          bool
	Error          *string
}

Validated image provenance, or the description of an invalid marker that still means image managed

func ReadImageProvenance

func ReadImageProvenance(markerPath string) *ImageProvenance

Baked image marker at markerPath or the default path, nil when absent, invalid provenance for any defect

type KeyError

type KeyError struct{ Key string }

func (*KeyError) Error

func (e *KeyError) Error() string

type LogSnapshot

type LogSnapshot struct {
	Path     string
	TailText string
	FullText *string
}

Single read snapshot of a log file, the summary tail and the full upload text

type PauseRefused

type PauseRefused struct{ Msg string }

The pause could not be completed and everything it stopped was started again

func (*PauseRefused) Error

func (e *PauseRefused) Error() string

type PostUpdateMaintenance

type PostUpdateMaintenance struct {
	AssumeYes, GatewayMode                bool
	PreUpdateSnapshotID, PreUpdateVersion *string
	CompletionMessage                     *string
	Followups                             *[][2]string
	Stdout, Stderr                        io.Writer
}

Inputs of the post update housekeeping an update or install tail runs

type PostUpdateStep

type PostUpdateStep struct {
	Name string
	Run  func(ctx context.Context) (map[string]any, error)
}

One named home or machine maintenance step

type RecordLock

type RecordLock struct {
	Path     string
	Acquired bool
}

Existence as mutex beside a record file, a stale lock broken and retried once

func NewRecordLock

func NewRecordLock(record string) *RecordLock

Lock beside a record file

func (*RecordLock) Acquire

func (l *RecordLock) Acquire() bool

Takes the lock, a loser skipping unless the holder's lock is stale

func (*RecordLock) Release

func (l *RecordLock) Release()

Drops the lock this process took

type RuntimeRecord

type RuntimeRecord struct {
	Kind        string
	Profile     string
	PID         *int
	Supervisor  string
	CodeSHA     *string
	CodeVersion any
	RestartVia  string
	Detail      *pyjson.Object
}

One running or expected runtime on this machine

func (*RuntimeRecord) ToDict

func (r *RuntimeRecord) ToDict() *pyjson.Object

Runtime fields as an ordered JSON object in declaration order

type ServicePauseFailed

type ServicePauseFailed struct {
	Msg              string
	RollbackFailures []string
	Cause            error
}

A gateway service could not be stopped, with what the rollback could not restart

func (*ServicePauseFailed) Error

func (e *ServicePauseFailed) Error() string

func (*ServicePauseFailed) Unwrap

func (e *ServicePauseFailed) Unwrap() error

type SourceCheckOptions

type SourceCheckOptions struct {
	InstallRoot string
	Home        string
	Branch      *string
	Channel     *string
	CachePath   string
	Force       bool
	Passive     bool
	Git         string
}

Inputs of one passive source update check, empty strings and nil pointers take the running install's defaults

type SourceCompletion

type SourceCompletion struct {
	AssumeYes, GatewayMode                bool
	PreUpdateSnapshotID, PreUpdateVersion *string
	CompletionMessage                     *string
	Announce                              string
	Followups                             *[][2]string
	BeforeMaintenance                     func()
	Stdout, Stderr                        io.Writer
}

Options of the tail every source install and update shares

type SourceTarget

type SourceTarget struct {
	RequestedChannel string
	Channel          string
	Repository       string
	Commit           string
	Branch           string
	Version          string
	BuildID          string
	Ahead            bool
}

A pinned source build or a source branch delivery a channel resolves to

func ResolveSourceTarget

func ResolveSourceTarget(ctx context.Context, channel string, gitCmd []string, cwd, repository string, forwardOnly bool) (SourceTarget, error)

Resolves a subscription, pinning an unchosen default to a HEAD that already contains the release

func (SourceTarget) Label

func (t SourceTarget) Label() string

Human label of the target, the waiting notice when this checkout is newer than the release

func (SourceTarget) Retired

func (t SourceTarget) Retired() bool

Reports whether resolution moved the subscription to another channel

type StaleChannelRecord

type StaleChannelRecord struct {
	SHA16  string
	Record map[string]any
	Reason string
}

func StaleChannelRecords

func StaleChannelRecords(ctx context.Context, cfg any) ([]StaleChannelRecord, error)

Doctor's missing, replaced and unclaimed verdicts over update.installs records, in key order

type TidyResult

type TidyResult struct {
	Erased     int
	FreedBytes int64
	Merged     int
	PacksLeft  int
	OutOfTime  bool
}

Counts of one tidy pass

func TidyPartialClonePacks

func TidyPartialClonePacks(ctx context.Context, repoRoot string, budgetSeconds float64) TidyResult

Spends at most the budget erasing redundant and merging small promisor packs, never failing the update

type UpdateInvocation

type UpdateInvocation struct {
	Namespace      map[string]any
	ProjectRoot    string
	Stdout, Stderr io.Writer
}

Inputs of the update command, its argparse namespace, the checkout it updates and its output streams

type UpdatePlan

type UpdatePlan struct {
	InstallMethod    string
	UpdatableInPlace bool
	UpdateMechanism  string
	ExpectedSHA      any
	ExpectedVersion  any
	Profiles         []any
	Runtimes         []*RuntimeRecord
}

Install shape, profiles and runtimes seen before any mutation

func CollectRuntimeInventory

func CollectRuntimeInventory(ctx context.Context) *UpdatePlan

Builds the plan read only, every collector degrading on its own

func NewUpdatePlan

func NewUpdatePlan() *UpdatePlan

Empty plan with the defaults of an unprobed install

func UpdatePlanFromDict

func UpdatePlanFromDict(data any) (*UpdatePlan, error)

Plan rebuilt from its JSON form, unknown keys dropped and rows that are not objects skipped

func (*UpdatePlan) ToDict

func (p *UpdatePlan) ToDict() *pyjson.Object

Plan fields as an ordered JSON object, every runtime as its own object

type UpdateRefusal

type UpdateRefusal struct {
	Code, Message, UpdateCommand string
}

Why an in place update is refused, the full text to print and the one line command to run instead

type UpstreamTargetBroken

type UpstreamTargetBroken struct {
	SHA, Path, Detail string
}

The fork sync's upstream target fails the startup syntax check and is refused before its move

func (*UpstreamTargetBroken) Error

func (e *UpstreamTargetBroken) Error() string

type ValueError

type ValueError struct{ Msg string }

func (*ValueError) Error

func (e *ValueError) Error() string

type VenvSyncResult

type VenvSyncResult struct {
	State  string
	OK     bool
	Detail string
}

Outcome of one dependency report or sync, detail present only on failure

func SyncTree

func SyncTree(ctx context.Context, projectRoot string, check bool) (VenvSyncResult, error)

Reports or syncs this checkout's dependencies, a malformed install stamp failing as a build error

type ZipSwapLock

type ZipSwapLock struct {
	Owned  bool
	Reason string
}

Verdict of the ZIP swap owner lock, owned only while this process holds it

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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