This guide answers "which tier does my test belong to, where does the file go, and what should it assert?" Four tiers cover every test in the rewrite. For design principles (why pipeline is the primary behavioural tier, why code-string body matching and SQL-text assertions are banned), see Graphitron Development Principles. For build commands and database setup, see .claude/web-environment.md.

Choosing a tier

Read top-down; stop at the first match.

  1. The behaviour is "this generated source must compile against the real jOOQ catalog" → Compilation. No test class to write; the fixture-driven mvn compile -pl :graphitron-sakila-example -Plocal-db is the assertion. Add a fixture instead of an assertion.

  2. The behaviour is "this generated request must round-trip against PostgreSQL and return the right rows / fire the right number of queries / honour DataLoader batching" → Execution. New @Test in GraphQLQueryTest (or one of the federation-/scatter-named companions).

  3. The behaviour is what the model says an example means, or what a reader makes of what the store holds for it → Pipeline. A fact document claiming the rows, and where the behaviour is a reader’s, a test reading the document through FactGraphs; see What a test is built out of. The classification truth tables and the corpus they read retire with the walk and take no new cases.

  4. The behaviour is "this builder helper / writer primitive does X on input Y" → Unit. New case in a *Test next to the production class. A refusal is not a unit behaviour: it is a defect the store states, pinned by a document under defects/.

Tier answers how far a test runs; whether the test should exist at all is the Authoritative tests question, asked before any tier is chosen.

When two tiers could apply, prefer the one that captures the behaviour most directly. Pipeline beats unit: per-variant structural tests are bookkeeping; the primary signal is that a realistic example captures into the rows the model states for it. Pipeline also beats compilation and execution where the behaviour can be asserted on the store’s rows, since pipeline runs without jOOQ codegen or Postgres. Execution beats compilation only when SQL behaviour or row content is the contract.

Unit and integration (Alf, 2026-11-12). Graphitron generates SQL, so a unit test of generated code may use the database: a test that calls a generated method directly is a unit test of that method, database or not. A test that reaches generated code through a graphql-java operation is an integration test. The tier annotations below say what a test needs to run, @ExecutionTier that it needs PostgreSQL, not which of the two it is, and they stay that way (Alf, 2026-11-13): a unit test of generated code that uses the database carries @ExecutionTier.

What each module tests (Alf, 2026-11-15). The model carries the heaviest testing, since most of the business logic is there. The generator tests the code it generates, not the model; its tests are generator tests running queries against a store spun up from fact documents. The LSP tests its queries and its editor logic, and the MCP its queries and its MCP logic. graphitron-sakila-example is a limited example, not a place to test everything, but it carries end-to-end execution tests covering most of what Graphitron supports.

Tier is determined by what’s asserted, not by what module the file lives in. graphitron-sakila-example hosts tests at every tier; its module dependency on post-generator artifacts is the reason those tests live there, not a tier signal.

Tier annotations

