Bound PowerFactory contingency element scans - #88
qian-harvard merged 2 commits into
Conversation
The bounded walk looped over range(cap) with a for/else, so it never probed index cap. A contingency listing exactly cap elements exhausted the loop without seeing PowerFactory's terminating None and was rejected as having "exceeded the safe limit" -- a false error, where main accepts it. The walk now probes one index past the cap: None there means the list is complete, anything else raises. Behaviour at the real cap of 10,000: n=10000 ok, total=10000, 10001 probes n=10001 "exceeded the safe limit", 10001 probes never None "exceeded the safe limit", 10001 probes The tests pin the boundary with the cap patched to the fixture's two elements, and assert the cap stays above max_affected_elements' clamp of 1000 so truncation remains reachable. The never-None fake now counts its probes and raises after ten, so reverting to an unbounded walk fails the test in milliseconds instead of hanging CI, which sets no pytest timeout -- checked by mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This does what #87 asked for: the walk now always terminates, a runaway I pushed one fix as Tests: the boundary is pinned with the cap patched to the fixture's two elements, and there's an assertion that the cap stays above Merging. Thanks for turning #87 around within the hour. |
Summary
get_contingency_summary.Nonewithin 10,000 elements.GetObject()implementation that never signals the end.This prevents the single PowerFactory worker from becoming stuck in an unbounded loop.
Validation
git diff --checkpassed.Closes #87