Implement tech-debt-backlog items 1.1 and 2.1 (parser rename + CUDA-Q invariant) - #23
Merged
Conversation
- Rename `_has_trailing_mutation` in `q_orca/parser/markdown_parser.py` to `_contains_mutation_segment`. The regex is anchored at segment starts (string start or after `;`), so the old name was misleading — it wasn't about trailing position, just about detecting a mutation op in any non-initial segment of a mixed effect string. - Harden CUDA-Q backend severity/valid consistency in `q_orca/backends/cudaq_backend.py::CudaQBackend.verify`. It used to mutate `result.errors` via `insert(0, ...)` without re-deriving `valid`. The inserted error is a warning today so the invariant (valid iff no error-level entries) held, but the pattern was fragile. Now we build a new `QVerificationResult` from the merged error list with `valid` recomputed. Added `test_severity_valid_invariant_holds` as a regression test. Co-Authored-By: Claude Opus 4.7 <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
Picks up two Hermes QA items filed against PR #21 in the
tech-debt-backlogOpenSpec change._has_trailing_mutation: misleading name. Theregex matches any mutation op at the start of a
;-separatedsegment, not specifically trailing. Renamed to
_contains_mutation_segmentwith an updated docstring thatdocuments the segment-boundary anchor.
mutation site was
CudaQBackend.verifycallingresult.errors.insert(0, warning)without re-derivingvalid.The invariant (
validiff no error-level entries) held todaybecause the inserted entry was a warning, but the pattern was
fragile. Switched to building a fresh
QVerificationResultfromthe merged error list. Added
test_severity_valid_invariant_holdsas a regression test.Both tasks in
openspec/changes/tech-debt-backlog/tasks.mdarenow checked with audit notes inline per the file's meta rule
(leave completed items in place — the archived copy is our
record).
Test plan
.venv/bin/python -m pytest tests/test_backends.py tests/test_context_updates.py tests/test_parser.py -q— 126 passed, 6 skipped.venv/bin/python -m pytest tests/ -q --ignore=tests/test_cuquantum_backend.py --ignore=tests/test_cudaq_backend.py— 468 passed, 6 skipped_has_trailing_mutation— only the (now-checked) backlog task text remains🤖 Generated with Claude Code