Fix equivalence harness miscalibration from #777 (DL-16) - #792
Merged
ktehranchi merged 1 commit intoAug 28, 2026
Merged
Conversation
Two defects landed on develop with PyPSA#777 and would make the next Tier-C harness run return an untrustworthy verdict. B1 - the usa leg compared two different demand pipelines. config.equivalence.yaml:77 pins `bus_allocation: breakthrough` so the western leg stays apples-to-apples with the anchor, which has no census-population method. config.equivalence-usa.yaml carried no such pin, and build.py copies the candidate's config into the anchor worktree, so BOTH sides ran unpinned at the new `population` default. Candidate demand was weighted by 2020 census county population, the anchor by Breakthrough Pd - diverging Load_t.p_set, Bus.LAF_state, the kmeans geometry (cluster_network.py:68,82 weights on load_weight) and the objective. Every resulting finding would read as a migration regression. DL-13's recorded usa leg stopped reproducing. B2 - prong 1 reported pass: false for a non-migration reason. load_weight is candidate-only and survives every compared stage, so compare.py:174-184 raised an unwaived column_set finding at five stages and compare.py:546-549 flipped the run to failing. The pin is the substantive fix; the waiver is sound only because of it. With breakthrough pinned the column carries the anchor's own legacy Pd weighting, so its presence is numerically inert. Demand content stays guarded by the UNWAIVED Load / Load_t.p_set comparisons, and load_weight VALUE findings are deliberately not waived - the waiver matches kind: column_set only, verified against compare.py's is_waived. Not yet exercised against a live harness run; the Tier-C re-baseline PyPSA#778 requires is still outstanding.
ktehranchi
added a commit
to ktehranchi/pypsa-usa
that referenced
this pull request
Aug 28, 2026
Refreshes the cleanliness sweep onto develop after the pypsa 1.3.0 / linopy 0.9.1 / pandas 3 migration (PyPSA#778), the config.common.yaml untrack (PyPSA#791) and the equivalence-harness recalibration (PyPSA#792). Conflicts, all in favour of develop's migrated code: - _helpers.py: develop deleted load_network (pypsa.descriptors.Dict and override_components are gone in v1); the sweep's own deletions of the unreferenced pdbcast / aggregate_* / get_aggregation_strategies / load_network_for_plots / setup_custom_logger helpers still apply, so the file is a pure deletion relative to develop. - add_extra_components.py: attach_stores stays deleted (still dead on develop -- its only call site is a comment); the sweep's copy_timeseries_for_suffix helper is kept. - summary.py: keeps develop's migrated imports (pypsa.statistics.get_bus_and_carrier no longer exists) and drops the unreferenced _helpers.configure_logging import along with the __main__ block that used it; get_energy_total / get_demand_base / get_capacity_base / get_capacity_brownfield / get_capital_costs stay deleted. _iter_components remains in use by get_energy_timeseries. No pre-1.3 API is reintroduced and no cleanup hunk was applied on top of code the migration rewrote. Dependency files are untouched and workflow/config/ holds only .gitkeep.
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.
Changes proposed in this Pull Request
Repairs two defects in the Tier-C equivalence harness that landed on
developwith #777 and would make the next run return an untrustworthy verdict. Surfaced by the adversarial review of #778, but not caused by it — both are present ondeveloptoday.Three files: one config line, one waiver, one ledger amendment. No pipeline code changes.
B1 — the
usaleg was comparing two different demand pipelinesconfig.equivalence.yaml:77pinsbus_allocation: breakthroughso the western leg stays apples-to-apples with the anchor, which has no census-population method (git show e7f8bd70:workflow/scripts/build_base_network.py | grep load_weight→ empty).config.equivalence-usa.yamlcarried no such pin, andbuild.pycopies the candidate's config into the anchor worktree — so both sides ran unpinned at #777's newpopulationdefault.Effect on any
EQ_INTERCONNECT=usarun: the candidate weights demand by 2020 census county population while the anchor weights by BreakthroughPd. That divergesLoad_t.p_set,Bus.LAF_state, the kmeans geometry (cluster_network.py:68,82weights onload_weight) and the objective — by the full reallocation. Every finding would read as a migration regression and not one of them would be. DL-13's recordedusaleg stopped reproducing the moment #777 merged.Fix: add the same pin and comment already present in
config.equivalence.yaml:75-77.B2 — prong 1 reported
pass: falsefor a non-migration reasonload_weightis candidate-only and survives every compared stage:cols2dropinaggregate_to_substations.py:165-188omits it,cluster_network.py:269sums it into the clustered frame, andclean_bus_datainadd_electricity.py:1058-1067drops onlyload_dissag/LAF/LAF_state. Socompare.py:174-184raises acolumn_setfinding at five stages andcompare.py:546-549flips the whole run to failing.Fix: one waiver, following the
Generator/ba_eiaprecedent atwaivers.yaml:59-64.Why the waiver is sound
Only because of the B1 pin. With
breakthroughpinned,load_weightcarries the anchor's own legacyPdweighting, so the column's presence is numerically inert. The two fixes are a package — the waiver alone would suppress a real signal.Scoping was verified against
compare.py's actualis_waived(lines 80-87), not by inspection:load_weightvalue differences remain live, and demand content stays guarded by the unwaivedLoad/Load_t.p_setcomparisons.Ledger
Recorded as DL-16 in
docs/superpowers/specs/2026-08-07-deltas-ledger.md, markedPENDING COUNTERSIGNATUREper the existing convention.Checklist
envs/environment.yaml.config.default.yaml.doc/configtables/*.csv.Verification performed:
waivers.yamlparses (29 entries); the new waiver was exercised againstcompare.py's verbatimis_waivedfor both the intended matches and the controls above. No harness run — the Tier-C re-baseline that #778 requires is still outstanding, and this PR does not discharge it. B1 in particular is a config change whose effect can only be confirmed by an actualEQ_INTERCONNECT=usarun.