diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3b24018..e7aca4e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -31,12 +31,14 @@ jobs:
run: echo "GPG key loaded"
- name: Build and publish
- run: ./gradlew build :preflight-core:preflight-gradle-plugin:publishPlugins :preflight-core:preflight-runtime:publishMavenPublicationToOrbitalRepository
+ run: ./gradlew build :preflight-core:preflight-gradle-plugin:publishPlugins :preflight-core:preflight-runtime:publishMavenPublicationToOrbitalRepository :preflight-core:preflight-spec:publishMavenPublicationToOrbitalRepository
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
diff --git a/.gitignore b/.gitignore
index eb3b0c8..c7b1d4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@
.idea/**/contentModel.xml
# Sensitive or high-churn files
+.idea/**/kotlinc.xml
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index c224ad5..0000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 7f6e2dc..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/BUILDING.md b/BUILDING.md
new file mode 100644
index 0000000..231c656
--- /dev/null
+++ b/BUILDING.md
@@ -0,0 +1,107 @@
+# Building and Releasing
+
+## Building locally
+
+```bash
+cd preflight-core
+./gradlew build
+```
+
+This builds all modules (`preflight-spec`, `preflight-runtime`, `preflight-gradle-plugin`) and runs their tests.
+
+To also run the example project tests:
+
+```bash
+# From the repo root
+./gradlew build
+```
+
+## Installing to local Maven repo
+
+To test changes locally before releasing, publish all modules to `~/.m2`:
+
+```bash
+cd preflight-core
+./gradlew publishAllMavenLocal
+```
+
+### Using a local pre-release version in another project
+
+Consuming projects need `mavenLocal()` in their `pluginManagement` repositories so Gradle can find the locally-published plugin:
+
+```kotlin
+// settings.gradle.kts
+pluginManagement {
+ repositories {
+ mavenLocal()
+ gradlePluginPortal()
+ }
+}
+```
+
+Then reference the local version in `build.gradle.kts`:
+
+```kotlin
+plugins {
+ id("com.orbitalhq.preflight") version "0.1.0" // matches the version you published locally
+}
+```
+
+The plugin itself injects the Orbital Maven repositories automatically, so no other repository configuration is needed in the consuming project.
+
+## Bumping the version
+
+The version is set in one place: `preflight-core/build.gradle.kts`
+
+```kotlin
+allprojects {
+ group = "com.orbitalhq.preflight"
+ version = "0.1.0" // <-- change this
+}
+```
+
+All submodules inherit this version. The Gradle plugin also embeds it at build time via a generated `Versions.kt` constant.
+
+## Releasing
+
+Releases are triggered by pushing a git tag. GitHub Actions handles building, signing, and publishing.
+
+```bash
+# 1. Make sure you're on main with a clean tree
+git checkout main
+git pull
+
+# 2. Bump the version in preflight-core/build.gradle.kts, commit
+
+# 3. Tag the release
+git tag v0.1.0
+
+# 4. Push the commit and tag
+git push origin main
+git push origin v0.1.0
+```
+
+The `release.yml` workflow then:
+1. Builds the project with JDK 21
+2. Signs artifacts with GPG
+3. Publishes the Gradle plugin to the **Gradle Plugin Portal**
+4. Publishes `preflight-runtime` and `preflight-spec` to the **Orbital Maven repository** (`s3://repo.orbitalhq.com/release`)
+5. Creates a GitHub Release with JARs and auto-generated notes
+
+## Where artifacts are published
+
+| Artifact | Destination | How consumers resolve it |
+|-----------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------|
+| `com.orbitalhq.preflight` Gradle plugin | [Gradle Plugin Portal](https://plugins.gradle.org/) | `plugins { id("com.orbitalhq.preflight") }` |
+| `preflight-runtime` | Orbital Maven repo (`https://repo.orbitalhq.com/release`) | `maven { url = uri("https://repo.orbitalhq.com/release") }` |
+| `preflight-spec` | Orbital Maven repo (same) | Same repository config |
+
+Nothing is published to Maven Central. Consumers need the Orbital Maven repository in their `repositories {}` block to resolve the runtime (the Gradle plugin injects this automatically).
+
+## Required CI secrets
+
+These must be configured in the GitHub repository settings:
+
+- `GRADLE_PUBLISH_KEY` / `GRADLE_PUBLISH_SECRET` — Gradle Plugin Portal credentials
+- `GPG_PRIVATE_KEY` / `GPG_PASSPHRASE` — artifact signing
+- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` — S3 access for Orbital Maven repo
diff --git a/docs/pages/_meta.ts b/docs/pages/_meta.ts
index 6eff744..8f65dfd 100644
--- a/docs/pages/_meta.ts
+++ b/docs/pages/_meta.ts
@@ -2,6 +2,7 @@ export default {
// Controlling the order these are shown in the sidebar
"index": "Getting started",
"writing-tests" : "Writing tests",
+ "spec-files" : "Spec files",
"stubbing" : "Stubbing responses",
"integration-testing": "Integration testing",
"environment-variables" : "Environment variables",
diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx
index d036fe5..b6692ca 100644
--- a/docs/pages/index.mdx
+++ b/docs/pages/index.mdx
@@ -89,15 +89,19 @@ Here's the directory structure:
```
├── src
│ └── schema.taxi
-├── test
+├── test (Optional - for Kotlin tests)
│ └── SchemaSpec.kt
-└── test-resources (Optional)
- └── env.conf (Optional)
+├── test-resources
+│ ├── env.conf (Optional - environment variables)
+│ └── specs (Optional - markdown spec files)
+│ └── my-test.spec.md
taxi.conf
build.gradle.kts
settings.gradle.kts (Often blank)
```
+Tests can be written as Kotlin code in `test/` (see [Writing tests](/writing-tests)), as markdown spec files in `test-resources/specs/` (see [Spec files](/spec-files)), or both.
+
Then, to write your first test, create a folder `test` next to your `src` folder.
By convention, these are named ending in `Spec.kt` or `Test.kt`.
diff --git a/docs/pages/spec-files.mdx b/docs/pages/spec-files.mdx
new file mode 100644
index 0000000..25b2fe4
--- /dev/null
+++ b/docs/pages/spec-files.mdx
@@ -0,0 +1,302 @@
+---
+title: Spec files
+---
+
+# Spec files
+
+In addition to [writing tests using Kotlin](/writing-tests), tests can be authored in markdown spec file.
+
+Spec files are markdown files that define a test as a self-contained document. Each `.spec.md` file describes a single test case: the query to run, the stubbed data sources, and the expected result.
+
+Spec files serve as both living documentation and executable tests. They render nicely on GitHub and in documentation tools, while Preflight parses and runs them automatically.
+
+## File convention
+
+Spec files must:
+- Have the `.spec.md` extension
+- Be placed under `test-resources/specs/` (including subdirectories)
+
+```
+├── src/
+│ └── schema.taxi
+├── test-resources/
+│ └── specs/
+│ ├── customer-lookup.spec.md
+│ └── orders/
+│ └── order-flow.spec.md
+├── taxi.conf
+└── build.gradle.kts
+```
+
+No Kotlin test code is needed. The Preflight Gradle plugin automatically generates a test runner that discovers and executes all spec files.
+
+## Spec file format
+
+Every spec file has the same structure:
+
+````markdown
+---
+spec-version: 0.1
+---
+
+# Test name
+
+Optional description paragraph.
+
+## Query
+
+```taxiql
+find { Customer( CustomerId == "C-100" ) } as CustomerProfile
+```
+
+## Data Sources
+
+### Customer API
+
+
+Response:
+```json
+{ "id": "C-100", "name": "Alice Smith", "age": 30 }
+```
+
+## Expected Result
+
+```json
+{ "id": "C-100", "name": "Alice Smith", "age": 30, "isAdult": true }
+```
+````
+
+### Front matter
+
+The `---` delimited block at the top is required. Currently the only field is `spec-version`, which must be `0.1`.
+
+### Test name and description
+
+The `# H1` heading becomes the test name. Any prose between the H1 and the first H2 is captured as an optional description.
+
+### Query
+
+The `## Query` section contains a fenced code block with the TaxiQL query to execute.
+
+### Data Sources
+
+The `## Data Sources` section contains one or more `### H3` sub-sections, each representing a stubbed operation.
+
+Each stub needs an HTML comment directive immediately after the heading that identifies the operation:
+
+```markdown
+### My Stub
+
+```
+
+The `operation` value must match a Taxi operation name defined in your schema.
+
+#### Request-response stubs
+
+For standard request-response operations, add a `Response:` label followed by a JSON code block:
+
+````
+### Customer API
+
+
+Response:
+```json
+{ "id": "C-100", "name": "Alice Smith" }
+```
+````
+
+#### Stream stubs
+
+For streaming operations (e.g. Kafka topics), add `mode: stream` to the directive and use `Message:` labels:
+
+````markdown
+### Price Stream
+
+
+Message:
+```json
+{ "price": 100 }
+```
+
+Message:
+```json
+{ "price": 200 }
+```
+````
+Stream stubs must have at least one `Message:` block.
+
+### Expected Result
+
+The `## Expected Result` section contains the JSON you expect the query to produce. Preflight compares the actual query result against this JSON structurally.
+
+If the expected result is a JSON array, the query is executed as a collection query. If it's an object, it's executed as a single-object query.
+
+#### Result format qualifier
+
+The code block info string supports an optional qualifier to indicate the JSON format:
+
+| Info string | Meaning |
+|---|---|
+| `` ```json `` | Plain JSON (default) |
+| `` ```json typedInstance `` | Orbital TypedInstance JSON |
+
+The `typedInstance` qualifier is used when the expected result includes Orbital metadata like `type` and `dataSourceId`.
+
+## Adding additional information
+
+Headings other than those described in this doc are ignored, so you can add your own text, including references to issues, and even mermaid sequence diagrams - anything that markdown supports
+
+````markdown
+## Flow
+
+```mermaid
+sequenceDiagram
+ participant Q as Query Engine
+ Q->>C: getCustomer
+ C-->>Q: Customer
+```
+````
+
+
+## Running spec tests
+
+Spec tests run automatically as part of `gradle test`. No additional configuration is needed.
+
+```bash
+gradle test
+```
+
+The Preflight Gradle plugin generates a test runner class behind the scenes that discovers all `.spec.md` files in `test-resources/specs/` and executes them.
+
+### Debugging .spec.md files
+If you want to run spec tests from IntelliJ with the gutter play button, add a one-line Kotlin class:
+
+```kotlin
+// test/RunMarkdownSpecs.kt
+import com.orbitalhq.preflight.dsl.MarkdownSpec
+
+class RunMarkdownSpecs : MarkdownSpec()
+```
+
+This is optional - `gradle test` works without it.
+
+## Generating spec files with the API
+
+The `preflight-spec` library provides `TestSpecWriter` and `TestSpecReader` for programmatically creating and parsing spec files. This is useful for tooling that captures test scenarios automatically.
+
+### Writing a spec file
+
+```kotlin
+import com.orbitalhq.preflight.spec.*
+
+val spec = TestSpec(
+ specVersion = "0.1",
+ name = "Adult customer is identified correctly",
+ description = "Verifies that a customer over 18 is correctly identified as an adult.",
+ query = "find { Customer( CustomerId == \"C-100\" ) } as CustomerProfile",
+ dataSources = listOf(
+ Stub(
+ label = "Customer API",
+ operationName = "getCustomer",
+ mode = StubMode.REQUEST_RESPONSE,
+ response = """{ "id": "C-100", "name": "Alice Smith", "age": 30 }""",
+ messages = null
+ )
+ ),
+ expectedResult = """{ "id": "C-100", "name": "Alice Smith", "age": 30, "isAdult": true }""",
+ flow = null
+)
+
+// Write to string
+val markdown = TestSpecWriter.write(spec)
+
+// Or write directly to a file
+TestSpecWriter.writeFile(spec, Path.of("test-resources/specs/adult-customer.spec.md"))
+```
+
+### Stream stubs
+
+For streaming data sources, use `StubMode.STREAM` with `messages` instead of `response`:
+
+```kotlin
+val streamStub = Stub(
+ label = "Price Stream",
+ operationName = "priceStream",
+ mode = StubMode.STREAM,
+ response = null,
+ messages = listOf(
+ """{ "price": 100 }""",
+ """{ "price": 200 }""",
+ """{ "price": 300 }"""
+ )
+)
+```
+
+### TypedInstance results
+
+To indicate that the expected result uses Orbital's TypedInstance format, set `resultFormat`:
+
+```kotlin
+val spec = TestSpec(
+ specVersion = "0.1",
+ name = "Typed result test",
+ description = null,
+ query = "find { Customer }",
+ dataSources = listOf(/* ... */),
+ expectedResult = """{ "type": "Customer", "value": { "name": "Alice" } }""",
+ resultFormat = ResultFormat.TYPED_INSTANCE,
+ flow = null
+)
+```
+
+This produces a code block with the `json typedInstance` info string:
+
+````markdown
+## Expected Result
+
+```json typedInstance
+{ "type": "Customer", "value": { "name": "Alice" } }
+```
+````
+
+### Reading a spec file
+
+```kotlin
+import com.orbitalhq.preflight.spec.TestSpecReader
+
+// Parse from string
+val spec = TestSpecReader.read(markdownContent)
+
+// Or read from a file
+val spec = TestSpecReader.readFile(Path.of("test-resources/specs/my-test.spec.md"))
+
+// Access parsed data
+println(spec.name) // "Adult customer is identified correctly"
+println(spec.query) // "find { Customer(...) } as CustomerProfile"
+println(spec.dataSources) // List of Stub objects
+println(spec.expectedResult) // The expected JSON string
+println(spec.resultFormat) // ResultFormat.JSON or ResultFormat.TYPED_INSTANCE
+```
+
+### Data model reference
+
+```kotlin
+data class TestSpec(
+ val specVersion: String, // Must be "0.1"
+ val name: String, // From the H1 heading
+ val description: String?, // Prose between H1 and first H2
+ val query: String, // TaxiQL query
+ val dataSources: List, // Stubbed operations
+ val expectedResult: String, // Expected JSON
+ val resultFormat: ResultFormat, // JSON or TYPED_INSTANCE
+ val flow: String? // Optional Mermaid diagram
+)
+
+data class Stub(
+ val label: String, // From the H3 heading
+ val operationName: String, // From the directive
+ val mode: StubMode, // REQUEST_RESPONSE or STREAM
+ val response: String?, // JSON response (request-response mode)
+ val messages: List? // JSON messages (stream mode)
+)
+```
diff --git a/example-projects/mixed-sources/gradle/wrapper/gradle-wrapper.properties b/example-projects/mixed-sources/gradle/wrapper/gradle-wrapper.properties
index 37f853b..37f78a6 100644
--- a/example-projects/mixed-sources/gradle/wrapper/gradle-wrapper.properties
+++ b/example-projects/mixed-sources/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/example-projects/project-with-orbital-dependency/gradle/wrapper/gradle-wrapper.properties b/example-projects/project-with-orbital-dependency/gradle/wrapper/gradle-wrapper.properties
index 37f853b..37f78a6 100644
--- a/example-projects/project-with-orbital-dependency/gradle/wrapper/gradle-wrapper.properties
+++ b/example-projects/project-with-orbital-dependency/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/example-projects/simple-project/gradle/wrapper/gradle-wrapper.properties b/example-projects/simple-project/gradle/wrapper/gradle-wrapper.properties
index 37f853b..37f78a6 100644
--- a/example-projects/simple-project/gradle/wrapper/gradle-wrapper.properties
+++ b/example-projects/simple-project/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/example-projects/spec-project/build.gradle.kts b/example-projects/spec-project/build.gradle.kts
new file mode 100644
index 0000000..00b4992
--- /dev/null
+++ b/example-projects/spec-project/build.gradle.kts
@@ -0,0 +1,23 @@
+import java.net.URI
+
+plugins {
+ id("com.orbitalhq.preflight")
+}
+repositories {
+ mavenCentral()
+ mavenLocal()
+ maven {
+ name = "orbital"
+ url = URI("https://repo.orbitalhq.com/release")
+ mavenContent {
+ releasesOnly()
+ }
+ }
+ maven {
+ name = "orbital-snapshot"
+ url = URI("https://repo.orbitalhq.com/snapshot")
+ mavenContent {
+ snapshotsOnly()
+ }
+ }
+}
diff --git a/example-projects/spec-project/gradle/wrapper/gradle-wrapper.jar b/example-projects/spec-project/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..9bbc975
Binary files /dev/null and b/example-projects/spec-project/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/example-projects/spec-project/gradle/wrapper/gradle-wrapper.properties b/example-projects/spec-project/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..37f78a6
--- /dev/null
+++ b/example-projects/spec-project/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/example-projects/spec-project/gradlew b/example-projects/spec-project/gradlew
new file mode 100755
index 0000000..faf9300
--- /dev/null
+++ b/example-projects/spec-project/gradlew
@@ -0,0 +1,251 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/example-projects/spec-project/gradlew.bat b/example-projects/spec-project/gradlew.bat
new file mode 100644
index 0000000..9d21a21
--- /dev/null
+++ b/example-projects/spec-project/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/example-projects/spec-project/settings.gradle.kts b/example-projects/spec-project/settings.gradle.kts
new file mode 100644
index 0000000..3e4250a
--- /dev/null
+++ b/example-projects/spec-project/settings.gradle.kts
@@ -0,0 +1,12 @@
+pluginManagement {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ gradlePluginPortal()
+ maven { url = uri("https://repo.orbitalhq.com/release") }
+ }
+ includeBuild("../../preflight-core")
+}
+
+rootProject.name = "spec-project"
+includeBuild("../../preflight-core")
diff --git a/example-projects/spec-project/src/customer.taxi b/example-projects/spec-project/src/customer.taxi
new file mode 100644
index 0000000..1279d24
--- /dev/null
+++ b/example-projects/spec-project/src/customer.taxi
@@ -0,0 +1,19 @@
+type CustomerId inherits String
+type CustomerName inherits String
+type CustomerAge inherits Int
+
+model Customer {
+ id : CustomerId
+ name : CustomerName
+ age : CustomerAge
+}
+
+type IsAdult inherits Boolean = (age: CustomerAge) -> age >= 18
+
+model CustomerProfile inherits Customer {
+ isAdult : IsAdult
+}
+
+service CustomerApi {
+ operation getCustomer(CustomerId): Customer(...)
+}
diff --git a/example-projects/spec-project/taxi.conf b/example-projects/spec-project/taxi.conf
new file mode 100644
index 0000000..c5a2e8b
--- /dev/null
+++ b/example-projects/spec-project/taxi.conf
@@ -0,0 +1,5 @@
+name: com.foo/spec-project
+version: 0.1.0
+sourceRoot: src/
+additionalSources: {}
+dependencies: {}
diff --git a/example-projects/spec-project/test-resources/specs/adult-customer.spec.md b/example-projects/spec-project/test-resources/specs/adult-customer.spec.md
new file mode 100644
index 0000000..6062086
--- /dev/null
+++ b/example-projects/spec-project/test-resources/specs/adult-customer.spec.md
@@ -0,0 +1,29 @@
+---
+spec-version: 0.1
+---
+
+# Adult customer is identified correctly
+
+Verifies that a customer over 18 is correctly identified as an adult.
+
+## Query
+
+```taxiql
+find { Customer( CustomerId == "C-100" ) } as CustomerProfile
+```
+
+## Data Sources
+
+### Customer API
+
+
+Response:
+```json
+{ "id": "C-100", "name": "Alice Smith", "age": 30 }
+```
+
+## Expected Result
+
+```json
+{ "id": "C-100", "name": "Alice Smith", "age": 30, "isAdult": true }
+```
diff --git a/example-projects/spec-project/test-resources/specs/minor-customer.spec.md b/example-projects/spec-project/test-resources/specs/minor-customer.spec.md
new file mode 100644
index 0000000..b681ab8
--- /dev/null
+++ b/example-projects/spec-project/test-resources/specs/minor-customer.spec.md
@@ -0,0 +1,29 @@
+---
+spec-version: 0.1
+---
+
+# Minor customer is identified correctly
+
+Verifies that a customer under 18 is correctly identified as not an adult.
+
+## Query
+
+```taxiql
+find { Customer( CustomerId == "C-200" ) } as CustomerProfile
+```
+
+## Data Sources
+
+### Customer API
+
+
+Response:
+```json
+{ "id": "C-200", "name": "Bob Junior", "age": 12 }
+```
+
+## Expected Result
+
+```json
+{ "id": "C-200", "name": "Bob Junior", "age": 12, "isAdult": false }
+```
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 37f853b..37f78a6 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/preflight-core/build.gradle.kts b/preflight-core/build.gradle.kts
index 40eb023..0a0d465 100644
--- a/preflight-core/build.gradle.kts
+++ b/preflight-core/build.gradle.kts
@@ -26,7 +26,7 @@ tasks.register("publishAllMavenLocal") {
allprojects {
group = "com.orbitalhq.preflight"
- version = "0.0.5"
+ version = "0.1.0"
repositories {
mavenCentral()
diff --git a/preflight-core/gradle/wrapper/gradle-wrapper.properties b/preflight-core/gradle/wrapper/gradle-wrapper.properties
index 37f853b..37f78a6 100644
--- a/preflight-core/gradle/wrapper/gradle-wrapper.properties
+++ b/preflight-core/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/preflight-core/preflight-gradle-plugin/build.gradle.kts b/preflight-core/preflight-gradle-plugin/build.gradle.kts
index cbad436..f810748 100644
--- a/preflight-core/preflight-gradle-plugin/build.gradle.kts
+++ b/preflight-core/preflight-gradle-plugin/build.gradle.kts
@@ -22,7 +22,7 @@ repositories {
}
dependencies {
- implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.21")
implementation(project(":preflight-runtime"))
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
diff --git a/preflight-core/preflight-gradle-plugin/src/main/kotlin/com/orbitalhq/preflight/gradle/PreflightPlugin.kt b/preflight-core/preflight-gradle-plugin/src/main/kotlin/com/orbitalhq/preflight/gradle/PreflightPlugin.kt
index c55dde4..521b7d2 100644
--- a/preflight-core/preflight-gradle-plugin/src/main/kotlin/com/orbitalhq/preflight/gradle/PreflightPlugin.kt
+++ b/preflight-core/preflight-gradle-plugin/src/main/kotlin/com/orbitalhq/preflight/gradle/PreflightPlugin.kt
@@ -49,6 +49,33 @@ class PreflightPlugin : Plugin {
val testSourceSet = sourceSets.maybeCreate("test")
testSourceSet.resources.srcDir("test-resources")
testSourceSet.java.srcDir("test") // top-level test directory
+
+ // Generate a concrete MarkdownSpec subclass so .spec.md files are auto-discovered
+ val generatedTestDir = project.layout.buildDirectory.dir("generated/test/kotlin")
+ testSourceSet.java.srcDir(generatedTestDir)
+
+ val generateSpecRunner = project.tasks.register("generateSpecRunner") {
+ val outputDir = generatedTestDir.get().asFile
+ outputs.dir(outputDir)
+ doLast {
+ val dir = outputDir.resolve("preflight/generated")
+ dir.mkdirs()
+ dir.resolve("PreflightSpecRunner.kt").writeText(
+ """
+ |package preflight.generated
+ |
+ |import com.orbitalhq.preflight.dsl.MarkdownSpec
+ |
+ |class PreflightSpecRunner : MarkdownSpec()
+ """.trimMargin()
+ )
+ }
+ }
+
+ project.tasks.named("compileTestKotlin").configure {
+ dependsOn(generateSpecRunner)
+ }
+
testSourceSet.compileClasspath += mainSourceSet.output + mainSourceSet.compileClasspath
testSourceSet.runtimeClasspath += mainSourceSet.output + mainSourceSet.runtimeClasspath
diff --git a/preflight-core/preflight-runtime/build.gradle.kts b/preflight-core/preflight-runtime/build.gradle.kts
index 62a95f5..d76289c 100644
--- a/preflight-core/preflight-runtime/build.gradle.kts
+++ b/preflight-core/preflight-runtime/build.gradle.kts
@@ -3,10 +3,11 @@ plugins {
`maven-publish`
}
-val taxiVersion = "1.66.0-SNAPSHOT"
-val orbitalVersion = "0.36.0-M9" // Default version, can be overridden in consumer projects
+val taxiVersion = "1.71.0-SNAPSHOT"
+val orbitalVersion = "0.38.0-SNAPSHOT" // Default version, can be overridden in consumer projects
dependencies {
+ implementation(project(":preflight-spec"))
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation(platform("org.testcontainers:testcontainers-bom:1.19.3"))
@@ -132,4 +133,4 @@ configurations.all {
because("Use OSS JOOQ instead of commercial version")
}
}
-}
\ No newline at end of file
+}
diff --git a/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/MarkdownSpec.kt b/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/MarkdownSpec.kt
new file mode 100644
index 0000000..badbddf
--- /dev/null
+++ b/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/MarkdownSpec.kt
@@ -0,0 +1,76 @@
+package com.orbitalhq.preflight.dsl
+
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import com.orbitalhq.preflight.spec.StubMode
+import com.orbitalhq.preflight.spec.TestSpec
+import com.orbitalhq.preflight.spec.TestSpecReader
+import com.orbitalhq.stubbing.StubService
+import io.kotest.matchers.shouldBe
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+import kotlin.io.path.extension
+import kotlin.io.path.isRegularFile
+
+abstract class MarkdownSpec(
+ specsPath: String = "test-resources/specs",
+ sourceConfig: PreflightSourceConfig = FilePathSourceConfig()
+) : OrbitalSpec({
+
+ val objectMapper = jacksonObjectMapper()
+ val specsDir = Paths.get(specsPath)
+
+ if (Files.exists(specsDir) && Files.isDirectory(specsDir)) {
+ val specFiles = Files.walk(specsDir)
+ .filter { it.isRegularFile() && it.extension == "md" && it.fileName.toString().endsWith(".spec.md") }
+ .sorted()
+ .toList()
+
+ for (file in specFiles) {
+ val spec = TestSpecReader.readFile(file)
+ registerSpec(spec, objectMapper)
+ }
+ }
+
+}, sourceConfig)
+
+private fun OrbitalSpec.registerSpec(
+ spec: TestSpec,
+ objectMapper: com.fasterxml.jackson.databind.ObjectMapper
+) {
+ val stubCustomizer: (StubService) -> Unit = { stubService ->
+ for (stub in spec.dataSources) {
+ when (stub.mode) {
+ StubMode.REQUEST_RESPONSE -> {
+ val response = stub.response
+ if (response != null) {
+ stubService.addResponse(stub.operationName, response)
+ }
+ }
+ StubMode.STREAM -> {
+ val emitter = stubService.addResponseEmitter(stub.operationName)
+ stub.messages?.forEach { message ->
+ emitter.next(message)
+ }
+ }
+ }
+ }
+ }
+
+ describe(spec.name) {
+ it("matches expected result") {
+ val expectedJson = objectMapper.readTree(spec.expectedResult)
+ val isArray = expectedJson.isArray
+
+ if (isArray) {
+ val actual = spec.query.queryForCollectionOfMaps(stubCustomizer)
+ val actualJson = objectMapper.valueToTree(actual)
+ actualJson shouldBe expectedJson
+ } else {
+ val actual = spec.query.queryForMap(stubCustomizer)
+ val actualJson = objectMapper.valueToTree(actual)
+ actualJson shouldBe expectedJson
+ }
+ }
+ }
+}
diff --git a/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/containers/kafka/KafkaContainerSupport.kt b/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/containers/kafka/KafkaContainerSupport.kt
index 7dd0af1..44e683c 100644
--- a/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/containers/kafka/KafkaContainerSupport.kt
+++ b/preflight-core/preflight-runtime/src/main/kotlin/com/orbitalhq/preflight/dsl/containers/kafka/KafkaContainerSupport.kt
@@ -127,7 +127,6 @@ fun kafkaContainer(
schemaStore,
formatRegistry = formatRegistry,
meterRegistry = SimpleMeterRegistry(),
- emitConsumerInfoMessages = false,
kafkaConsumerStatsFlowBuilder = KafkaConsumerStatsFlowBuilder(GaugeRegistry.simple())
)
KafkaInvoker(kafkaStreamManager, kafkaStreamPublisher)
diff --git a/preflight-core/preflight-runtime/src/test/kotlin/com/orbitalhq/preflight/ExamplesSpec.kt b/preflight-core/preflight-runtime/src/test/kotlin/com/orbitalhq/preflight/ExamplesSpec.kt
deleted file mode 100644
index 505b781..0000000
--- a/preflight-core/preflight-runtime/src/test/kotlin/com/orbitalhq/preflight/ExamplesSpec.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.orbitalhq.preflight
-
-import app.cash.turbine.test
-import com.orbitalhq.preflight.dsl.OrbitalSpec
-import com.orbitalhq.preflight.dsl.forSchema
-import com.orbitalhq.stubbing.ResponseEmitter
-import kotlin.time.Duration.Companion.seconds
-import com.orbitalhq.expectMap
-import io.kotest.matchers.shouldBe
-
-class ExamplesSpec : OrbitalSpec(
- {
-
- describe("Examples") {
- it("can run a saved streaming query") {
- var eventEmitter: ResponseEmitter? = null
- val resultStream = runNamedQueryForStream("StreamPerson") { stubService ->
- eventEmitter = stubService.addResponseEmitter("clickEvents")
- }
- resultStream.test(timeout = 10.seconds) {
- eventEmitter!!.next("""{ "id" : "hi-1" }""")
- val next = expectMap()
- next.shouldBe(mapOf("personId" to "hi-1"))
- }
- }
- }
- }, forSchema(
- """
- model PersonClickedEvent {
- id : PersonId inherits String
- }
- model Person {
- personId : PersonId
- }
- service PersonApi {
- stream clickEvents : Stream
- write operation upsertPerson(Person)
- }
- query StreamPerson {
- stream { PersonClickedEvent }
- call PersonApi::upsertPerson
- }
-""".trimIndent()
- )
-)
\ No newline at end of file
diff --git a/preflight-core/preflight-spec/README.md b/preflight-core/preflight-spec/README.md
new file mode 100644
index 0000000..b5e6a60
--- /dev/null
+++ b/preflight-core/preflight-spec/README.md
@@ -0,0 +1,213 @@
+# preflight-spec
+
+A standalone library for reading and writing Preflight test spec files. These are markdown files — one test per file — that serve as both living documentation and machine-parseable test specifications.
+
+This module has **no dependency on Orbital or preflight-runtime**. It parses markdown to a data model and generates markdown from a data model. The bridge to Preflight's test execution lives in `preflight-runtime`.
+
+## Spec format
+
+Every spec file starts with YAML front matter declaring the version, followed by a strict heading structure:
+
+```markdown
+---
+spec-version: 0.1
+---
+
+# Customer Order Flow
+
+Optional description of what this test covers.
+
+## Query
+
+` ``taxiql
+find { Customer(customerId == "12345") } with { orders: Order[] }
+` ``
+
+## Data Sources
+
+### Fetch Customer Details
+
+
+Response:
+` ``json
+{ "id": "12345", "name": "Alice Smith" }
+` ``
+
+### List Customer Orders
+
+
+Response:
+` ``json
+[{ "orderId": "ORD-99", "status": "confirmed" }]
+` ``
+
+## Expected Result
+
+` ``json
+{
+ "customer": { "name": "Alice Smith" },
+ "orders": [{ "id": "ORD-99", "status": "confirmed" }]
+}
+` ``
+
+## Flow
+
+` ``mermaid
+sequenceDiagram
+ participant Q as Query Engine
+ Q->>C: getCustomer
+ C-->>Q: Customer
+` ``
+```
+
+*(The backticks above are escaped for nesting. Real files use standard triple-backtick fencing.)*
+
+### Sections
+
+| Heading | Level | Required | Purpose |
+|---------|-------|----------|---------|
+| `# ` | H1 | Yes | Test name. Exactly one per file. |
+| `## Query` | H2 | Yes | TaxiQL query in a `taxiql` fenced code block. |
+| `## Data Sources` | H2 | Yes | Parent for stubbed operations. |
+| `###