gate

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 4 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 gate is a decision waiting on the user: a draft to send, a round to run, a question to answer, a proposal to decide. The gate holds the decision; its subject keeps its own lifecycle in its own table.

Index

Constants

View Source
const EventResolved = "gate_resolved"

EventResolved is the event a resolved step gate records on its task, or its unit with none: Key "<name>/<id>", Data the intent it was resolved with, Actor who resolved it.

View Source
const EventWithdrawn = "gate_withdrawn"

EventWithdrawn is the event a step gate its workflow withdrew records on its task, or its unit with none: Key "<name>/<id>", Data the workflow's reason.

Variables

Kinds are every gate kind.

Modes are every mode.

Functions

func ProposalSubject

func ProposalSubject(id int64) string

ProposalSubject is the Subject of a gate on item proposal id when no message mirrors it, so it never reads as a message id.

Types

type Gate

type Gate struct {
	ID      int64
	Task    task.ID
	Unit    unit.Unit
	Kind    Kind
	Name    string
	Subject string
	Status  Status
	Intents []string
	Intent  string
	Answer  string
	By      task.Actor
	// BySession is the session an agent resolved the gate through, which the gates service checked the user
	// drives; "" for any other resolver.
	BySession string
	Rule      string
	Deadline  time.Time
	Default   string
	OpenedAt  time.Time
	ClosedAt  time.Time
	// Session is the session whose turn produced the gate's subject, a draft or a message; "" when none did.
	// That session never resolves the gate.
	Session string
	// Text is what the gate asks, in the words its opener rendered from the profile; "" leaves its
	// declaration's label.
	Text string
}

Gate is one decision.

Task is "" while no task holds the gate's unit: the store keeps NULL. The gate sets it when its unit has a task; otherwise the task store back-fills it when it writes the first open task that holds the unit; a message on a zero unit gets a capture task the messages service creates, titled with the message's text.

Subject names the subject in its own table (a draft id, a plan item key, a message id), as the kind reads it; a proposal gate on an item proposal no message mirrors names it as ProposalSubject. Intents are the names a person may resolve the gate with, in the order clients offer them; Intent is the one it was resolved with, its Status the one gates.toml gives that intent. Deadline is zero for a gate that waits for ever; one that passes resolves to Default with the rule "window". Intent, By, Rule, Answer and ClosedAt are zero while Open.

func (Gate) ByUser added in v0.4.0

func (g Gate) ByUser() bool

ByUser says whether the user resolved g: a person, or an agent through a session the user drives.

type Kind

type Kind string

Kind is what a gate decides, which names its consequence.

const (
	KindDraft    Kind = "draft"    // publish a draft
	KindPlan     Kind = "plan"     // release a plan item, a round
	KindQuestion Kind = "question" // deliver an answer to a session
	KindPost     Kind = "post"     // deliver an acknowledgement to a session
	KindProposal Kind = "proposal" // decide proposed task or item operations
	KindTrust    Kind = "trust"    // unblock a repository's first run
	KindStep     Kind = "step"     // a profile workflow's gate.open
)

type Mode

type Mode string

Mode is how an approval decides a gate it opens: wait holds it for a person, send and run release it at once, delay releases it to its Default when its window ends unless a person resolves it first, and dry_run, on a draft gate only, rejects it so the draft is stored and never sent.

const (
	ModeWait   Mode = "wait"
	ModeSend   Mode = "send"
	ModeRun    Mode = "run"
	ModeDelay  Mode = "delay"
	ModeDryRun Mode = "dry_run"
)

func (Mode) AppliesTo

func (m Mode) AppliesTo(k Kind) bool

AppliesTo says whether m means anything on a gate of kind k: dry_run is a draft's only.

func (Mode) Releases

func (m Mode) Releases() bool

Releases says whether m resolves a gate at once, with no person.

type Status

type Status string

Status is where a gate's decision stands; every status but Open is final.

const (
	Open       Status = "open"
	Approved   Status = "approved"
	Rejected   Status = "rejected"
	Answered   Status = "answered"
	Dismissed  Status = "dismissed"
	Superseded Status = "superseded"
)

Jump to

Keyboard shortcuts

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