Repository navigation
Sort ALL_PRESET_NAMES so the preset list is deterministic - #503
Merged
stikves merged 2 commits intoNov 11, 2026
Merged
Conversation
PratikDhanave
force-pushed
the
fix/deterministic-preset-order
branch
from
November 9, 2026 06:44
addfc60 to
9568319
Compare
ALL_PRESET_NAMES was built straight from a set union, so list_presets() and the "Unknown compression preset ... Available:" error named the presets in a different order every process (set order follows the hash seed). The diffusion module's list_presets already returns sorted(PRESETS.keys()), and this module's own --list-presets CLI handler sorts too; the set ordering here was the odd one out. Sort the union and pin it with a test; across three runs the unsorted list came out in three different orders, and sorted output is stable.
PratikDhanave
force-pushed
the
fix/deterministic-preset-order
branch
from
November 9, 2026 08:32
9568319 to
022b2ec
Compare
stikves
approved these changes
Nov 10, 2026
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.
Problem
ALL_PRESET_NAMES(python/src/coreai_models/export/presets.py) is built straight from a set union, solist_presets()and theUnknown compression preset '...'. Available: ...error name the presets in a different order every process (set iteration follows the per-process hash seed). Three consecutive runs on main:The diffusion module's
list_presetsalready returnssorted(PRESETS.keys()), and this module's own--list-presetsCLI handler sorts too — the set ordering here is the odd one out, not a deliberate choice.Change
ALL_PRESET_NAMES: list[str] = sorted(set(MACOS_PRESETS).union(IOS_PRESETS)), plus a regression test intest_from_preset.pyassertinglist_presets()equals the sorted union andALL_PRESET_NAMES.Verification
uv run pytest python/tests/test_model_units/test_export/test_from_preset.py -q→ 52 passed.uv run --frozen --only-group lint ruff check/ruff format --check, ruff 0.15.12) → clean.Independent follow-up to #495 from the same audit.
Developed with AI assistance; reviewed and verified by the author.