Documentation
¶
Overview ¶
Package workload generates the v4 realistic business workload fixture (docs/design/business-workload-model.md): four business modules rendered from one set of table specs into per-dialect DDL/seed SQL, entity configuration, and expected task results. Every value is a pure function of (seed, table, row index); regenerating with the same Config is byte-identical.
Index ¶
- Constants
- func Artifacts(cfg Config) map[string]string
- func Expected(cfg Config) map[string]Expectation
- func ExpectedTaskIDs(cfg Config) []string
- func Oracles(cfg Config) map[string]Oracle
- type Anomalies
- type ColType
- type Column
- type Config
- type Confounder
- type Dataset
- func (d *Dataset) DiagnosticProfile() map[string]any
- func (d *Dataset) DiagnosticViews() []string
- func (d *Dataset) Profile() map[string]any
- func (d *Dataset) Statements(dialect string) []string
- func (d *Dataset) StatementsIn(dialect, schema string) []string
- func (d *Dataset) Table(name string) *Table
- type Expectation
- type Oracle
- type ResultTable
- type Table
Constants ¶
const ( DialectPostgres = "postgres" DialectMySQL = "mysql" DialectOceanBase = "oceanbase" )
Dialect names accepted by the renderer. MySQL and OceanBase share syntax.
Variables ¶
This section is empty.
Functions ¶
func Artifacts ¶
Artifacts renders every generated checked-in file keyed by path relative to fixtures/v4. Map iteration order does not matter: each file's content is independently deterministic.
func Expected ¶
func Expected(cfg Config) map[string]Expectation
Expected computes every task expectation from the same deterministic plans that generated the tables. Task IDs match fixtures/v4 task files.
func ExpectedTaskIDs ¶
ExpectedTaskIDs lists every task id with a computed expectation, sorted.
Types ¶
type Anomalies ¶
type Anomalies struct {
DuplicateCallbacks bool // duplicate channel callbacks (dedup_of)
OutOfOrderCallbacks bool // received_at earlier than a prior event
ReconciliationMismatches bool // statement items that do not reconcile
FailedAttempts bool // failed/retried payment attempts
PartialRefunds bool // partial (not full) refunds
SoftDeletes bool // logically deleted users/customers
DuplicateGiftEvents bool // duplicate gift events (dedup_of)
UnpostedLedger bool // payments succeeded but not yet posted
}
Anomalies are the injectable irregular data patterns.
type ColType ¶
type ColType int
ColType is a portable logical column type; renderers map it per dialect.
type Column ¶
Column is one physical column with its agent-facing description. The description is the semantic contract surfaced through describe_entities; traps (units, grain, enums, time roles) live here on purpose.
type Config ¶
type Config struct {
// Seed feeds every pseudo-random choice. Changing it produces a new,
// equally deterministic dataset (and invalidates expected task results).
Seed int64
// Scale multiplies base row counts (1 = reference profile).
Scale int
// Anomalies toggles injected irregularities. The reference profile keeps
// all of them on; disabling one removes that pattern deterministically.
Anomalies Anomalies
}
Config controls generation. The zero value is invalid; use DefaultConfig.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig is the reference profile: seed 1, scale 1, all anomalies on.
type Confounder ¶ added in v0.1.10
Confounder is a wrong answer value tied to a specific failure mode.
type Dataset ¶
Dataset is the fully generated workload.
func Generate ¶
Generate builds the whole dataset. Module builders run in dependency order and read earlier tables' rows, so relationships are consistent by construction.
func (*Dataset) DiagnosticProfile ¶ added in v0.1.10
DiagnosticProfile extends the workload profile with isolated aliases used only by the v5 governance suite, each on its own view of wl_customers (see DiagnosticViews). Keeping them separate preserves the v4 workload baseline and its generated expectations.
func (*Dataset) DiagnosticViews ¶ added in v0.1.11
DiagnosticViews renders the views behind DiagnosticProfile's aliases; seed them after Statements.
func (*Dataset) Profile ¶
Profile renders the runnable combined-profile server configuration for the whole dataset (PostgreSQL datasource, analyst role, all entities). Governance stays deliberately light: masks demonstrate field governance without changing task answers; row-level and denial scenarios remain the regression track's job.
func (*Dataset) Statements ¶
Statements renders DROP/CREATE/INSERT statements for every table of the dataset in the given dialect, one statement per element (MySQL-family drivers reject multi-statement strings).
func (*Dataset) StatementsIn ¶
StatementsIn renders the dataset with every table name qualified by schema (empty schema renders bare names; the MySQL family additionally gets a CREATE DATABASE for the schema).
type Expectation ¶
type Expectation struct {
Contains []string
Result *ResultTable
}
Expectation is the machine-checkable outcome of one task: substrings the final answer must contain and the full expected result table.
type Oracle ¶ added in v0.1.10
type Oracle struct {
Confounders map[string]Confounder
}
Oracle holds counterfactual wrong answers for diagnostic grading.
type ResultTable ¶
ResultTable is a task's expected result in canonical string form, emitted as CSV under fixtures/v4/<module>/expected/ and used by the evidence grading channel. Rows are sorted by their first column.
type Table ¶
type Table struct {
Module string // commerce-core | payment-orchestration | ledger-settlement | live-monetization
Name string // physical table name (wl_ prefix)
Entity string // exposed entity name
Description string // agent-facing entity description
PrimaryKey []string
Columns []Column
Rows [][]any
}
Table is one physical table spec plus its generated rows.
func (*Table) ColumnIndex ¶
ColumnIndex returns the position of a column or panics: table specs and row builders live in this package, so a miss is a programming error.
func (*Table) StatementsIn ¶
StatementsIn renders one table's DDL and seed rows under a schema.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
workloadgen
command
Command workloadgen renders the checked-in fixtures/v4 artifacts from the deterministic generator: per-module DDL and seed SQL for every dialect, expected task results (CSV), per-module entity policies, and the runnable combined profile.
|
Command workloadgen renders the checked-in fixtures/v4 artifacts from the deterministic generator: per-module DDL and seed SQL for every dialect, expected task results (CSV), per-module entity policies, and the runnable combined profile. |