pkg: one version number for .pio.json - #269
Conversation
Track bmopf-report PR #16 (schema 0.1.0): meta case_study_generator + frequency, uppercase load model enum, per-sequence bus voltage bounds replacing the vsym arrays (multiconductor payload bumps to /2, 2.0.0), lumped three phase transformer series impedance referred per winding rating, transformer taps/neutral/no-load and the IBR, control profile, DC, and time series tables relocated under the extras escape hatch, a typed capacitor element, inline line impedance via a synthesized linecode, line i_max/s_max, and one-triangle symmetric matrix mirroring on read. The reader keeps accepting every pre-0.1.0 spelling. The vendored schema and example networks track bmopf-report@f2e3684; a regen_bmopf_examples example rebuilds the checked-in outputs. Grounded terminals now count as referenced in the unused-terminal prune, so standalone grounding survives a write. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-up on the BMOPF 0.1.0 alignment: the new DistLine i_max/s_max fields wrote BMOPF but vanished silently through the dss and PMD writers, against the fidelity policy. - The PMD ENGINEERING line has its own cm_ub/sm_ub slots, so the line ratings now map both directions: the reader takes line-level cm_ub/sm_ub into the typed fields (an inline-impedance line's ratings stay on the synthesized linecode, whose sm_ub now re-inlines alongside cm_ub), and the writer emits them back. - The dss writer warns when it drops line i_max/s_max; the normamps/emergamps mapping decision stays with #266. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPB7LVTeMcdBYnzA9QdpPe
A PMD source spells an unbounded phase as JSON null, which restores as Inf in the model; the writer's num zero fallback then turned "no limit" into a zero limit. Line and switch i_max/s_max now go through a bounds guard that drops the field with a warning when any entry is nonfinite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPB7LVTeMcdBYnzA9QdpPe
schema_version (0.2.0) covers the whole document, model JSON included. The reader accepts exactly its own lineage (major.minor while the major is 0) and rejects anything else with an error that says to regenerate from the source case. The schema URL field, payload_schema, payload_schema_version, the PIO_PAYLOAD_* constants, and the published payload schema documents are gone; pio-package/0.2/schema.json embeds every model type and is the one published document. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Conversion MatrixLegendCells show
Transmission7 cases.
Distribution7 cases.
Full warning details: download |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR consolidates .pio.json versioning to a single schema_version covering the entire document (including the model payload) and updates the distribution (BMOPF/PMD/DSS) converters and fixtures to BMOPF schema 0.1.0 conventions, including new/relocated fields and schema publication changes.
Changes:
- Replace the previous envelope+payload version identifiers with one
.pio.jsonschema_version(now0.2.0) and enforce “same lineage” compatibility on read (exact0.<minor>.xwhile major is 0). - Remove payload-schema declarations/constants from
powerio-pkg, update docs/tests, and publish a single embedded schema document (pio-package/0.2) instead of separate payload schema docs. - Align
powerio-distBMOPF/PMD/DSS read/write paths and fixtures with BMOPF schema 0.1.0 (e.g., load model casing, bus bound fields, transformer overflow handling, inline line impedance and ratings, typed capacitors, one-triangle matrix mirroring).
Reviewed changes
Copilot reviewed 35 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/tests/test_package.py | Updates Python package JSON assertions to the single schema_version and absence of payload schema fields. |
| powerio-pkg/tests/roundtrip.rs | Adjusts roundtrip/version-gate tests to the single-version lineage rule and removes payload schema assertions. |
| powerio-pkg/src/package.rs | Removes schema/payload-schema fields, introduces 0.2.0 document versioning + lineage gate, updates error message semantics. |
| powerio-pkg/src/model.rs | Updates model payload documentation to reflect single document versioning. |
| powerio-pkg/src/lowering.rs | Updates multiconductor bus bound field checks to new per-sequence scalar names. |
| powerio-pkg/src/lib.rs | Removes re-exports of deleted schema URL/version constants. |
| powerio-pkg/examples/generate_schemas.rs | Switches schema generation to a single published pio-package/0.2 schema document embedding payload types. |
| powerio-dist/tests/rich.rs | Updates BMOPF load voltage model string expectations to schema 0.1.0 casing. |
| powerio-dist/tests/pmd.rs | Adds/updates PMD rating roundtrip coverage (cm_ub/sm_ub) and inline impedance behavior. |
| powerio-dist/tests/matrix.rs | Makes distribution conversion harness tolerant of DSS/PMD terminal renumbering and DSS load-profile flattening; improves idempotence checks. |
| powerio-dist/tests/bmopf.rs | Updates BMOPF fixture validation expectations, adds one-triangle matrix mirroring test, updates canonicalization/idempotence rules. |
| powerio-dist/src/pmd/write.rs | Writes line-level ratings to ENGINEERING (cm_ub/sm_ub) and warns on dropped typed capacitors. |
| powerio-dist/src/pmd/read.rs | Reads ENGINEERING line-level ratings and preserves inline ratings on synthesized linecodes. |
| powerio-dist/src/model.rs | Adds BMOPF 0.1.0 fields (bus sequence bounds, line i_max/s_max) and introduces typed DistCapacitor. |
| powerio-dist/src/lib.rs | Re-exports new DistCapacitor. |
| powerio-dist/src/dss/write.rs | Adds capacitor-drop warnings and warns that line i_max/s_max are currently dropped pending mapping decision. |
| powerio-dist/src/dss/read.rs | Initializes new DistLine rating fields as absent on DSS read. |
| powerio-dist/src/bmopf/write.rs | Updates $schema and meta block fields, relocates schema-less tables under extras, emits new fields, and adds nonfinite-bound handling. |
| powerio-dist/src/bmopf/read.rs | Adds extras-table ingestion, transformer overflow merge, one-triangle matrix mirroring, inline-linecode synthesis, and capacitor parsing. |
| powerio-dist/examples/regen_bmopf_examples.rs | Adds a helper to regenerate checked-in BMOPF example outputs. |
| powerio-dist/examples/bmopf/ieee34.json | Regenerates BMOPF example output to updated schema/meta/model conventions. |
| powerio-dist/examples/bmopf/4bus_dy.json | Regenerates BMOPF example output to updated schema/meta/model conventions. |
| powerio-dist/docs/conversion-matrix.md | Updates warning-count matrix documentation to reflect new behavior/baselines. |
| powerio-cli/tests/conversion_matrix_report.rs | Updates distribution conversion warning baselines with explanatory note for schema 0.1.0 changes. |
| powerio-cli/tests/cli.rs | Updates CLI package test to assert schema_version instead of schema URL. |
| powerio-cli/src/main.rs | Updates CLI packaging smoke test to look for schema_version in output. |
| powerio-capi/src/lib.rs | Updates C-ABI tests/comments to align package versioning with schema_version only. |
| docs/src/pio-json-schema.md | Updates .pio.json format docs to single-version pio-package/0.2 policy and removes payload-schema tier discussion. |
| docs/src/compiler-ir.md | Updates compiler IR docs to reflect single-version .pio.json rules. |
| docs/schema/pio-payload-multiconductor/1/schema.json | Removes the standalone multiconductor payload schema document from the repo. |
| docs/schema/pio-package/0.2/schema.json | Updates the published embedded schema for 0.2 (new fields, removed properties, new $id). |
| CHANGELOG.md | Adds an Unreleased entry describing single-version .pio.json and BMOPF 0.1.0 alignment changes. |
| .github/workflows/docs.yml | Updates docs site navigation and redirect generation to only publish pio-package/0.2 schema identifier pages. |
Comments suppressed due to low confidence (1)
docs/schema/pio-package/0.2/schema.json:4886
docs/schema/pio-package/0.2/schema.jsonstill contains aModelPayloaddescription that refers to the removedpayload_schema/payload_schema_versionfields. This makes the published schema docs inconsistent with the new “one version number” design; please regenerate/update the schema JSON so the embedded descriptions don’t mention fields that no longer exist.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (key, value) in doc { | ||
| let Value::Object(items) = value else { | ||
| continue; | ||
| }; | ||
| match key.as_str() { | ||
| "bus" => self.buses(items), | ||
| "linecode" => self.linecodes(items), | ||
| "line" => self.lines(items), | ||
| "switch" => self.switches(items), |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 39 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
python/powerio/mcp/server.py:236
powerio_pkg::NetworkPackageaccepts.pio.jsondocuments that omitschema_version(it defaults on read), but_package_value()currently requiresschema_versionto be present and a string. That makes MCP transport sniffing reject otherwise-valid package JSON and can misroute it through the non-package JSON classifier.
Consider treating schema_version as optional here (validate its type only when present) while still requiring model_kind and model.kind.
| pub struct NetworkPackage { | ||
| /// The schema URL identifying this package format. | ||
| #[serde(default = "default_schema_url")] | ||
| pub schema: String, | ||
| /// The package schema version (semver). | ||
| /// The `.pio.json` format version (semver); see | ||
| /// [`PIO_PACKAGE_SCHEMA_VERSION`]. Absent fields default to the current | ||
| /// version, so a hand-built document without it reads under current rules. | ||
| #[serde(default = "default_schema_version")] | ||
| pub schema_version: String, |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| fn assert_maps_eq(x: &[String], y: &[String], what: &str, ctx: &str) { | ||
| if x == y { | ||
| return; | ||
| } | ||
| assert!( | ||
| target_renumbers_terminals(what) && x.len() == y.len(), | ||
| "{what}: {ctx} {x:?} vs {y:?}" | ||
| ); | ||
| } |
Stacked on #264 (
worktree-bmopf-schema-010); review the last commit only. Merging #264 first collapses this diff to the versioning change. A same-named PowerIO.jl companion branch carries the constant mirror for the tandem CI.A
.pio.jsonfile carried four version identifiers:schemaandpayload_schema(URLs, written and never read) andschema_version/payload_schema_version(both gated on major equality, which is vacuous while every version has major 0). The file is a regenerable snapshot only powerio reads back, so the reader's whole versioning job is telling the caller when a file needs regenerating. That takes one number.schema_version(now0.2.0) covers the whole document, model JSON included. While the major is 0 an incompatible change bumps the minor and additive changes bump the patch; the reader accepts exactly its own major.minor lineage and rejects anything else with an error naming the lineage and saying to regenerate from the source case. Files written by 0.7.x and earlier get that error.schema,payload_schema, andpayload_schema_versionare gone from the wire form and the removed fields read back as ignorable unknowns. ThePIO_PACKAGE_SCHEMA_URLandPIO_PAYLOAD_*constants are gone from the API.pio-package/0.2/schema.json, which embeds every model type. The threepio-payload-*documents are deleted (the multiconductor/1copy was already orphaned: nothing generated it and the reader rejected files declaring it).pio-payload-multiconductor/2(2.0.0) payload bump dist: BMOPF schema 0.1.0 alignment #264 introduced: theDistBuswire change is covered by the 0.2.0 document bump instead.The remaining powerio-authored wire versions (SCOPF Julia wire at 1.0.0, dist capabilities at 1.0.0, summary and arrow catalog integers) are a follow-up issue.
🤖 Generated with Claude Code