coordinationview

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 15 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 coordinationview is the broker's per-viewer reading of a coordination parent (v4 design MR13): the core's unfiltered CoordinationView goes in, and only what this viewer may read of each child comes out. It is the one place a human projection of a family is sanitized; every renderer downstream (summary, roomview, the web rail, Slack) consumes its View and never the core's.

Index

Constants

View Source
const (
	CheckoutAPIVersion = "coordination-checkout/v1"
	CheckoutKind       = "CoordinationCheckout"
)

The parent checkout document's own apiVersion and kind (MR14): a local file format, not a Kubernetes Kind.

Variables

View Source
var (
	ErrCheckoutRestricted = errors.New("checkout_restricted")
	ErrCheckoutNotReady   = errors.New("checkout_not_ready")
)

The two refusals of Checkout: a viewer missing any child gets no document at all, and a family whose children are not all filed at one exact, valid commit gets none either.

View Source
var (
	ErrNoCoordination          = errors.New("no coordination parent")
	ErrCoordinationUnavailable = errors.New("coordination view unavailable")
)

The two ways a reader of the core's view fails: the task is no coordination parent (or does not exist), or the view could not be read. A consumer answers the first 404 and the second 503.

Functions

func Attach

func Attach(s *summary.Summary, v View)

Attach puts v on s, as JSON, and its flow on s.Flow, creating an empty run flow when s has none. The run flow's own fields are left as they were.

func FlowOf

func FlowOf(v View) *summary.CoordinationFlow

FlowOf is v's flow.coordination.

func ManifestHash

func ManifestHash(d CheckoutDocument) string

ManifestHash is d's sha256 over its JSON, lowercase hex: what a later checkout compares to tell the document it wrote from a changed plan or head. Go encodes a struct's fields in their declared order, so the encoding is canonical for the type.

func NeedsOf

func NeedsOf(v View) *summary.CoordinationNeeds

NeedsOf is what needs/v1 reads of v (summary.CoordinationNeeds).

func OverviewOf

func OverviewOf(v View) summary.CoordinationOverview

OverviewOf is v's room-list row.

Types

type CheckoutDocument

type CheckoutDocument struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	coordination.CheckoutManifest
	IntegrationAttempts []coordination.IntegrationAttemptView `json:"integrationAttempts"`
}

CheckoutDocument is what a parent checkout writes beside its worktrees: the core manifest, unchanged, and the family's integration attempts with their exact subjects.

func Checkout

func Checkout(v View) (CheckoutDocument, error)

Checkout is v's checkout document, all or nothing: every child of a fully readable family, in merge order, at exactly one commit (its open PR head, or its landed merge), with its links, dependencies and the artifacts it produces or consumes. Worktrees are the child ids, relative, until the client knows its root.

type RepositoryReader

type RepositoryReader interface {
	Login(ctx context.Context, sub, repository string) (string, error)
	CanRead(ctx context.Context, repository, login string) (bool, error)
}

RepositoryReader is the viewer's GitHub standing: their linked login for a repository, and whether that login may read it (D7). ghidentity.Resolver and repoaccess.Checker satisfy it.

type Source

type Source struct {
	Reader    client.Reader
	Namespace string
}

Source reads a parent's unfiltered view live: the parent Task, the Tasks labelled with its coordination lineage (implementation children and integration attempts), and every retained day ledger's settled and outstanding reserved spend, handed unchanged to the core's View. Reader must be uncached (the manager's API reader): a stale informer must never decide what a viewer sees. It only reads Tasks and ConfigMaps (get, list).

func (Source) View

func (s Source) View(ctx context.Context, parentTask string) (coordination.CoordinationView, error)

View is parentTask's core view. A missing Task, or one that is no coordination parent, is ErrNoCoordination; any read failure is ErrCoordinationUnavailable.

type View

type View struct {
	coordination.CoordinationView
	RestrictedChildren int `json:"restrictedChildren"`
}

View is a filtered coordination view: every core field, minus what a restricted child would reveal, plus how many children were withheld. The embedding keeps the core JSON unchanged.

func Filter

func Filter(ctx context.Context, raw coordination.CoordinationView, viewer Viewer, access RepositoryReader) View

Filter is raw as viewer may read it. Each child is checked on its own repository; a missing login, a false answer or any error restricts it (fail closed). A restricted child contributes only to RestrictedChildren: its record, every reference to it, and whatever family-wide field could reveal it by prose or subtraction are removed. raw is never modified.

func Of

func Of(s summary.Summary) (View, bool)

Of is the view a summary carries, when it carries one.

type Viewer

type Viewer struct {
	Sub          string
	Sponsored    bool
	Repositories map[string]bool
}

Viewer is who reads. A sponsored principal has no GitHub login: its configured repositories are its whole reach. There is deliberately no admin flag: agents-admin confers no child access.

Jump to

Keyboard shortcuts

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