fix: handle Pydantic dict format in YAML numeric parser (GH#1235)#1236
Merged
fix: handle Pydantic dict format in YAML numeric parser (GH#1235)#1236
Conversation
`parse_numeric_sequence()` only accepted the `{value: [...]}` wrapper
for Mapping values. Pydantic serialises hdd_id as a named-key dict
(`{hdd_accum: 13.5, cdd_accum: 13.5, ...}`), causing silent fallback
to all-zero values for heating/cooling degree-day accumulators.
Add fallback that extracts numeric values from all mapping keys when
the standard RefValue wrapper is absent.
Fixes #1235
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous reference (from #1116) was generated through the buggy parser path, baking incorrect hdd_id=0 into the baseline. Regenerate using the fixed parser so the reference reflects correct anthropogenic heat flux calculations. Verified at pre-Vitor commit (77e861e) that both Python backend and CLI paths produce output matching the known-good pre-#1116 reference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI Build PlanChanged FilesRust bridge (1 file)
Tests (2 files)
Build Configuration
Rationale
Updated by CI on each push. See path-filters.yml for category definitions. |
The test only looked for the binary at the development path (src/suews_bridge/target/release/suews), which doesn't exist in CI where cibuildwheel installs the wheel. Fall back to the installed binary via supy.cmd.rust_bridge._bridge_binary() so the test runs in both development and CI environments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove dead test_sample_output_validation (legacy run_supy API) - Remove unused helpers: get_platform_info, save_debug_artifacts - Remove dead imports: json, _DTS_AVAILABLE - Rename test_rust_bridge_sample_output -> test_sample_output_validation - Rename test_rust_backend_via_simulation -> test_library_cli_parity - Trim parity test to 3 days (~5s) instead of full year (~18s) - Trim stale module docstring Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Read Arrow output into bytes before closing the TemporaryDirectory context. pyarrow.ipc.open_file keeps the file handle open, which blocks cleanup on Windows (PermissionError WinError 32). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
parse_numeric_sequence()inyaml_config.rsto handle Pydantic's named-key dict serialisation ofhdd_id(e.g.{hdd_accum: 13.5, cdd_accum: 13.5, ...}), which was silently falling back to all-zero valuessample_output.csv.gzwith correcthdd_idvaluesRoot cause
The Rust YAML parser only recognised the
{value: [...]}wrapper forMappingvalues. When the Python backend serialises config via Pydanticmodel_dump(),hdd_idbecomes a named-key dict. The parser returnedNone, triggering a silent fallback to[0.0, ...]for heating/cooling degree-day accumulators. This affected anthropogenic heat flux (QF) and cascading variables.The bug was introduced in #1209 (Rust bridge) but only became visible when #1116 regenerated the sample reference through the buggy path.
Verification
77e861e37): applied parser fix only, bothtest_rust_backend_via_simulationandtest_rust_bridge_sample_outputpass against the known-good pre-Compute c2m/c2h dynamically from HF08 RSL theory #1116 referencemake test-smoke: 15 passed, 2 skippedTest plan
test_rust_backend_via_simulationtest_rust_bridge_sample_outputpasses (CI skips — binary not at expected path)make test-smokepassesFixes #1235
🤖 Generated with Claude Code