r/SpecDrivenDevelopment • u/mrasu27 • 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?
1
u/Bullfrog_External 18d ago
Very interesting, that was my next to-do on SDD.
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