Skip to content

Keep pyqasm validate diagnostics on one line - #405

Merged
TheGupta2012 merged 1 commit into
mainfrom
bugfix-cli-validate-path-wrapping
Aug 24, 2026
Merged

Keep pyqasm validate diagnostics on one line#405
TheGupta2012 merged 1 commit into
mainfrom
bugfix-cli-validate-path-wrapping

Conversation

@TheGupta2012

@TheGupta2012 TheGupta2012 commented Aug 24, 2026

Copy link
Copy Markdown
Member

Problem

pyqasm validate builds its output with a default rich.Console, which wraps at the detected console width (80 when stdout is not a tty). A file path longer than that is broken mid-token across lines:

/private/tmp/.../3eba83a3-89e
0-4a99-a5cf-386bf6fb273b/scratchpad/...: error: ...

The reported path is then neither copyable nor clickable in a terminal.

The same wrapping breaks two CLI tests, which assert the absolute path appears in the output:

  • tests/cli/test_cli_commands.py::test_validate_qasm_with_invalid_file
  • tests/cli/test_cli_commands.py::test_validate_command_with_invalid_file

They pass in CI only because the runner checks out to a short path (/home/runner/work/pyqasm/pyqasm). They fail for any contributor whose clone sits at a longer path, which is why they showed up as "pre-existing failures" while reviewing #402, #403 and #404.

Fix

The error console now uses soft_wrap=True, which disables wrapping and cropping while leaving markup intact — one diagnostic per line, path unbroken.

Verification

tests/cli at a short path and at a path long enough to trigger the old wrap:

before after
short path 33 passed 33 passed
long path 2 failed, 31 passed 33 passed

Full suite at the long path: 802 passed, 3 skipped. pylint 10.00/10, black and isort clean.

Summary by CodeRabbit

  • Bug Fixes
    • Improved pyqasm validate diagnostics so long file paths remain intact instead of splitting across terminal lines.
  • Documentation
    • Added an unreleased changelog entry describing the validation output improvement.

Rich wraps console output at the detected width (80 when stdout is not a
tty). A file path longer than that was broken mid-token across lines, so
the reported path was neither copyable nor clickable, and the two CLI
tests asserting the absolute path failed whenever the repository sat at a
long enough filesystem path.

The error console now uses soft_wrap, which disables wrapping and
cropping while leaving markup intact.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@argus-eye

argus-eye Bot commented Aug 24, 2026

Copy link
Copy Markdown

Argus review

Auto-review is off for this repo. Tick the box below to run a review on this PR.

  • Trigger Argus review

Estimated cost

  • Files changed: 2
  • Diff lines (±): 6
  • Historical avg: ~243.6k tokens · ~$0.95 · across last 10 review(s)

Tip: you can also comment @argus-eye review at any time.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 31fb758f-de57-44b9-b166-07241894be55

📥 Commits

Reviewing files that changed from the base of the PR and between a69bfcd and 377bcaa.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/pyqasm/cli/validate.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

pyqasm validate now uses Rich soft wrapping so diagnostic lines preserve long file paths. The changelog documents this behavior.

Changes

Validation diagnostics

Layer / File(s) Summary
Configure and document diagnostic wrapping
src/pyqasm/cli/validate.py, CHANGELOG.md
The validation console enables soft_wrap=True. The changelog records that diagnostics remain on one line and preserve long file paths.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 377bc

This change keeps validation diagnostics, including long file paths, on a single line without affecting the reported error content; the supplied verification shows the targeted tests and full suite pass, so no actionable merge-blocking risk remains.

Suggested reviewers: ryanhill1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change to keep pyqasm validate diagnostics on one line.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix-cli-validate-path-wrapping

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TheGupta2012

Copy link
Copy Markdown
Member Author

Merging as the coderabbit review has come through without changes

@TheGupta2012
TheGupta2012 merged commit 9d278a0 into main Aug 24, 2026
29 checks passed
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