Documentation
¶
Overview ¶
Package metamorphic is the WRONG-catching SQL oracle for the DST harness (RFC-199 Tier 2). It tests the query engine's correctness WITHOUT an external reference: a Scenario asserts that the queries in each equivalence Group return the same result, and the deterministic engine (over SimFDB) is the judge — run them all, compare. A mismatch is a real finding: EITHER an engine bug OR a wrong equivalence claim (triage). No known-correct answer is needed; a single buggy rule or executor path cannot keep two logically-equivalent queries returning the same rows.
These Scenarios are the natural target of the LLM-adversarial generator (RFC-199): the LLM's semantic knowledge proposes the equivalence claims; this package's deterministic execution is the ground truth. Hand-written seed relations live in SeedCorpus; generated ones load from JSON.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
Name string `json:"name"`
Reason string `json:"reason"`
Ordered bool `json:"ordered,omitempty"`
Queries []string `json:"queries"`
}
Group asserts every query returns the same result. Reason records WHY the author (LLM or human) believes them equivalent — read during triage. Ordered compares rows in returned order; the default compares them as a multiset (order-independent), which is what "equivalent query" means for most rewrites.
type Scenario ¶
type Scenario struct {
Name string `json:"name"`
Seed uint64 `json:"seed"`
Tables []string `json:"tables"` // CREATE TABLE / CREATE INDEX bodies for the schema template
Data []string `json:"data"` // INSERT statements
Groups []Group `json:"groups"`
}
Scenario is a schema + seed data + equivalence groups. Field tags let the LLM generator emit it as JSON.
func LoadDir ¶
LoadDir reads scenarios from every *.json file in dir (each file is one Scenario object or an array of them) — the entry point for LLM-generated corpora.
func SeedCorpus ¶
func SeedCorpus() []Scenario
SeedCorpus is the hand-written metamorphic relations — equivalences that hold under SQL three-valued logic regardless of NULLs, so a correct engine returns zero violations. It gives the oracle immediate teeth and a template for what the LLM generator emits. Keep only relations you are certain are equivalent; a false relation here would be a spurious "bug".
type Violation ¶
Violation is one failed equivalence (or an errored query within a group).