Skip to content

Sort escaped map/struct fields for deterministic compile output - #4785

Merged
josevalim merged 1 commit into
elixir-ecto:masterfrom
asweet-confluent:deterministic-escape-query
Aug 21, 2026
Merged

Sort escaped map/struct fields for deterministic compile output#4785
josevalim merged 1 commit into
elixir-ecto:masterfrom
asweet-confluent:deterministic-escape-query

Conversation

@asweet-confluent

Copy link
Copy Markdown
Contributor

Several builder escape functions re-embed a compile-time-computed map/struct as a literal AST via bare Map.to_list/1. Map.to_list/1's field order isn't guaranteed stable across separate compiler invocations, so two builds of identical source can produce different compiled bytecode whenever any of these get folded into a literal at compile time.

Several builder escape functions re-embed a compile-time-computed
map/struct as a literal AST via bare Map.to_list/1. Map.to_list/1's field
order isn't guaranteed stable across separate compiler invocations for
a map that went through updates (as opposed to a fresh literal), so
two builds of identical source can produce different compiled
bytecode whenever any of these get folded into a literal at compile
time (e.g. any from/2 call with a compile-time-known clause like
limit: 1, or a select with multiple map(binding, fields) terms).
@josevalim
josevalim merged commit c624abf into elixir-ecto:master Aug 21, 2026
8 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants