r/SpecDrivenDevelopment • • 19d ago

I'm building a new kind of harness that tests code against formal specs

I'm developing a tool to check whether code satisfies formal specifications written in FizzBee. While TLA+ or FizzBee are good tools for checking whether a system can reach invalid states, they don't provide a way to verify implementations conform to the specifications. Unlike unit testing, there is no widely acceppted way to check implemented code follows a formal specification.

So, I built Spec Guardian:
https://github.com/mrasu/spec-guardian

It generates tests from the execution results of specifications written in FizzBee. The tests compare FizzBee's abstract states with concrete states stored in RDB tables or KVS. AI can also generate tests for the same purpose, but it tends to writes tests that follows implementations rather than specifications. That's why Spec Guarding generates tests primarily from FizzBee's results and yaml configuration.

Using Spec Guardian, I tested iceberg-go against a specification written by Jack Vanlightly.
As a result, I found that iceberg-go doesn't support Merge-On-Read mode and creates a single bundled file instead of multiple files as an optimization. While the goal of Spec Guardian is to find bugs, I think finding differences between implementations and specifications is a good sign that I'm on the right track.

It's still under development.
What do you think of this approach to comparing specifications and implementations? Could it become a new kind of AI harness? What features would you like to see added?

8 Upvotes

7 comments sorted by

1

u/Bullfrog_External 18d ago

Very interesting, that was my next to-do on SDD.

1

u/mrasu27 18d ago

Thank you!

1

u/Bullfrog_External 10d ago

Made a PoC of using Fizzbe as an additional route in my SDD workflow. Indeed a high percentage of the specs can be expressed with it, and running the test has discovered an additional fringe case not handled on my specs. Good results !

1

u/mrasu27 10d ago

So happy to hear it!

1

u/vincentdesmet 18d ago

I’m also running SDD (forked spec-kit since Oct 2025 so heavily modified to adopt trends (grill-me style domain modeling, more background agentic delivery with large dynamic workflows)

i’ve recently started building with Quint/TLA+ (tla-ts) from p-stack which helped significantly with a large durable workflow (state machine) to validate the model before writing the implementation

I’m curious how you fit it in SDD.. (it’s more like a spike in my flow atm, spikes/research tasks are part of the plan phase and can deliver all kind of artifacts before agents go into an implementation loop)

for me.. it was fed after the specify (non tech, user stories) and from scenarios tun demos to capture real network responses (a harness was built to run simulations to confirm the API docs and test out the constraints we could enforce)

from there the model was written and state graphs were built to narrow the model

all this fed into the integration tests / e2e tests the implementation was validated against and reviewed independently from the implementation (i use openclaw test-audit skill to do maintenance loops on all tests to keep them implementation decoupled too)

i’ll read more about your repo set up

1

u/mrasu27 17d ago

Hi,

My goal is to create a way to validate implementations against specifications.

In your case, Spec Guardian uses the specifications you create during the plan phase to validate the implementation during integration testing.

You seem to use specs to generate better integration tests or e2e tests with test-audit skill. Spec Guardian aims to achieve the same goal in a different way. It generates tests directly from specs rather than relying on reviews.

One thing I didn't mention in my post is that Spec Guardian also injects faults during execution. This allows it to check whether the implementation follows the order of operations defined in the specs. So it can check intermediate states and transitions as well as the final response.

1

u/vincentdesmet 17d ago

i feel that opus does this on its own - or i didn’t remember prompting it (or it’s in the test-audit skill and i didn’t notice)

but adding mutations to validate the test and running tla-ts does fault injection)

I think what i’m saying is that these are all valid side skills that play a role across the process but what i’ve learned most after using SDD for over a year now is that these process is a combination of “best practices today” - they change too much with the changes to the training on these LLM to lock anything in or make anything rigid