Skip to content

fix(determinism): use BTreeMap in ModuleGraph#2783

Merged
acl-cqc merged 1 commit intomainfrom
acl/btree_modgraph
Dec 30, 2025
Merged

fix(determinism): use BTreeMap in ModuleGraph#2783
acl-cqc merged 1 commit intomainfrom
acl/btree_modgraph

Conversation

@acl-cqc
Copy link
Copy Markdown
Contributor

@acl-cqc acl-cqc commented Dec 30, 2025

I think this fixes the nondeterminism observed in tket2#1325. (I updated tket2/Cargo.toml to use this branch, then ran uv clean && uv pip install --reinstall tket selene-hugr-qis-compiler && uv sync and that changed tests from failing to passing).

Not sure I completely understand the mechanism - this appears to change only the order in which we add (all the outgoing edges from a node) for each node (not the order of outgoing edges for each), which AFAICS should have no effect. But....let's try....

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.69%. Comparing base (cd371ba) to head (8d5fe2f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2783   +/-   ##
=======================================
  Coverage   83.69%   83.69%           
=======================================
  Files         261      261           
  Lines       52551    52551           
  Branches    47307    47307           
=======================================
  Hits        43981    43981           
  Misses       6183     6183           
  Partials     2387     2387           
Flag Coverage Δ
python 88.82% <ø> (ø)
rust 83.12% <100.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.

@acl-cqc acl-cqc marked this pull request as ready for review December 30, 2025 18:07
@acl-cqc acl-cqc requested a review from a team as a code owner December 30, 2025 18:07
@acl-cqc acl-cqc requested a review from aborgna-q December 30, 2025 18:07
@acl-cqc acl-cqc changed the title fix: use BTreeMap in ModuleGraph fix(determinism): use BTreeMap in ModuleGraph Dec 30, 2025
@acl-cqc acl-cqc enabled auto-merge December 30, 2025 19:14
@acl-cqc acl-cqc added this pull request to the merge queue Dec 30, 2025
@acl-cqc acl-cqc removed this pull request from the merge queue due to a manual request Dec 30, 2025
@acl-cqc acl-cqc added this pull request to the merge queue Dec 30, 2025
Merged via the queue into main with commit 879a121 Dec 30, 2025
32 checks passed
@acl-cqc acl-cqc deleted the acl/btree_modgraph branch December 30, 2025 19:19
@hugrbot hugrbot mentioned this pull request Dec 30, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 30, 2025
## 🤖 New release

* `hugr-model`: 0.25.1 -> 0.25.2
* `hugr-core`: 0.25.1 -> 0.25.2 (✓ API compatible changes)
* `hugr-llvm`: 0.25.1 -> 0.25.2
* `hugr-passes`: 0.25.1 -> 0.25.2
* `hugr`: 0.25.1 -> 0.25.2 (✓ API compatible changes)
* `hugr-cli`: 0.25.1 -> 0.25.2
* `hugr-persistent`: 0.4.1 -> 0.4.2

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

## `hugr-model`

<blockquote>

##
[0.25.0](hugr-model-v0.24.3...hugr-model-v0.25.0)
- 2025-12-22

### Bug Fixes

- *(model)* avoid non abi-compatible pyo3 calls
([#2679](#2679))

### New Features

- [**breaking**] Upgrade pyo3 dependency to 0.27
([#2736](#2736))

### Refactor

- Direct import of model representation to Python
([#2683](#2683))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.25.2](hugr-core-v0.25.1...hugr-core-v0.25.2)
- 2025-12-30

### Bug Fixes

- *(determinism)* use BTreeMap in ModuleGraph
([#2783](#2783))

### New Features

- Re-export hugr_core::hugr::linking from hugr::
([#2781](#2781))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.25.0](hugr-llvm-v0.24.3...hugr-llvm-v0.25.0)
- 2025-12-22

### New Features

- *(llvm)* [**breaking**] upgrade to inkwell 0.7
([#2695](#2695))

### Refactor

- Deprecate Value::Function and inline_constant_functions
([#2770](#2770))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.25.1](hugr-passes-v0.25.0...hugr-passes-v0.25.1)
- 2025-12-29

### Bug Fixes

- two problems in array linearization from #2749
([#2779](#2779))
</blockquote>

## `hugr`

<blockquote>

##
[0.25.2](hugr-v0.25.1...hugr-v0.25.2)
- 2025-12-30

### Bug Fixes

- *(determinism)* use BTreeMap in ModuleGraph
([#2783](#2783))

### New Features

- Re-export hugr_core::hugr::linking from hugr::
([#2781](#2781))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.25.0](hugr-cli-v0.24.3...hugr-cli-v0.25.0)
- 2025-12-22

### New Features

- *(cli, python)* programmatic interface to cli with python bindings
([#2677](#2677))
- return description output to python on error
([#2681](#2681))
- [**breaking**] Type-safe access for node metadata
([#2755](#2755))
- [**breaking**] GeneratorDesc metadata definition
([#2759](#2759))

### Refactor

- [**breaking**] move envelope reading to dedicated module with
dedicated errors ([#2689](#2689))
- *(cli)* [**breaking**] remove deprecated hugr_json handling
([#2690](#2690))
- [**breaking**] Remove multiple deprecated definitions
([#2751](#2751))
</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 Jan 6, 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