Sienna-Platform / Sienna-Platform/PowerOperationsModels.jl

test multiple evaluators: `findlast` over the evaluation-data `Dict` can return the wrong evaluator

Open
#308 0 comments 0 reactions 1 assignee View on GitHub

@luke-kiernan is already working on this.

Since Sep 16, 2026.

Dominant language
Julia
Stars
2
Forks
1
Avg merge
1d 16h
Merged PRs (30d)
26

Description

power_flow_evaluations only ever registers one evaluator (src/core/interfaces.jl:187-191), and no test registers more than one. The multi-evaluator path is untested, and it doesn't look correct.

latest_solved_power_flow_evaluation_data (ext/PowerFlowsExt/pf_solve_and_aux.jl:7) does findlast(x -> x.is_solved, collect(values(...))) over a Dict{DataType, AbstractEvaluationData} (IOM src/core/external_evaluation.jl:35-38). A Dict has no "latest" — values iterates in hash-slot order over objectid-hashed DataType keys, stable within a session but not across sessions or Julia versions. With more than one entry, which evaluator comes back is arbitrary.

That matters because IOM.calculate_aux_variables! (IOM src/core/optimization_container.jl:1328-1339) resets all evaluators, then for each one calls evaluate! and re-runs every evaluator-bound aux var key through the 3-arg calculate_aux_variable_value!, which throws away the data the loop is holding and re-derives it via findlast, then filters on ownership (pf_solve_and_aux.jl:158-162):

  • After the first evaluate!, only that evaluator is solved, so findlast returns it by luck.
  • After the second, both are solved and findlast may return the first. The second evaluator's keys then hit the || return and are silently never written — or, if both expose the same aux var type, are written from the wrong power flow.

No error, no warning: same silent-failure shape as #305.

Direction: have the IOM loop pass data to the existing 4-arg calculate_aux_variable_value! (pf_solve_and_aux.jl:95, :114) with the ownership filter moved onto a 4-arg POM method, dropping findlast from the path. Touches IOM too, so separate from #305.

Tests to add: two evaluators with disjoint aux var sets (all populated); two exposing the same aux var type (value comes from the intended one). Failure depends on Dict ordering, so a single green run proves little.

Related: #305. Also, my comment on #273 calls this findlast "the most recent simulation step" — wrong: evaluation_data is keyed by evaluator type, and reset_evaluations! clears the flags at the start of every solve, so nothing survives across steps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.