Skip to content

fix: used_extensions should include transitive requirements#2891

Merged
aborgna-q merged 2 commits intomainfrom
ab/transitive-used-extensions
Feb 20, 2026
Merged

fix: used_extensions should include transitive requirements#2891
aborgna-q merged 2 commits intomainfrom
ab/transitive-used-extensions

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

When gathering the extensions required to define a Hugr, we only included the ones that were directly referenced by the Hugr definition (inside types or operations).

To correctly load a Hugr, however, we also need to have access to any extension referenced by the extension definitions themselves (in the signature of their operation definitions). Otherwise we wouldn't be able to load the bundled extensions, as we saw happen with guppy programs after Quantinuum/guppylang#1449 got merged.

This equally affected the rust and python computation of used extensions.

@aborgna-q aborgna-q requested a review from a team as a code owner February 19, 2026 19:07
@aborgna-q aborgna-q force-pushed the ab/transitive-used-extensions branch from b6152d6 to b03c3e1 Compare February 19, 2026 19:12
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 79.10448% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.80%. Comparing base (25c625d) to head (b03c3e1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-core/src/extension/resolution/extension.rs 75.00% 6 Missing and 2 partials ⚠️
hugr-py/src/hugr/ext.py 90.47% 2 Missing ⚠️
hugr-core/src/extension/op_def.rs 88.88% 0 Missing and 1 partial ⚠️
hugr-core/src/extension/resolution/test.rs 0.00% 1 Missing ⚠️
hugr-core/src/hugr.rs 0.00% 0 Missing and 1 partial ⚠️
hugr-core/src/ops.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2891      +/-   ##
==========================================
- Coverage   83.81%   83.80%   -0.01%     
==========================================
  Files         267      267              
  Lines       53660    53728      +68     
  Branches    47748    47793      +45     
==========================================
+ Hits        44975    45029      +54     
- Misses       6275     6284       +9     
- Partials     2410     2415       +5     
Flag Coverage Δ
python 88.50% <91.30%> (+0.01%) ⬆️
rust 83.22% <72.72%> (-0.01%) ⬇️

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.

Copy link
Copy Markdown
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

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

Should we also be checking the types (as well as the operations) defined by the dependent extensions, for any extensions they depend on? E.g. what if a type is parametrized by a type belonging to another extension?

@maximilianruesch maximilianruesch removed their request for review February 20, 2026 09:49
@aborgna-q
Copy link
Copy Markdown
Collaborator Author

I though about that, but the types definitions are only declaring TypeParams, which shouldn't have references to other types/ops. (We do need to look at arguments when collecting extensions for instantiated types).

Although with the unification of terms I'm not sure if things have changed?

Copy link
Copy Markdown
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

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

LGTM

@aborgna-q aborgna-q added this pull request to the merge queue Feb 20, 2026
Merged via the queue into main with commit 18e78e4 Feb 20, 2026
48 checks passed
@aborgna-q aborgna-q deleted the ab/transitive-used-extensions branch February 20, 2026 13:32
This was referenced Feb 20, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.15.4](hugr-py-v0.15.3...hugr-py-v0.15.4)
(2026-02-20)


### Features

* **hugr-py:** Define typed Metadata protocol
([#2765](#2765))
([4390230](4390230))


### Bug Fixes

* Add truncation options for node and edge labels in rendering
([#2885](#2885))
([25c625d](25c625d))
* used_extensions should include transitive requirements
([#2891](#2891))
([18e78e4](18e78e4))

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

---------

Co-authored-by: Agustín Borgna <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 20, 2026
## 🤖 New release

* `hugr-model`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr-core`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr-llvm`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr-passes`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr-cli`: 0.25.5 -> 0.25.6 (✓ API compatible changes)
* `hugr-persistent`: 0.4.5 -> 0.4.6

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-model`

<blockquote>

##
[0.25.6](hugr-model-v0.25.5...hugr-model-v0.25.6)
- 2026-02-20

### New Features

- Remove size limitation for binary envelopes
([#2880](#2880))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.25.6](hugr-core-v0.25.5...hugr-core-v0.25.6)
- 2026-02-20

### Bug Fixes

- Canonicalize more
([#2839](#2839))
- used_extensions should include transitive requirements
([#2891](#2891))

### New Features

- Add s expression format to envelope formats
([#2864](#2864))
- added hash.rs, updated imports
([#2840](#2840))
- *(hugr-py)* Define typed Metadata protocol
([#2765](#2765))
- Add a `NodeTemplate::call_to_function` helper
([#2878](#2878))
- Remove size limitation for binary envelopes
([#2880](#2880))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.25.6](hugr-llvm-v0.25.5...hugr-llvm-v0.25.6)
- 2026-02-20

### New Features

- Add error context when lowering hugrs to LLVM
([#2869](#2869))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.25.6](hugr-passes-v0.25.5...hugr-passes-v0.25.6)
- 2026-02-20

### Bug Fixes

- Panic on UntuplePass when nodes had order edges
([#2883](#2883))

### New Features

- added hash.rs, updated imports
([#2840](#2840))
- Add a `NodeTemplate::call_to_function` helper
([#2878](#2878))
</blockquote>

## `hugr`

<blockquote>

##
[0.25.6](hugr-v0.25.5...hugr-v0.25.6)
- 2026-02-20

### Bug Fixes

- Panic on UntuplePass when nodes had order edges
([#2883](#2883))
- Canonicalize more
([#2839](#2839))
- used_extensions should include transitive requirements
([#2891](#2891))

### New Features

- Add s expression format to envelope formats
([#2864](#2864))
- *(hugr-py)* Define typed Metadata protocol
([#2765](#2765))
- Add a `NodeTemplate::call_to_function` helper
([#2878](#2878))
- added hash.rs, updated imports
([#2840](#2840))
- Remove size limitation for binary envelopes
([#2880](#2880))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.25.6](hugr-cli-v0.25.5...hugr-cli-v0.25.6)
- 2026-02-20

### New Features

- Add s expression format to envelope formats
([#2864](#2864))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.4.0](hugr-persistent-v0.3.4...hugr-persistent-v0.4.0)
- 2025-12-22

### New Features

- [**breaking**] Remove `RootCheckable`
([#2704](#2704))
- [**breaking**] Bump MSRV to Rust 1.89
([#2747](#2747))
- [**breaking**] Type-safe access for node metadata
([#2755](#2755))

### Refactor

- [**breaking**] Remove multiple deprecated definitions
([#2751](#2751))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
@hugrbot hugrbot mentioned this pull request Feb 27, 2026
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.

2 participants