Repository navigation
Conversation
…lation sorted by name Their order reaches nothing a consumer reads since the program sorts them, so the spec sorts them once as it loads, and every reader after it reads them as they are. A spec keeps its entries in the order its file lists them, because the typeset document prints them in that order. Two files that differ only in a list's order load to equal specs and write back one text. The program, the namespace and the canonical form no longer sort them again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NNjZXCjH1FpCvxUvDGjWNw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NNjZXCjH1FpCvxUvDGjWNw
FBumann
added this pull request to stack #917
October 20, 2026 19:40
# Conflicts: # CHANGELOG.md
This was referenced Oct 21, 2026
Contributor
Author
Note The following content was generated by AI. Superseded by #924, which squashes #914, #916 and #921 into one commit on Generated by Claude Code |
FBumann
removed this pull request from stack #917
October 21, 2026 07:37
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.
Note
The following content was generated by AI.
A
Specnow sorts eachdims:list and each side of a relation as it loads. Their order reaches nothing a consumer reads since #914. Entries keep the file's order, because the typeset document prints them in it.Stacked on #914.
What this changes
dims:listkey:andvalues:to_yaml()writes back one text.to_yaml()writes those lists sorted. The author's order of adims:list is not kept, because it says nothing._lowering.py, 3 in_resolution.py's leaf dims,_sorted_columns, the canonical form'sdimssort and its_sorted_side.Speckeeps and which it sorts.Method, gate output, mutation table
Method. One annotated type,
Dims = Annotated[list[str], AfterValidator(sorted)], on the ninedimsfields. One field validator onRelationSpec.keyand.values, which sorts a list and a mapping by role and leaves a single column alone. The JSON schema is unchanged. No code builds a spec model withmodel_constructormodel_copy(update=...), so every spec model passes through the validators.Three relation-key sorts in
_condition_resolver.pystay. They sort the dimensions of the key's columns, not the roles, and a key may name one dimension twice.Tests.
test_the_order_a_file_writes_a_list_in_reaches_no_value_of_the_specruns on every example. It reverses everydims:list and each side of a relation, and asserts an equalSpecand an equalto_yaml().dimsin the order the file wrote them, and now expect them sorted. They are intest_composition,test_conditions,test_givenandtest_piecewise. The expanded weights of a curve list the breakpoint dimension where its name sorts, not last.test_pypsa_collapses.pysaid a frame gains a leadingscenarioorperiod. They now say it gainsscenarioorperiod, and compare sorted lists.Gates on
afe9235:pixi run lint: passed.pixi run test: 3322 passed, 1 skipped.pixi run docs-build: passed.docs/examples/library/composed.mdchanged, where the merged spec now lists its dims sorted.compile-tex: did not run here. Tectonic could not download its bundle in the sandbox. CI runs it.Mutation table. Each change was made by hand, and the full suite ran. The file was restored with
git checkout --, and__pycache__was dropped before and after each run. The tree came back clean each time.dims:list kept as writtentest_a_file_written_backwards_writes_the_same_texttest_a_file_written_backwards_writes_the_same_text[generator_maintenance]Not done
examples/keep their authors' list order. They are inputs, not written output.dimssort in composition here.Generated by Claude Code