fix(differential): a rung's projection names its quantities in the file's order, so a tree nobody changed stops going red - #1469
Merged
Conversation
…le's order, so a tree nobody changed stops going red The walk that collects named expressions was driven by a set, and Python seeds string hashing per process, so the emitted YAML reordered itself between runs and the committed projection failed its own diff gate on `main`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TZbCoSM1Ah7YWg6K4Ps5sU
Documentation build overview
6 files changed ·
|
FBumann
enabled auto-merge (squash)
August 31, 2026 17:55
Merging this PR will not alter performance
Comparing Footnotes
|
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.
mainis red and this fixes it. ThePyPSA parityjob's last step — the committedcertificate, projections and tables are what this tree produces — failed on six rung
projections that no commit had touched. They differed only in the order of two named
expressions:
Cause: a set decided what order to write
projection.py's walk over named expressions, added in #1466, was driven by a set:Python seeds string hashing per process, so that set iterates differently on every run:
The projection is diff-gated, so a diff-gated artifact was being written in a random order.
It passed on #1466 by luck and failed on the very next run.
Membership sets are fine and the function keeps several —
mentioned,dead,dimsareonly ever queried, and every emitted collection is built by iterating the raw file and
filtering by them. What may not happen is a set choosing the order of what is written, which
is the one place this got it wrong. The walk now goes in the file's own declaration order.
Verified
git diff --exit-code -- differentialis clean afterwards.
PYTHONHASHSEED5, 6 and 7 givesone tree hash,
cb2a253006b2b3b7, three times.pixi run lint/format-checkclean;pyrefly0 errors.pixi run test— 3465 passed, 251 skipped, 94 failed, every failurexpress(the expiredlocal licence, matched by file and parameter id).
tools.ladderprints from them are regenerated; thecertificate and tables are unchanged, this being an ordering fix only.
Mutation table
projection.py)test_a_projection_orders_its_names_the_same_whatever_the_hash_seedemits a projection infour subprocesses under different
PYTHONHASHSEEDvalues and asserts one answer, then assertsthat answer is the file's order. Restoring the set-driven loop turns it red; it is green with
the fix. Subprocesses because one interpreter has one seed and cannot see the difference — the
reason the whole suite missed this.
Deliberately not done
them into lists would cost lookups to buy nothing.
own issue.