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
- Variables
- func Attach(s *summary.Summary, v View)
- func FlowOf(v View) *summary.CoordinationFlow
- func ManifestHash(d CheckoutDocument) string
- func NeedsOf(v View) *summary.CoordinationNeeds
- func OverviewOf(v View) summary.CoordinationOverview
- type CheckoutDocument
- type RepositoryReader
- type Source
- type View
- type Viewer
Constants ¶
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 ¶
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.
var ( ErrNoCoordination = errors.New("no coordination parent") )
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 ¶
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 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 ¶
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.