Update graphqomb compatibility#115
Conversation
Code Review: Update graphqomb compatibilityOverviewThis PR adapts Correctness ✅The approach is sound. Using for node in TopologicalSorter(predecessors).static_order():
...
for predecessor in predecessors[node]:
predecessor_time = scheduler.measure_time[predecessor]
if predecessor_time is not None and predecessor_time >= min_measure_time:
min_measure_time = predecessor_time + 1The logic computes Issues & SuggestionsMinor: Misleading variable name
# Before
min_measure_time = measure_time
...
scheduler.measure_time[node] = min_measure_time
# After
earliest_allowed = measure_time
...
scheduler.measure_time[node] = earliest_allowedMinor: Test placement The new unit test Suggestion: Add a cascading-delay test The current test covers a 2-node chain (A→B at same time). A 3-node chain (A→B→C all at time 1, expected to become 1, 2, 3) would verify that topological ordering propagates cascading bumps correctly: def test_delay_measurements_cascades() -> None:
# A -> B -> C all at time=1; expected: A=1, B=2, C=3
...This is especially worth having since the topological-sort propagation is the key insight of the fix. Observation:
API Migration ✅The three API adaptations look correct:
Test Coverage ✅
SummaryThe implementation is correct and the PR description clearly explains the root cause. The main actionable items are:
Otherwise this is a clean, focused migration. No security or performance concerns. |
Code Review — Update graphqomb compatibilityOverviewThis PR adapts The change is well-scoped and the overall approach is sound. A few points worth discussing below.
|
| Case | Status |
|---|---|
| Linear conflict (input→middle at same time) | ✅ covered |
| Already-valid schedule — function should be a no-op | ❌ not tested |
| Multi-predecessor convergence (two sources conflict with one target) | ❌ not tested |
| Chain of length > 2 (cascading bumps) | ❌ not tested |
The already-valid / idempotency case is particularly worth adding since it guards against the fix accidentally advancing times that did not need adjustment.
Private function import: The test imports _delay_measurements_for_flow by name. This is acceptable for internal unit testing but ties the test to the current module layout. If the function is later inlined or renamed, the test will break loudly rather than silently — which is actually fine here.
requirements-dev.txt — ruff pin
-ruff
+ruff==0.15.13Pinning a linting tool is a semantic change: it trades reproducibility for upgrade friction. A few questions:
- Is the pin intentional (CI reproducibility) or incidental (the version that happened to be installed locally)?
- Is
0.15.13the version that was tested against in the validation steps listed in the PR body? - If pinning is intentional, it is more conventional to manage tool versions via
uv.lockor a[tool.uv]override inpyproject.tomlrather than hardcoding inrequirements-dev.txt, so thatuv syncstays the single source of truth.
Summary
| Area | Assessment |
|---|---|
| Correctness | ✅ The flow-causality fix is algorithmically correct |
| API migration | ✅ Clean 1-to-1 mapping of the graphqomb 0.3.x API |
| Test coverage | |
| Code clarity | min_measure_time naming and the loop pattern could be clearer |
| Dependency management | ruff pin should be intentional and justified |
Happy to approve once the test gaps and the ruff pin rationale are addressed (or acknowledged as intentional).
There was a problem hiding this comment.
Pull request overview
This pull request updates ls-pattern-compile to be compatible with graphqomb>=0.3.1 by adjusting compilation to the newer qompile() logical-observable API and the updated stim_compile() noise model interface, while also proactively fixing manual scheduler causality issues that graphqomb now validates earlier.
Changes:
- Bump
graphqombminimum version to0.3.1and adapt compilation to updatedqompile()/stim_compile()APIs. - Add a scheduler pre-validation adjustment step that delays flow-dependent measurements to satisfy DAG causality.
- Pin the CI Ruff version via
requirements-dev.txtand add a regression test covering the causality delay behavior.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lspattern/compiler.py |
Updates compilation pipeline for graphqomb 0.3.x (scheduler validation, logical observables via qompile, noise via noise_models). |
tests/test_graph_block_yaml.py |
Adds a regression test ensuring equal-time flow dependencies are split by delaying measurements. |
requirements.txt |
Raises graphqomb dependency floor to >=0.3.1. |
requirements-dev.txt |
Pins ruff so CI uses a known-good version referenced by the workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
compile_canvas_to_stim()to graphqomb's noise model and logical observable APIsruff-actionuses the locally validated version instead of latestRoot Cause
Graphqomb 0.3.x removed legacy
stim_compile()noise arguments, moved logical observable handling intoqompile(), and now validates manually provided schedulers before pattern generation. Existing ls-pattern schedules could contain flow-dependent measurements in the same time slice, which graphqomb now rejects.The ruff workflow also passed
requirements-dev.txtas a version source, but the file did not contain a parseable ruff version. GitHub Actions therefore installed latest ruff, which introduced failures unrelated to this change.Validation
uv run --no-sync pytestuv run --no-sync mypyuv run --no-sync pyrightuv run --no-sync ruff check ./lspattern ./tests ./examplesuv run --no-sync ruff format --check --diffPYTHONPATH=/home/masa10/git-repos/utftbmqc/graphqomb .venv/bin/python -m pytest -q