Each tier has a JUnit 5 meta-annotation in graphitron’s test source root (`no.sikt.graphitron.rewrite.test.tier), republished as a tests test-jar so other modules can consume them. Reachable from every test class in graphitron and graphitron-sakila-example:

@UnitTier        // @Tag("unit")
@PipelineTier    // @Tag("pipeline")
@CompilationTier // @Tag("compilation")
@ExecutionTier   // @Tag("execution")

Place exactly one annotation at the class level. Tests that don’t fit any of the four tiers (GeneratorDeterminismTest is the only current example) carry @Tag("cross-cutting") directly.

With class-level tags in place, mvn test -Dgroups=pipeline runs only pipeline-tier classes; -DexcludedGroups=execution skips Postgres for fast inner loops. Both Surefire and Failsafe honour these flags without further config.

An enforcement test in each in-scope module (graphitron, graphitron-sakila-example) walks that module’s own test classpath and fails the build if any @Test-bearing class lacks a tier identity, or carries more than one.

Unit tier

Structural invariants on individual classifiers, builders, emitters, and runtime helpers.

Where: graphitron/src/test/java/…​ next to the production class.

Sub-families:

Generator unit tests (TypeFetcherGeneratorTest, GeneratorCoverageTest; and the generators/schema/ subdirectory: EnumTypeGeneratorTest, GraphitronFacadeGeneratorTest, InputTypeGeneratorTest, etc.). Take pre-built model fixtures via TestFixtures; assert TypeSpec shape (method names, return types, parameter signatures). Banned: code-string body matching on the generated MethodSpec body; that is what compilation and execution cover.

Validator unit tests (*ValidationTest family, e.g. ColumnFieldValidationTest, QueryTableFieldValidationTest). Build a GraphitronSchema with one parent type and one field at a known coordinate; assert validate() outcomes by RejectionKind and message substring. The family retires with the walk and takes no new cases: a new refusal is a defect the store states, pinned by a document under defects/ (Adding a defect).

Builder / catalog / writer unit tests (JooqCatalogFindColumnTest, IdempotentWriterTest, ArgBindingMapTest, ServiceCatalogTest, etc.). Targeted constructor or single-method assertions; no full-pipeline plumbing.

Renderer arm tests (ProjectionUnitRendererTest; the command-driven families). A renderer is a total function over a command’s sealed arms, so its inputs are record literals constructed at the point of assertion; no TestSchemaHelper, no fixture, no catalog. Every arm of the sealed set is reachable directly, which per-arm coverage of the emit never had while reaching an emitter branch meant driving the whole pipeline into one leaf configuration. The "pipeline beats unit" doctrine above was written against fixture-plumbed generator tests; renderer arm tests are a different species (no plumbing) and are the preferred home for per-arm structural assertions on command-driven emission. The producer’s decisions are asserted separately at the pipeline tier, as data (SDL to command rows, e.g. ProjectionMembershipTest, ConditionCommandsPipelineTest), without javapoet.

Emitter tests (the emit package) are the exception to record literals: an emitter’s input that a store states, the rows FrameQuery, FillQuery and BuildQuery answer, is read from a fact document through FactGraphs, never built by hand, since a literal can state a row no capture produces. Such a test reads a store, so it sits in the pipeline tier. A literal stays only for an input with no store origin: a stand-in for generated runtime code, or a shape the model or the generator refuses, which the test’s javadoc says.

Every emitted unit runs at the unit tier (Alf, 2026-11-22). A unit an emitter writes, a decoder, a check, a helper, a fill, gets a test that compiles the emitter’s output and calls it: read the rows from a fact document, compile with EmittedCodeHarness.compileFilesStrictly, and invoke the compiled classes directly, with the stubs in no.sikt.graphitron.emit.stub standing in for generated runtime (FillEmitterTest is the canonical class). Its edge cases, a refused value, each arm, the message a client reads, are asserted there. A test that sends a GraphQL request reaches the same code as an integration test, and covers what needs a request: binding, wiring, error routing; it is no substitute for running the unit.

Pipeline tier

An example captured into the store, and what the store holds for it.

Where: the fact documents under graphitron-model/src/test/resources/facts/, checked by FactExpectationTest, and the tests in any module that read them through FactGraphs.

A document is SDL plus its claims, each a directive on extend schema naming a relation and stating rows as CSV under a header of the relation’s columns:

Claim What it says

@expectEquals(relation:, rows:)

the relation’s rows in the document’s graph are exactly these

@assertContains(relation:, rows:)

these rows are among them

@assertAbsent(relation:, rows:)

none of these is among them

@assertEmpty(relation:)

the relation holds no row in the graph

Each takes an optional where:, SQL over the relation’s own columns, narrowing what the claim ranges over. A relation that carries no graph is the store’s, shared by every document, and takes only @assertContains and @assertAbsent. The document’s scenario is stated with the same vocabulary: @withFacts(docs:) pulls in the building blocks under shapes/ and layouts/, @tick(ms:) moves the clock so a later @withFacts is a second reading, and @withConfiguration sets the configuration the following captures run under, its fileAnnotations giving a file the folder holds the tag or description note a schema input entry configures, never adding one to what the capture reads, and its classpath naming a classpath fixture the graph is read over instead of the classpath corpus. A fixture is a named arrangement of roots in ClasspathFixtures, each root real Java that Maven compiles in graphitron-sakila-service; graphs share a store only when they share a classpath, and a scenario keeps the fixture its first configuration names. A claim is checked against the store as the step before it left it.

A test reads a document through FactGraphs.reader(), registered as an extension, as FACTS.read("scenarios/field-key-row", graph → …​): the graph is captured once for the run, whoever asks first, and handed over through a connection that can only select. An expectation that is not a store row, or that a module adds without editing the document, goes in an assertion file under that module’s src/test/resources/fact-assertions/, naming its document with @factDocument(path:); it only adds to what the document states.

-Dfacts=<prefix>[,<prefix>…​] narrows FactExpectationTest to the documents whose path starts with one, as -Dfacts=defects/entry-defect, for iterating on a document without capturing the rest. The whole-corpus gates skip themselves under it.

What a test is built out of

The tree keeps a library of examples and tests draw on it. Real service methods in graphitron-sakila-service, real tables and routines in graphitron-sakila-db, and SDL documents that use them. A test names an example and asserts what the store holds for it, so one test covers the reading and the model together: a derived relation asserted with no facts under it tests a view over rows somebody wrote, and a reading asserted with nothing consuming it tests a gatherer nobody reads. They are two sides of one subject and testing either alone is a missed opportunity.

The library is the asset, and tests are not its only reader. A manual page’s example selects a fact document and shows the rows it claims, so the example a test asserts against is the example a reader is shown. The same holds for the Java and SQL halves: a page explaining what @service reaches can name a method that exists, compiles and is captured, rather than printing a plausible-looking snippet that nothing checks. One example, several readers, and they cannot drift apart because there is only one of it.

So a shape a test needs and cannot find is a method to write in the service module or a table to add to the schema, and it then serves every later test and every page that cites it; a shape stated as rows serves one assertion and disappears with it.

Where an example goes

The folder states what the store does with a document’s scenario at its end: under scenarios it generates and stores no defect, under defects it stores one, and undecided only shrinks, under a ceiling FactExpectationTest lowers and never raises, so a new document never goes there. shapes and layouts hold building blocks other documents pull in, which no folder claim applies to. A shape that meets neither scenarios nor defects is a gap to close, not to park: a refusal the store does not state yet is a defect to add, and one raised on a valid schema is a regression to fix.

One exception, by ruling only: a document whose schema is valid and whose facts the store states, but which the generator refuses because the emitter does not yet handle the shape, may wait in undecided rather than lose its claims. The ceiling is then raised by one, its javadoc saying why, and a graph node brings the document back to scenarios and the ceiling back down when the emitter follows. Nothing else raises the ceiling.

Within the folder, choose by subject. A document has one subject, what one page example would show, is named for it (field-key-row, node-id-decode-unresolved-type), and opens with a header saying what it pins and why each type is there.

Look before you add

Find the behaviour’s keystone first, from the reference page (Authoritative tests). If it exists, extend it or rely on it, or state a different case of it by pulling the keystone in with @withFacts and adding only the variation, which the new document’s header names. A second document stating the same case merges into the keystone. If there is no keystone, the document you are writing is the candidate, and the page’s example is where it belongs.

Set up with building blocks

Open a scenario with @withFacts(docs: […​]) pulling in the layouts and shapes it builds on, then state only what its subject adds. A setup repeated across scenarios is a shape waiting to be extracted, and a scenario that is awkward to state is usually a building block missing from shapes/ or layouts/. A defect document is a minimal pair, as Adding a defect states it: the rows the defect draws, and a near miss that draws nothing. To read a change, move the clock with @tick(ms:), write the next version with @withFacts, and claim what the store holds after it.

Claim it in the document

What the store holds for the example is claimed in the document, after the step it is about. Expectations that are not store rows, or that a test adds without changing the document, go in an assertion file in the module that answers them.

Improve as you go

Split a document that pins two subjects; merge documents that state the same example, which the same-example gate finds; move a document out of undecided into the folder whose claim it meets; never weaken a claim to make room for a case, give the case its own document instead. A document’s path is referenced by the manual and by assertion files, and a move updates them in the same commit.

Keep a store of your own only for a reason

A test that writes, times or fails a store, that captures a document under a configuration or a classpath its scenario does not state, or that puts graphs of two classpaths in one store, captures into a store it owns. Everything else reads the shared population.

Inline SDL is deprecated: a test’s schema becomes a fact document the population captures, and an inline read moves onto one (Alf, 2026-11-14). A search for a test that needs a store of its own found none, so the exceptions above are to be shown case by case rather than assumed, and the population, which keeps every store, is where their number and reuse are managed.

What is not an example

Two things are not examples, and are not built as though they were:

  • Rows written straight into the store. SeededStore writes both halves of a claim and nothing checks the halves against each other, so it can state a shape no reading produces. It is closed and dissolving: SeedingDissolutionGateTest holds its callers under a ceiling that only falls.

  • Strange patterns nobody writes. A rule that should hold across arbitrary shapes is a property test generating them, not a fixture hand-building one of them.

The classification walk’s shapes retire with the walk and take no new cases: the truth tables in GraphitronSchemaBuilderTest, the spec-by-example corpus under graphitron-model/src/test/resources/corpus/ that CorpusDocuments loads, and the *PipelineTest files built with TestSchemaHelper.buildSchema(sdl). An inline capture of a schema is allowed only for a shape whose defect the store does not yet record, under the ceilings InlineCaptureGateTest holds per module.

A documentation example: a page’s examples live in an examples folder beside it, a .graphql file of named operations or fragments, each naming the fact document it selects from with @factDocument(path:) and the relations whose asserted rows it shows with @factRows(relation:). ManualExampleTest renders each selection’s SDL into the page’s committed .graphqls and each shown relation’s rows, the fact document’s own @expectEquals block, into its committed _-prefixed .adoc, one tag region per example, which the page includes; FactExpectationTest holds those rows to a real capture. When a render legitimately changes, the test leaves this run’s output under graphitron/target/manual-examples/ and its message gives the cp line; never hand-edit a rendered file. Beside the approval sit floors for an example naming no fact document, a rendered file with no query, and an example no page beside its folder includes.

Banned in every test that reads generated source: code-string body matching.

Authoritative tests

Every behaviour has one authoritative test: the one place that pins it, which a reader asked "what makes this true, and what proves it" can name without searching. The behaviours are what the model says an example means, in three families, each anchored on one relation:

Family Anchor A behaviour’s shape

Claims

graphitron_claim

the claim’s kind and the kind of element making it

Defects

graphitron_entry_defect

the code, the kind of AST entry it sits at, and the directive applied there or around it

Defects

graphql_schema_problem

the stage that refused and the toolchain’s own name for the kind

Occurrences

graphitron_occurrence

the occurrence’s kind, its producer’s kind, and whether it is a root

A refusal the toolchain raises making a schema is a defect behaviour though not an entry defect: it has no declared code and not always a written position, so it pins from its own anchor into the defect family (Alf, 2026-11-10).

A family is the relations meta_relation declares at its anchor’s grain that spell the anchor’s key as the anchor does, so a relation stating more about the same thing joins its family by being declared. A relation keying something finer is an anchor of its own and pins nothing until it has a family: a path need and a path’s step are such grains, and path claims pin no behaviour for now. Whether paths are a fourth family is decided once the keystone report shows whether path documents repeat one another (Alf, 2026-11-10).

A document pins a behaviour when one of its claims, @expectEquals or @assertContains, matches rows of a family relation: the pin is read from the rows the claim matched, at the step the claim follows. Containing a behaviour is not pinning it, since every scenario holds a table type’s claim and few say so, and a claim that rows are absent pins nothing.

The reference documentation’s examples are the keystone. A page’s example selects a document with @factDocument(path:) and shows the rows it claims with @factRows(relation:); it is the keystone of what that document’s claims on that relation pin, and of nothing else the document pins. The keystone is the behaviour’s authoritative test. Every other document pinning the behaviour is a different case of it, which its header names, or it merges into the keystone, usually by pulling the keystone in with @withFacts and stating only its variation.

FactExpectationTest holds two counts that only fall, both over the whole corpus and skipped when -Dfacts narrows it:

  • duplicate pins: the pins documents make of a behaviour another document already pins, its failure naming each behaviour and the documents pinning it;

  • the same example: two documents whose graphs hold the same declared shape.

The keystone report is written to graphitron-model/target/facts-report/keystones.txt and gates nothing: the behaviours a page shows, the behaviours none does ranked by how many documents pin each, so documentation work goes where examples pile up without a page, and the documents that pin no family at all.

Every other test that touches a behaviour relies on its authoritative test rather than restating it. A test whose assertions are all pinned elsewhere is deleted, naming the authoritative test that covers each one.

Compilation tier

Generated source must compile against the test catalog.

Where: graphitron-sakila-example, run with mvn compile -pl :graphitron-sakila-example -Plocal-db. The compiler is the assertion; no hand-written assertions are needed for type correctness.

Two test classes layer structural checks on top:

GeneratedSourcesSmokeTest: every expected class is present in the emitter’s output package (catches a generator that silently drops a class).

GeneratedSourcesLintTest: generator-hygiene rules over emitted source text (e.g. no var in emitted code).

Execution tier

Generated code run against a real PostgreSQL: one generated fetcher or rows method called directly, or a full GraphQL request through the generated facade.

Where: two modules.

  • graphitron, for the code a fixture schema generates, tested where it is generated. Each fact scenario, a document under graphitron-model/src/test/resources/facts/scenarios, is run in generate-test-sources as a generating run would run it: a RunContext declaring the output coordinates, captured by GraphitronStore.captured and generated from what it captured, over the document text and classpath corpus FactExpectationTest checks (FactDocuments), by the GenerateTestSchemas launcher rather than the Maven plugin, into its own package under target/generated-test-sources/graphitron (no.sikt.graphitron.generated.facts.<name>, each hyphen an underscore), and plain JUnit tests call the generated classes, typed and checked by the compiler against what was emitted. A scenario is added by adding the document, and one stating a @withConfiguration is not generated; the classes it names must be on the test classpath before the test sources compile, so its services live in graphitron-sakila-service. Only scenarios generate (Where an example goes), so an execution test reads a scenario’s generated package, the same document its pipeline claims are stated in. A scenario the generator rejects stops the module’s test compilation, and is a defect the store does not record. Canonical class: ChildOutcomeExecutionTest.

  • graphitron-sakila-example, for the plugin path, the Java 17 compile, the Quarkus and HTTP wiring and federation. Canonical classes: GraphQLQueryTest on the Sakila fixture; FederationEntitiesDispatchTest on the federated fixture.

Run with mvn test -pl <module> -Plocal-db in the web sandbox, or without the profile where Docker runs Testcontainers.

The database: one per test JVM, TestDatabase in graphitron: the database -Dtest.db.url names, as -Plocal-db sets it, else postgres:18-alpine in Testcontainers seeded from the sakila init.sql. Never mocked, and never reset between tests, so tests are resilient rather than isolated: a test reads the seeded catalog rows, which no test deletes, a test that writes reads back only rows under keys it chose, and nothing asserts on how many rows a table holds.

Where an execution test gets its database: in graphitron-sakila-example, from SakilaDatabase and nowhere else. It is the one place that reads test.db., starts the container or composes a JDBC URL: url(), user(), password() and dsl() for the shared database, connect(…​) for a test that opens connections itself, and tenantUrl(stem) with createTenantDatabase(stem) and dropTenantDatabase(stem) for a test that needs databases of its own. A tenant database is named <stem>_<run token>, so two runs against one server do not collide on a fixed cluster-scoped name. dsl() hands its caller a context holding one open connection, and the caller closes it, as the next paragraph rules. SakilaDatabaseGuardTest fails the build on a container, a test.db. read, a DriverManager connection or a jdbc:postgresql: literal anywhere else in the module’s test sources.

Who closes a fixture connection (ruled by Filip, 2026-11-25): the class that opens it, and the field that holds it says so. A DSLContext built over a URL holds one open connection until it is closed, and every class runs in one test JVM, so a context no class closes holds its connection until the JVM exits and a suite of them runs the server out of connections. A class keeps its fixture context in a static field carrying JUnit’s @AutoClose, which closes the field’s value after the class’s own @AfterAll methods, and closes a context it opens inline with try-with-resources. Closing is not left to the harness, because a close nobody can see in the class is one a consumer copying the class never learns. FixtureCloseEnforcementTest fails the build on a static DSLContext field without @AutoClose, other than one that holds a context which renders SQL and opens no connection as soon as its class is initialized, a static final field set to DSL.using(SQLDialect.POSTGRES): @AutoClose costs nothing here, so the rule is enforced rather than left to review. It sees the field’s declared type and annotations by reflection; a connection held in a field of another type, a Connection or a pool, is closed by hand and outside what it checks.

The rule for both modules. Every class shares the database and writes to it while others read, so a test is correct on a database other tests write to at the same moment:

  • Seeded rows, the ones init.sql inserts, are read-only. A test that needs to change a row inserts its own and changes that.

  • A writer inserts under keys it chose (a marker title, an id it allocated) and deletes by key.

  • A reader asserts over rows it can name, seeded keys or keys it wrote, and never over a table’s cardinality, its tail, or two reads taken at different instants over a range a sibling can write into.

No guard can tell a whole-table count from a filtered one, so review holds this rule. Running the execution tier at a higher class parallelism, or two runs at once against one server, surfaces a test that breaks it faster than CI hits the interleaving.

State the JVM shares, and no key splits. Test classes run concurrently in one JVM, and some of what they share is a single value rather than rows: the default time zone or locale, a logger’s level, a framework’s static bookkeeping. No test can be resilient to another changing it, so a lock is the rule there, and only there:

  • A class that changes such a value puts back what it found, and takes @ResourceLock on a key every class changing that one value shares, held in a small holder class beside them with the reason (QuarkusTestLock, EncoderLoggerLevelLock).

  • When the value is one every class reads, so there is no set of classes to share a key, the class that changes it is @Isolated: CursorEncodingTest sets the default time zone, which every capture reads.

  • A test reading what is logged to a logger the JVM shares keeps only the records it can name: those its own thread logged, or those naming a key only it uses. That is the rule above applied to a log, and needs no lock.

State a key can split, rows above all, stays under the rule above; a lock there isolates a test the rule asks to be resilient (Alf, 2026-11-10).

Patterns:

  • JDBC round-trip count via the QUERY_COUNT listener (AtomicInteger reset per test to assert DataLoader batching or lazy-on-selection).

  • Returned-row-id sets and field-value assertions against the Sakila fixture catalog.

  • What did not run is a count too: that totalCount unselected costs no extra round trip is asserted on QUERY_COUNT, not by reading the statements.

Banned: assertions on the text of the SQL that generated code sends, whether one fragment or a whole statement. The rendered SQL is implementation; the rows and the round trips are the behaviour.

Module location vs. tier (graphitron-sakila-example)

Several tests live in graphitron-sakila-example for module-dependency reasons but classify by assertion, not module. Only GeneratorDeterminismTest is @Tag("cross-cutting"); the rest carry one of the four tier annotations:

  • GeneratedSourcesSmokeTest, GeneratedSourcesLintTest: @CompilationTier (consume the compile output).

  • FederationBuildSmokeTest, NoFederationRegressionTest: @PipelineTier (schema-construction assertions on the fixture-derived generated facade; no SQL).

  • ScatterSingleByIdxTest: @UnitTier (direct unit coverage, fully in-memory; lives in graphitron-sakila-example because it reflects against a generated *Fetchers class).

  • GraphQLQueryTest, FederationEntitiesDispatchTest: @ExecutionTier.

  • GeneratorDeterminismTest: @Tag("cross-cutting"), system-level ratchet for the three-clause writer contract (determinism + minimal-change writes + clean orphan removal). Does not fit pipeline (no classifier-to-TypeSpec assertion), compilation (no compile happens), or execution (no SQL).

Where a store-backed test gets its store

Tier answers how far a test runs. A second question is orthogonal to it: a test that reads the fact store has to get rows in front of itself, and how it populates the store follows what the test is about, not which module it happens to sit in. There is a harness per subject, and a structural guard (StoreFixtureGuardTest) fails the build on a test that opens a GraphitronModelStore itself instead of taking one from a harness.

Subject Harness What it hands you

What the store holds for an example, and what a reader makes of it, a relation’s algebra included

FactGraphs (graphitron-model test-jar), the default

A fact document’s graph, captured once for the run whichever test asks first and handed over through a connection that can only select: FactGraphs.reader() as an extension, then read(path, graph → …​). A view’s rows are claimed in the document that draws them; a check constraint is claimed by the document whose example would break it.

The store’s lifetime alone

FactStores (graphitron-model test-jar)

inMemory() and fileBacked(home), named rather than selected by a flag.

A facts writer putting rows in a table at its own cadence

FactWriters (graphitron-model test-jar)

The four shipped writers by name, over a store you opened from FactStores and a graph identity given as a name and a directory. A sibling of the capture harness rather than something under it: a writer test has no capture to run, and a captured fixture would have put rows in front of the assertion that the writer did not write.

A store of one’s own: a test that writes, times or fails a store, or captures a document under a configuration or classpath its scenario does not state

CapturedStore (graphitron-model test-jar)

A real capture over a document into a store the test owns, with named arms saying what each capture’s inputs are; CapturedStore.captureFolder runs a document’s rendered scenario as the population does. Below the line with the capture it drives, so a client can take it without taking the generator. Every other store-backed test reads FactGraphs instead.

A generator run whose schema is still inline

CapturedGraphs (graphitron-model test-jar)

A run over a fact document needs no harness of its own: read the document’s graph from FactGraphs and hand its handle and schema to GraphQLRewriteGenerator. Until a run’s schema is a document, CapturedGraphs.read(ctx, run → …​) captures it as a goal captures the context, into the population’s store for its catalog and classpath under a graph name of its own, and reads it there through the select-only connection. A run whose subject is a store directory takes a store of its own there with CapturedGraphs.own(ctx). A module outside the model never calls GraphitronStore.captured itself.

The dev loop’s own wiring, over rows only a pipeline run can produce

BuiltStore (graphitron test-jar)

A real buildOutput() run into a store on disk that outlives the run.

Your own module’s reads over a populated store

A fixture in your own module, over one of the above

Whatever reader-side surface is local to you. graphitron-mcp’s `StoreFixture is the worked example: every factory on it is one arm of CapturedStore or FactWriters with the module’s own vocabulary in front of it, a generated jOOQ package name instead of a catalog and the module’s own class census instead of a list the caller assembles. graphitron-lsp’s `StoreFixture is the same shape. Both move onto FactGraphs as their modules migrate, keeping a store of their own only where the row above does.

Until it moves onto a document, a test whose schema is still inline SDL, and that reads only its own graph, captures it into the population too, not into a store of its own and not into a store a harness clears between tests (Alf, 2026-11-12). The inline graph goes in under a name of its own, into a store the population lends it from a pool kept per catalog and classpath, and the test reads it back through the same select-only connection as a document’s graph. The reason is cost: a capture into a store that already holds other graphs, with its statement cache intact, costs a fraction of one into an empty or freshly cleared store. That store also holds one ballast graph from its first capture, so a read that forgets to filter on its graph sees the ballast’s rows and fails on every run instead of depending on which tests ran before it. A test that writes still fails on that connection and keeps a store of its own. Turning the inline SDL into a fact document later changes only what the test hands the population.

Where a build fixture goes is decided by the same question, one level up. A client’s fixture that runs a real build spans two tiers, so it lives above both rather than inside the client: graphitron-maven-plugin holds StoreBackedBuild and BuiltStoreFixture, and the tests that read them, because the dev mojo is what wires the generator to the two clients and that wiring is what those tests are about. The clients publish test-jars so a relocated test keeps its own module’s fixture vocabulary instead of a second copy that drifts, and neither client depends on graphitron at any scope; StoreClientBoundaryTest in each of them fails the build if one reacquires the edge, in main sources or in tests.

Capture code lives in the model, and every other module captures only through it (Alf, 2026-11-13): the graphitron module does not capture on its own, a test of what a capture writes lives in graphitron-model, and the generator’s tests take their stores from the model’s harnesses, FactGraphs first, and a whole run still on inline SDL from CapturedGraphs. CaptureBoundaryTest fails graphitron’s build when its main or test code calls a capture itself. That is also what puts the test stores in one place, the population and its pools, where their reuse is managed. Elsewhere real rows are the default: the language server and the MCP server exist to turn real inputs into real rows, so a fixture that skips that step stops testing the thing. `SeededStore, the seeding harness, is closed and dissolving (What is not an example).

If no harness expresses the shape you need, add it to the one that owns your subject rather than hand-rolling a helper in your test class. A harness carrying more helpers than any one reader needs is the cheap state; a spread of private copies that have quietly diverged is the expensive one, and it is expensive because nothing points the next author at the existing answer.

Build commands

# The verification build: the whole reactor, module-parallel as CI runs it
mvn install -Plocal-db -T 1C

# Unit + pipeline (no database needed)
mvn test -pl :graphitron -Plocal-db

# Compilation (generated source compiles against real jOOQ catalog)
mvn compile -pl :graphitron-sakila-example -Plocal-db

# All tiers including execution (requires local PostgreSQL via -Plocal-db)
mvn test -Plocal-db

# Skip execution tier for fast inner loops
mvn test -pl :graphitron -Plocal-db -DexcludedGroups=execution

# LSP tests at a CI-sized heap (after installing its upstream: -DskipTests -pl graphitron-lsp -am)
JDK_JAVA_OPTIONS=-Xmx2g mvn test -pl graphitron-lsp

-T 1C runs graphitron-lsp, graphitron-mcp, roadmap-tool and docs beside graphitron, none of them depending on it. Measured on one quiet workstation on 2026-11-17, it took the full build from 1,483 s to 1,378 s; graphitron itself slows from 437 s to 545 s sharing the machine with them, so the gain is about half what the shorter chain alone would give. It is a flag rather than .mvn/maven.config because .mvn/ is the contributor’s own, and because maven-invoker-plugin’s nested builds would inherit the file.

Local builds often run with a large heap (-Xmx6g through JDK_JAVA_OPTIONS on agent machines), while CI’s test JVMs take the default share of the runner’s memory. A heap regression, typically in H2’s planner over a new view or join, passes locally and runs out of memory on CI. So a change that adds or reshapes views or joins over the path or occurrence relations runs the LSP tests at -Xmx2g as above before it is handed over.

See .claude/web-environment.md for database setup prerequisites and the fixtures-jar footgun recovery.

Coverage measurement

Coverage is off by default. -Pcoverage attaches the JaCoCo agent to every module’s test fork and writes a per-module report at verify.

# Whole reactor, combined across tiers
mvn verify -Plocal-db -Pcoverage

# Regenerate the published page from whatever CSVs are on disk
mvn -pl roadmap-tool exec:java -q -Dexec.args='source-coverage .'

A module’s report attributes only that module’s own classes. graphitron’s figure is generator-source coverage from its unit and pipeline tiers; `graphitron-sakila-example’s figure is coverage of generated code from the compilation and execution tiers. Two kinds of generator code are missing from both. Code that ran in the Maven process during `graphitron:generate was never instrumented, because the agent is attached to test forks. Code that ran in another module’s test JVM (GeneratorDeterminismTest invokes the generator in-process) was recorded there, but a module’s report analyses only its own classes, so it is dropped when the report is written.

CI publishes the per-tier split for graphitron on trunk pushes. To reproduce it locally, run each tier into its own exec file:

# unit tier only
mvn test -pl :graphitron -Plocal-db -Pcoverage -Dgroups=unit \
    -Dleaf-coverage.skip -Djacoco.destFile=target/jacoco-unit.exec
mvn -pl :graphitron org.jacoco:jacoco-maven-plugin:0.8.15:report \
    -Djacoco.dataFile=target/jacoco-unit.exec \
    -Djacoco.outputDirectory=target/site/jacoco-unit

# pipeline tier only (same shape)
mvn test -pl :graphitron -Plocal-db -Pcoverage -Dgroups=pipeline \
    -Dleaf-coverage.skip -Djacoco.destFile=target/jacoco-pipeline.exec
mvn -pl :graphitron org.jacoco:jacoco-maven-plugin:0.8.15:report \
    -Djacoco.dataFile=target/jacoco-pipeline.exec \
    -Djacoco.outputDirectory=target/site/jacoco-pipeline

-Dleaf-coverage.skip is not optional in the tier runs: without it each run re-emits graphitron/target/leaf-coverage.jsonl from only that tier’s tests, leaving the inference-axis report a strict subset of what the full suite wrote. The page grows per-tier columns when it finds those directories. Read the columns as slices, not as a decomposition: cross-cutting classes are in neither, so the two do not sum to the combined figure, and the renderer arm tests this guide blesses as a unit-tier family land in the unit column by design.