One technique I've used quite often is to create a test which will make sure a generated file, in this case auto-generated types for an AST, is always up to date:
It's a trick I borrowed from how rust-analyzer handles its AST and various other auto-generated file, which in turn uses matklad's self-modifying code trick.
The above example is for generating Rust code, but I've also used it to make sure a schema.grapql file stays in sync with the upstream GraphQL API.