Skip to content

feat: sync the powerio server with upstream 0.1.1#35

Open
samtalki wants to merge 4 commits into
Power-Agent:mainfrom
samtalki:feat/powerio-0.1.0
Open

feat: sync the powerio server with upstream 0.1.1#35
samtalki wants to merge 4 commits into
Power-Agent:mainfrom
samtalki:feat/powerio-0.1.0

Conversation

@samtalki

@samtalki samtalki commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #28, against the released powerio 0.1.1 (release notes).

Suite: 85 passed, 1 skipped (the Windows-only detect test, per #29's skipif). The server still runs standalone (python powerio/powerio_mcp.py) and powermcp list/doctor are unchanged.

🤖 Generated with Claude Code

samtalki and others added 2 commits June 10, 2026 22:30
…memory

powerio 0.1.0 ships convert_str, so the server's inline conversion no longer
stages temp files; the _EXT/_stage/_unlink_quietly machinery is gone. The
file is now a faithful copy of the canonical powerio.mcp.server (same eight
tools, the docstring polish from its review, the save_case newline fix both
copies already shared), with the standalone header pointing at upstream. The
powerio extra pins >=0.1.0 and a regression test asserts inline conversion
never touches tempfile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PyPSA bridge: drop out-of-service branches and generators before
import_from_pypower_ppc, which ignores the ppc status columns; gencost
rows are realigned after generator drops. pandapower's from_ppc honors
status so its bridge is unchanged (documented by a new test).

powerio server: shadow-import guard on startup; explicit laplacian elif
with unreachable-else guard; OSError arm in convert_case; belt-and-
braces (ValueError/KeyError/TypeError) arm in _load.

tests: 7 new cases covering OOS branch/generator drops, pandapower
status contrast, laplacian matrix, bad-JSON ValueError, and OSError
normalization.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@samtalki samtalki force-pushed the feat/powerio-0.1.0 branch from 5d3c23e to 73ee997 Compare June 11, 2026 02:33
@samtalki

Copy link
Copy Markdown
Contributor Author

This PR is now rebased on main and includes all of Qian's fixes from #34 (PyPSA OOS drop, shadow-import guard, error normalization, laplacian elif). 91 tests pass on Python 3.12.

One thing worth flagging: powermcp 0.1.1 shipped with a silent topology bug in the PyPSA bridge. import_from_pypower_ppc ignores the ppc status columns, so out-of-service branches and generators were imported as fully active — wrong topology with no warning. That's fixed here (and would have been fixed by #34 too). Apologies for missing this before the 0.1.1 release.

If you agree it warrants a patch, a 0.1.2 release after this merges would be a clean way to get the fix to users. Happy to do whatever's most useful — just mention it and I'll handle the prep.

Upstream landed the error-shape hardening from the Power-Agent#34 review
(eigenergy/powerio#93, released as 0.1.1): _parse maps an unreadable
file (OSError) to the documented ValueError shape, convert_case says
"cannot read file" instead of "conversion failed" for that case, and
the defensive-arm comments came along. Ports the upstream suite's
unreadable-file and wrong-schema tests. No new powerio API, so the
>=0.1.0 floor stands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@samtalki samtalki changed the title feat: sync the powerio server with upstream 0.1.0 feat: sync the powerio server with upstream 0.1.1 Jun 11, 2026
Adds load_network_from_json and load_network_from_any to ANDES/andes_mcp.py,
following the same pattern as the PyPSA bridge. Both tools accept a powerio
JSON transport string or any powerio-readable file (MATPOWER, PSS/E, PowerWorld
.aux, PowerModels JSON, egret JSON), convert to MATPOWER via powerio's
case.to_format("matpower"), and write the result to out_path for ANDES to
consume via run_power_flow. Bumps the powerio extra pin to >=0.1.1 to match
the 0.1.1 server already on this branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@samtalki

Copy link
Copy Markdown
Contributor Author

@qian-harvard — carried your OOS fix and error hardening from #34 into this branch (see 73ee997). The ANDES bridge added in the latest commit follows the same pattern you established for PyPSA. Would love your eyes on the bridge section in ANDES/andes_mcp.py if you get a chance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant