Skip to content

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Jun 10, 2025

This PR fixes a bug in the Python model export: Call nodes referred to themselves instead of the function to be called.

Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.14%. Comparing base (fdc0e75) to head (098e413).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
hugr-py/src/hugr/model/export.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2323   +/-   ##
=======================================
  Coverage   82.14%   82.14%           
=======================================
  Files         242      242           
  Lines       43786    43786           
  Branches    39624    39624           
=======================================
  Hits        35968    35968           
  Misses       5836     5836           
  Partials     1982     1982           
Flag Coverage Δ
python 85.48% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hugrbot
Copy link
Collaborator

hugrbot commented Jun 10, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary

--- failure feature_missing: package feature removed or renamed ---

Description:
A feature has been removed from this package's Cargo.toml. This will break downstream crates which enable that feature.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/feature_missing.ron

Failed in:
feature hugr-persistent in the package's Cargo.toml
feature persistent_unstable in the package's Cargo.toml

--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/enum_missing.ron

Failed in:
enum hugr_core::hugr::views::render::UnsupportedRenderConfig, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views/render.rs:152
enum hugr_core::hugr::views::render::NodeLabel, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views/render.rs:228

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/inherent_method_missing.ron

Failed in:
Hugr::into_region_portgraph, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/internal.rs:397
Hugr::into_region_portgraph, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/internal.rs:397
SimpleReplacement::map_host_nodes, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/patch/simple_replace.rs:507
SimpleReplacement::map_host_nodes, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/patch/simple_replace.rs:507
SimpleReplacement::map_host_nodes, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/patch/simple_replace.rs:507
SimpleReplacement::map_host_nodes, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/patch/simple_replace.rs:507

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/struct_missing.ron

Failed in:
struct hugr_core::hugr::views::render::MermaidFormatter, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views/render.rs:34

--- failure trait_method_missing: pub trait method removed or renamed ---

Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#major-any-change-to-trait-item-signatures
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_method_missing.ron

Failed in:
method mermaid_string_with_formatter of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:419
method mermaid_format of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:441
method mermaid_string_with_formatter of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:419
method mermaid_format of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:441
method mermaid_string_with_formatter of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:419
method mermaid_format of trait HugrView, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/hugr/views.rs:441

@zrho zrho marked this pull request as ready for review June 10, 2025 00:40
@zrho zrho requested a review from a team as a code owner June 10, 2025 00:40
@zrho zrho requested a review from ss2165 June 10, 2025 00:40
Copy link
Contributor

@acl-cqc acl-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test??

@ss2165
Copy link
Member

ss2165 commented Jun 10, 2025

Testing is in progress here: #2317

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like needs a rebase on main for CI to be happy

@zrho zrho added this pull request to the merge queue Jun 10, 2025
Merged via the queue into main with commit 041342f Jun 10, 2025
24 of 26 checks passed
@zrho zrho deleted the zrho/fix-py-export-name-mangle branch June 10, 2025 09:01
@zrho zrho self-assigned this Jun 16, 2025
@zrho zrho added the bug Something isn't working label Jun 16, 2025
ss2165 pushed a commit that referenced this pull request Jun 24, 2025
This PR fixes a bug in the Python model export: `Call` nodes referred to
themselves instead of the function to be called.
github-merge-queue bot pushed a commit that referenced this pull request Jul 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.13.0rc1](hugr-py-v0.12.2...hugr-py-v0.13.0rc1)
(2025-07-24)


### ⚠ BREAKING CHANGES

* Lowering functions in extension operations are now encoded as binary
envelopes. Older hugr versions will error out when trying to load them.
* **py:** `EnvelopeConfig::BINARY` now uses the model binary encoding.
`EnvelopeFormat.MODULE` is now `EnvelopeFormat.MODEL`.
`EnvelopeFormat.MODULE_WITH_EXTS` is now
`EnvelopeFormat.MODEL_WITH_EXTS`
* hugr-model: Symbol has an extra field
* Renamed the `Any` type bound to `Linear`
* The model CFG signature types were changed.
* Added `TypeParam`s and `TypeArg`s corresponding to floats and bytes.
* `TypeArg::Sequence` needs to be replaced with `TypeArg::List` or
`TypeArg::Tuple`
* FuncDefns must be moved to beneath Module.
`Container::define_function` is gone, use
`HugrBuilder::module_root_builder`; similarly in hugr-py
`DefinitionBuilder` (`define_function` ->
`module_root_builder().define_function`). In hugr-llvm, some uses of

