Stop Writing Interpreters in YAML: Rules as an Embedded DSL

Keynote
Shanghai
3:50 p.m. - 4:30 p.m.
Venue E(Integrated Building, Room 108 Lecture Hall)
  • Nagato Yuzuru TerraQuanta Backend and Infrastructure Engineer

    OpenTelemetry Collector contributor

    chenchang

Abstract

Every system eventually grows a pile of decision logic that always breaks at runtime, at 3am. This talk offers another route: a type-safe, embedded DSL that lives inside Python.

Details

Every system eventually grows a pile of decision logic: risk checks, eligibility, permissions, discounts. It begins as a single if. To avoid cutting a release every time a threshold changes, you move the logic into YAML. Then the YAML sprouts conditions, then references to other rules, and one day you realize you've accidentally written an untyped programming language — one that always breaks at runtime, at 3am.

This talk offers another route: a type-safe, embedded DSL that lives inside Python. The individual checks stay as unit-testable pure functions, while how you combine them becomes composable, serializable data. What you get: logic you can hot-swap without a release, decisions that lay out why they passed or failed as a readable trace tree, and errors that show up when config loads instead of blowing up in production. I'll demo a real, working implementation on stage, and explain why doing this in Python is so convenient.