jacquard-codegen produces non-deterministic ordering of fields in the generated builder state types (State trait, Set*
structs, members module). Running the same command twice on the same input produces different output:
$ jacquard-codegen --input lexicons --output src
$ cp src/app_bsky/feed/like.rs /tmp/like1.rs
$ jacquard-codegen --input lexicons --output src
$ diff /tmp/like1.rs src/app_bsky/feed/like.rs
116d115
< type CreatedAt;
117a117
โ type CreatedAt;
126,132d125
< ///State transition - sets the created_at field to Set
< pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
...
The generated struct fields and serde attributes are stable, but the builder state machinery (trait associated types, Set*
state transition structs, and members marker types) shuffles between runs.
This likely comes from iterating over a HashMap (or similar unordered collection) when generating the required-field tracking
code.
This makes it impossible to check generated code into version control and verify it's up to date in CI via git diff --exit-code,
which is a common pattern (e.g., protobuf, sqlx).
Version: jacquard-lexgen 0.11.1 (also reproduced on 0.9.5)
yeah, i noticed the diff thrash, especially while i was updating codegen a LOT recently. will take a look at how it orders output and ensure consistent sorting. if you want to poke through there (either on main or bos-beta branch) and PR a fix, wouldn't complain, but no worries, will fix in a future version.