### Features

* Add `BorrowArray` extension
([#2395](#2395))
([782687e](782687e))
* Add `MakeError` op ([#2377](#2377))
([909a794](909a794)),
closes [#1863](#1863)
* add toposort to HUGR-py
([#2367](#2367))
([34eed34](34eed34))
* Add Visibility to FuncDefn/FuncDecl.
([#2143](#2143))
([5bbe0cd](5bbe0cd))
* Added float and bytes literal to core and python bindings.
([#2289](#2289))
([e9c5e91](e9c5e91))
* **core, llvm:** add array unpack operations
([#2339](#2339))
([a1a70f1](a1a70f1)),
closes [#1947](#1947)
* Detect and fail on unrecognised envelope flags
([#2453](#2453))
([5e36770](5e36770))
* Export entrypoint metadata in Python and fix bug in import
([#2434](#2434))
([d17b245](d17b245))
* Expose `BorrowArray` in `hugr-py`
([#2425](#2425))
([fdb675f](fdb675f)),
closes [#2406](#2406)
* include generator metatada in model import and cli validate errors
([#2452](#2452))
([f7cedb4](f7cedb4))
* Names of private functions become `core.title` metadata.
([#2448](#2448))
([4bc7f65](4bc7f65))
* No nested FuncDefns (or AliasDefns)
([#2256](#2256))
([214b8df](214b8df))
* Non-region entrypoints in `hugr-model`.
([#2467](#2467))
([7b42da6](7b42da6))
* Open lists and tuples in `Term`
([#2360](#2360))
([292af80](292af80))
* **py:** enable Model as default BINARY envelope format
([#2317](#2317))
([f089931](f089931))
* **py:** Helper methods to get the neighbours of a node
([#2370](#2370))
([bb6fa50](bb6fa50))
* **py:** Use SumValue serialization for tuples
([#2466](#2466))
([f615037](f615037))
* Rename 'Any' type bound to 'Linear'
([#2421](#2421))
([c2f8b30](c2f8b30))
* Split `TypeArg::Sequence` into tuples and lists.
([#2140](#2140))
([cc4997f](cc4997f))
* Standarize the string formating of sum types and values
([#2432](#2432))
([ec207e7](ec207e7))
* Use binary envelopes for operation lower_func encoding
([#2447](#2447))
([2c16a77](2c16a77))


### Bug Fixes

* Ensure SumTypes have the same json encoding in -rs and -py
([#2465](#2465))
([7f97e6f](7f97e6f))
* Escape html-like labels in DotRenderer
([#2383](#2383))
([eaa7dfe](eaa7dfe))
* Export metadata in Python
([#2342](#2342))
([7be52db](7be52db))
* Fix model export of `Opaque` types.
([#2446](#2446))
([3943499](3943499))
* Fixed bug in python model export name mangling.
([#2323](#2323))
([041342f](041342f))
* Fixed bugs in model CFG handling and improved CFG signatures
([#2334](#2334))
([ccd2eb2](ccd2eb2))
* Fixed export of `Call` and `LoadConst` nodes in `hugr-py`.
([#2429](#2429))
([6a0e270](6a0e270))
* Fixed invalid extension name in test.
([#2319](#2319))
([c58ddbf](c58ddbf))
* Fixed two bugs in import/export of function operations
([#2324](#2324))
([1ad450f](1ad450f))
* map IntValue to unsigned repr when serializing
([#2413](#2413))
([26d426e](26d426e)),
closes [#2409](#2409)
* Order hints on input and output nodes.
([#2422](#2422))
([a31ccbc](a31ccbc))
* **py:** correct ConstString JSON encoding
([#2325](#2325))
([9649a48](9649a48))
* StaticArrayVal payload encoding, improve roundtrip checker
([#2444](#2444))
([1a301eb](1a301eb))
* stringify metadata before escaping in renderer
([#2405](#2405))
([8d67420](8d67420))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Release-As: 0.13.0rc1

---------

Co-authored-by: Agustín Borgna <agustin.borgna@quantinuum.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants