Documentation
¶
Overview ¶
Package testutil provides reusable corpus, fixture, and baseline helpers for DAWGS tests and diagnostic commands.
Index ¶
- Constants
- func FixtureNames(prefix string, count int) []string
- func NewDirectWriteScaleFixture(targets int) *opengraph.Graph
- func NewEndpointSeededExpansionScaleFixture(config EndpointSeededExpansionScaleConfig) *opengraph.Graph
- func NewFixedSuffixExpansionScaleFixture(config FixedSuffixExpansionScaleConfig) *opengraph.Graph
- func NewHopScaleFixture(fanout int) *opengraph.Graph
- func NewReconciliationScaleFixture(fanout int) *opengraph.Graph
- func NewScanLookupScaleFixture(fanout int) *opengraph.Graph
- func NewShortestPathScaleFixture(config ShortestPathScaleConfig) *opengraph.Graph
- func NewShortestPathScaleV2Fixture(config ShortestPathScaleV2Config) *opengraph.Graph
- func NewTrustPruningScaleFixture(fanout int) *opengraph.Graph
- func ValidateEndpointSeededExpansionScaleConfig(config EndpointSeededExpansionScaleConfig) error
- func ValidateFixedSuffixExpansionScaleV3Config(config FixedSuffixExpansionScaleConfig) error
- func ValidateShortestPathScaleV2Config(config ShortestPathScaleV2Config) error
- type BaselineMetadata
- type EndpointSeededExpansionScaleConfig
- type FixedSuffixExpansionScaleConfig
- type GeneratedNodeListParam
- type Params
- type ShortestPathScaleConfig
- type ShortestPathScaleV2Config
Constants ¶
const ( // ShortestPathScaleDataset identifies the generated shortest-path fixture. ShortestPathScaleDataset = "generated_shortest_paths" // FixedSuffixExpansionScaleDataset identifies the generated fixed-suffix // expansion fixture. FixedSuffixExpansionScaleDataset = "generated_fixed_suffix_expansion" // FixedSuffixExpansionScaleV3Dataset identifies the fixed-suffix fixture // grammar with independent root, cycle, and self-loop controls. FixedSuffixExpansionScaleV3Dataset = FixedSuffixExpansionScaleDataset + "_v3" )
const ( // ReconciliationScaleDataset identifies the generated reconciliation // fixture. ReconciliationScaleDataset = "generated_reconciliation" // TrustPruningScaleDataset identifies the generated trust-pruning fixture. TrustPruningScaleDataset = "generated_trust_pruning" // HopScaleDataset identifies the generated relationship-hop fixture. HopScaleDataset = "generated_hops" // ScanLookupScaleDataset identifies the generated scan-and-lookup fixture. ScanLookupScaleDataset = "generated_scan_lookups" )
const EndpointSeededExpansionScaleDataset = "generated_endpoint_seeded_expansion_v1"
EndpointSeededExpansionScaleDataset identifies the generated endpoint-seeded expansion fixture.
const ShortestPathScaleV2Dataset = ShortestPathScaleDataset + "_v2"
ShortestPathScaleV2Dataset identifies the second-generation generated shortest-path fixture.
Variables ¶
This section is empty.
Functions ¶
func FixtureNames ¶
FixtureNames returns stable, zero-padded fixture IDs.
func NewDirectWriteScaleFixture ¶
NewDirectWriteScaleFixture returns a deterministic graph for direct batch mutation tests. The requested number of target nodes is used exactly so that callers can exercise batch-flush boundaries without fixture rounding.
Every target has one deletable relationship and one relationship-upsert baseline. Deletion directions alternate, while the first two targets (when present) provide self-connected and high-degree cascade shapes. Separate root-to-survivor relationships are never incident to a target, including a same-kind survivor for exact delete-set assertions.
func NewEndpointSeededExpansionScaleFixture ¶
func NewEndpointSeededExpansionScaleFixture(config EndpointSeededExpansionScaleConfig) *opengraph.Graph
NewEndpointSeededExpansionScaleFixture creates terminal-selective expansion lanes with independently controlled productive and unproductive reverse work.
func NewFixedSuffixExpansionScaleFixture ¶
func NewFixedSuffixExpansionScaleFixture(config FixedSuffixExpansionScaleConfig) *opengraph.Graph
NewFixedSuffixExpansionScaleFixture builds a deterministic expansion fanout feeding a shared fixed suffix. It also emits independent wrong-kind, wrong-direction, wrong-endpoint-kind, and disconnected suffix decoys.
func NewHopScaleFixture ¶
NewHopScaleFixture returns deterministic one-hop fanout, kind-cardinality, endpoint-list, predicate-selectivity, and two-sided set shapes.
func NewReconciliationScaleFixture ¶
NewReconciliationScaleFixture returns the deterministic graphbench fixture for the ingestion reconciliation forms. fanout controls the degree of the REC-08 detach-delete target.
func NewScanLookupScaleFixture ¶
NewScanLookupScaleFixture returns deterministic wide-scan, large lookup, adjacency, ordering, and count shapes for the scan/lookup regression corpus.
func NewShortestPathScaleFixture ¶
func NewShortestPathScaleFixture(config ShortestPathScaleConfig) *opengraph.Graph
NewShortestPathScaleFixture builds deterministic linear, diamond, dead-end, cycle, parallel-edge, self-loop, wrong-direction, and disconnected shapes around a bound endpoint pair. Fanout controls parallel dead ends without changing the unique linear route's requested depth.
func NewShortestPathScaleV2Fixture ¶
func NewShortestPathScaleV2Fixture(config ShortestPathScaleV2Config) *opengraph.Graph
NewShortestPathScaleV2Fixture builds independent deterministic anchors for a primary path, hidden fan-in/fan-out, parallel kinds, diamonds, cycles, self-loops, and disconnected exhaustion. Every relationship has a stable logical_key so backend physical IDs are never required for path comparison.
func NewTrustPruningScaleFixture ¶
NewTrustPruningScaleFixture returns deterministic dense trust and pruning shapes without changing the cardinalities of the reconciliation fixture.
func ValidateEndpointSeededExpansionScaleConfig ¶
func ValidateEndpointSeededExpansionScaleConfig(config EndpointSeededExpansionScaleConfig) error
ValidateEndpointSeededExpansionScaleConfig rejects fixture configurations that cannot produce a valid or uniquely keyed endpoint-seeded graph.
func ValidateFixedSuffixExpansionScaleV3Config ¶
func ValidateFixedSuffixExpansionScaleV3Config(config FixedSuffixExpansionScaleConfig) error
ValidateFixedSuffixExpansionScaleV3Config rejects dimensions that cannot describe the exact v3 fixture grammar. V3 requires every population to be explicit; legacy and v2 callers retain their existing defaulting behavior.
func ValidateShortestPathScaleV2Config ¶
func ValidateShortestPathScaleV2Config(config ShortestPathScaleV2Config) error
ValidateShortestPathScaleV2Config rejects negative, inconsistent, or unsupported fixture dimensions.
Types ¶
type BaselineMetadata ¶
type BaselineMetadata struct {
// DAWGSVersion identifies the DAWGS build that produced the baseline.
DAWGSVersion string `json:"dawgs_version"`
}
BaselineMetadata records build identity needed to interpret a generated benchmark baseline.
func ResolveBaselineMetadata ¶
func ResolveBaselineMetadata(dawgsVersion string) BaselineMetadata
ResolveBaselineMetadata returns metadata for dawgsVersion, deriving the current build identity when it is empty.
type EndpointSeededExpansionScaleConfig ¶
type EndpointSeededExpansionScaleConfig struct {
// Depth sets the number of MemberOf hops in each lane.
Depth int
// MatchingEndpoints sets the number of terminal groups whose object IDs
// satisfy the benchmark predicate.
MatchingEndpoints int
// OtherEndpoints sets the number of terminal groups that do not satisfy the
// benchmark predicate.
OtherEndpoints int
// MatchingEligibleLanes sets the number of session-backed lanes ending at a
// matching endpoint.
MatchingEligibleLanes int
// OtherEligibleLanes sets the number of session-backed lanes ending at a
// nonmatching endpoint.
OtherEligibleLanes int
// MatchingIneligibleLanes sets the number of lanes without a session edge
// that nevertheless end at a matching endpoint.
MatchingIneligibleLanes int
// ParallelEdges sets the number of MemberOf edges emitted per lane hop.
ParallelEdges int
// AddCycle adds a reverse MemberOf edge near the middle of every lane.
AddCycle bool
// PropertyPayloadSize sets the length of synthetic payload properties.
PropertyPayloadSize int
}
EndpointSeededExpansionScaleConfig controls the endpoint populations and traversal lanes emitted by NewEndpointSeededExpansionScaleFixture.
type FixedSuffixExpansionScaleConfig ¶
type FixedSuffixExpansionScaleConfig struct {
// ExpansionDepth sets the number of Expand hops in each branch.
ExpansionDepth int
// Fanout sets the number of expansion branches rooted at the fixture root.
Fanout int
// ValidSuffixEvery attaches a suffix to every nth legacy branch.
ValidSuffixEvery int
// PropertyPayloadSize sets the length of synthetic payload properties.
PropertyPayloadSize int
// ExactReachableSuffixSources decouples reachable suffix density from the
// legacy modulus control. Nil preserves ValidSuffixEvery behavior; zero is
// an exact zero and is therefore materially different from nil.
ExactReachableSuffixSources *int
// ReachableSuffixDepths restricts suffix attachment to the listed expansion
// depths when nonempty.
ReachableSuffixDepths []int
// DisconnectedSuffixSources sets the number of suffix sources unreachable
// from any expansion root.
DisconnectedSuffixSources int
// ReverseFanIn sets the number of decoy Expand edges entering a productive
// branch boundary.
ReverseFanIn int
// SuffixPathsPerBoundary sets the number of distinct suffix paths attached
// to each selected boundary.
SuffixPathsPerBoundary int
// RootMatchCount sets the number of roots matching the fixture root key.
RootMatchCount int
// RootHasZeroDepthSuffix controls whether the primary root has a suffix;
// nil preserves the enabled default.
RootHasZeroDepthSuffix *bool
// AddProductiveBoundaryCycle adds a two-edge Expand cycle at the
// deterministic productive boundary. The two physical relationships have
// distinct endpoints and logical keys, so the cycle can be traversed once
// in either relationship-distinct expansion direction.
AddProductiveBoundaryCycle bool
// AddProductiveBoundarySelfLoop adds one Expand self-loop at the
// deterministic productive boundary.
AddProductiveBoundarySelfLoop bool
}
FixedSuffixExpansionScaleConfig controls expansion work, suffix density, decoys, and payload size in a fixed-suffix fixture.
type GeneratedNodeListParam ¶
type GeneratedNodeListParam struct {
// Prefix is prepended to each generated node identifier.
Prefix string `json:"prefix"`
// Count is the number of sequential identifiers to generate.
Count int `json:"count"`
// Include lists literal identifiers to place before generated identifiers.
Include []string `json:"include,omitempty"`
}
GeneratedNodeListParam resolves optional fixture IDs followed by a deterministic prefix/count sequence. It keeps high-cardinality database-ID parameters out of handwritten JSON.
type Params ¶
Params is a query parameter map that supports tagged generated and temporal values. A datetime is represented in JSON as:
{"$type": "datetime", "value": "2026-01-02T03:04:05Z"}
A deterministic string list is represented without committing a large handwritten array as:
{"$type": "string_list", "prefix": "missing", "count": 1000, "include": ["target-id"]}
Tagged values may also appear in nested maps and lists. Datetimes are canonical UTC instants with a numeric offset. This keeps shared corpus assertions independent of backend timezone-name ordering.
func (*Params) UnmarshalJSON ¶
UnmarshalJSON decodes plain JSON parameters and expands supported tagged values recursively.
type ShortestPathScaleConfig ¶
type ShortestPathScaleConfig struct {
// Depth sets the length of the fixture's unique linear route.
Depth int
// Fanout sets the number of dead ends attached to the route's start.
Fanout int
}
ShortestPathScaleConfig controls the depth and dead-end fanout of the generated shortest-path fixture.
type ShortestPathScaleV2Config ¶
type ShortestPathScaleV2Config struct {
// Depth sets the number of edges in each primary path.
Depth int
// ForwardRootFanOut sets the number of forward dead ends at the primary
// start node.
ForwardRootFanOut int
// ReverseRootFanIn sets the number of reverse dead ends entering the inbound
// root node.
ReverseRootFanIn int
// IntermediateFanOut sets the number of forward dead ends at FanInLevel.
IntermediateFanOut int
// IntermediateReverseFanIn sets the number of reverse dead ends entering
// the inbound path at FanInLevel.
IntermediateReverseFanIn int
// FanInLevel selects the intermediate level used for fanout and reverse
// fan-in decoys.
FanInLevel int
// ParallelKindCount sets the number of distinct relationship kinds between
// each parallel start and target pair.
ParallelKindCount int
// ParallelTargetCount sets the number of targets in the parallel-edge
// subgraph.
ParallelTargetCount int
// DiamondWidth sets the number of equal-length branches in the diamond
// subgraph.
DiamondWidth int
// DisconnectedWidth sets the number of intermediate nodes in the
// disconnected path.
DisconnectedWidth int
// PropertyPayloadSize sets the length of synthetic payload properties.
PropertyPayloadSize int
// AddCycle includes a reachable two-node cycle.
AddCycle bool
// AddSelfLoop includes a reachable self-loop.
AddSelfLoop bool
}
ShortestPathScaleV2Config controls independent path, decoy, fanout, and payload dimensions in the second-generation shortest-path fixture.