Repository navigation
Render mob_plugins.exs with sorted map keys (MOB-383) - #140
Merged
Merged
Conversation
RuntimeManifest.render/1 printed the manifest with inspect, whose map key order follows atom-creation order on OTP 26+. A VM that created the atoms in another order (deploy vs doctor/--check) rendered different bytes, so `mix mob.regen_plugin_manifest --check` reported drift right after a regen. Print every map with sorted keys (custom_options: [sort_maps: true]). The regression test writes a manifest with every map-bearing section from a fresh VM that creates every atom in reverse, then runs the check's byte comparison in the test VM.
…on't parse stdout (MOB-383 review)
Owner
Author
|
Review: reviewer subagent (Codex rate-limited until 12:17 PM today). Round 1: MERGE with two test-robustness nitpicks (ebin via :code.which breaks under --cover; elixir lookup unguarded and path parsed from merged stdout). Both fixed in d5b2173. Round 2: MERGE, no findings. CI tests green on d5b2173 (run 38774861826). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Linear MOB-383.
Problem
mix mob.regen_plugin_manifest --checkcomparespriv/generated/mob_plugins.exsbyte-for-byte withRuntimeManifest.render/1.render/1usedinspect(..., pretty: true), and on OTP 26+ a map prints its keys in atom-creation order, which differs between VMs. The file a deploy wrote and the one--check/mix mob.doctorre-rendered could differ in key order alone, so--checkreported drift right after a regen.Fix
render/1passescustom_options: [sort_maps: true]: every map, nested ones included, prints with sorted keys. The device evaluates the file, so key order has no effect on what it reads.Test
runtime_manifest_test.exs, "a manifest written by a VM with another atom order passes the --check comparison": a freshelixirVM creates every atom in reverse order and writes a manifest with every map-bearing section (screens, lifecycle, settings, notification_handlers, composites, styles/theme, default_font). The test VM then runs the check's byte comparison. It fails on master (the keys come out in a different order) and passes with the fix.Smoke: the committed
mob_plugins.exsof 6 local apps (bezalel, chopaat, livebook_mob, mishka_showcase, mob_demo, mob_deliver_hello), each evaluated and rendered in two VMs with different atom-creation orders, came out byte-identical.Audit: other generated files that print maps
I found no other committed or byte-compared file rendered from an inspected map or from map iteration:
TrustStore.trust_stanza/1already sorts.AppConfigusesterm_to_binary(..., [:deterministic]).driver_tab_*renders in the order of themob.exslist.NifActivation.render_record/1iterates a fixed list of platforms.mob.local.exsstanza andbeam_flagsinspect only strings and keywords.Merge.plist_keys/1has string keys, and nothing compares its output.AGENTS.md now has a gotcha for this.
Upgrading: the first regen rewrites an existing committed
mob_plugins.exswith its keys reordered and no content change. Commit that once.Review
Reviewer subagent (Codex rate-limited until 12:17 PM today): verdict to follow.