Documentation
¶
Overview ¶
Package flowgen generates flowtest Units outcome-first: a typed plan is drawn from a seeded, weighted block grammar, and the Starlark script, the drive ops and the expectation all derive from that one plan, so every generated flow is self-validating by construction. Grammar v2 adds the nondeterministic surface without giving up that property: a select block races a timer against a driver-fed channel but consumes the value either way, a cancel unit races the driver's cancel against completion under a two-state expectation, and a fail unit ends its blocks with a deliberate failure. Grammar v3 reaches the child and poll surfaces: a child block spawns an awaitable or detached child running a record-free mini-plan, and a poll block drives the ledger-backed testkit counter through a CEL predicate that forces a known number of not-ready re-polls. Grammar v4 adds the real built-in modules to the mix: a gitlab_call block calls the GitLab REST API, where every status is data rather than an error, and an emit block publishes a CloudEvent through the event module's inlineable emit.
Index ¶
Constants ¶
const GeneratorVersion = "flowgen/v4"
GeneratorVersion identifies the grammar; recorded in each unit's provenance so any session is re-renderable from (seed, version, config).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// MaxBlocks caps the sequential blocks per unit; default 8, min 1.
MaxBlocks int
// MaxChannels caps the channel kwargs per unit; default 2.
MaxChannels int
// DurationScale scales every generated duration; default 1.0, must not
// be negative. Large scales stretch sleeps, timers, and jitter alike, and
// a unit's cumulative duration must stay well below the driver's
// SessionDeadline, or the session-not-lost check fires for pacing, not
// correctness reasons.
DurationScale float64
// Weights biases the block-kind draw. A kind absent from the map keeps its
// default weight of 1; weight 0 disables a kind.
Weights map[BlockKind]int
// CancelProbability is the chance in [0, 1] that a unit gets a cancel op
// racing its completion; default 0. Such a unit expects either terminal and
// draws no record block.
CancelProbability float64
// FailProbability is the chance in [0, 1] that a unit ends its blocks with a
// deliberate fail(); default 0. Such a unit expects Failed. Canceling and
// failing are arms of one draw, so the two probabilities must sum to at most
// 1.
FailProbability float64
}
Config bounds and biases the grammar. The zero value uses all defaults.
func ParseCanonicalConfig ¶
ParseCanonicalConfig reads back a config rendered by CanonicalConfig.
func (Config) CanonicalConfig ¶
CanonicalConfig renders the effective config: defaults resolved and the weight table materialized for every kind, so it pins the exact grammar a seed was drawn against without depending on today's defaults. Idempotent under ParseCanonicalConfig.