Type-Driven AI: High quality Scala code with LLM
summary
A production workflow enforces correctness for LLM-generated Scala code through six validation rings: compiler with refined types and Smithy/Iron IDLs, Scalafix and WartRemover linting, ScalaCheck property tests, Stryker4s mutation testing, Stainless proofs (formalish), and otel4s+Daut runtime telemetry. Specs use EARS and a concepts inventory; types are generated first and tests second. Applied to ~70k lines across two projects: 83 changes, 168 specs, ~2 test lines per production line, and three algorithms verified via Stainless.
AI-written summary · about
chapters (18)
- 0:00Introduction and context
- 2:38Defining code correctness
- 3:18The ring system approach
- 6:12OpenSpec workflow
- 6:46Applying the development phase
- 9:29Requirements and concepts
- 11:10Successive refinement
- 12:31Type-driven development
- 13:19Generating the oracle
- 14:18Linters and testing tools
- 19:49Formal-ish verification
- 20:16Kernel mirrors and bridges
- 20:49Verification insights
- 21:40Runtime contracts
- 22:07Telemetry and ring five
- 23:09Measuring workflow success
- 25:19Experimental implementations
- 26:50Conclusion
