Skip to content

fix: assorted small fixes (patchset lookup, logpdf error logging, typos)#2709

Open
henryiii wants to merge 1 commit into
mainfrom
fix/misc-review-fixes
Open

fix: assorted small fixes (patchset lookup, logpdf error logging, typos)#2709
henryiii wants to merge 1 commit into
mainfrom
fix/misc-review-fixes

Conversation

@henryiii

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Part of the code review in #2706.

Summary

  • patchset.py: Remove vestigial {"name": {}, "values": {}} sentinel keys from _patches_by_key, which caused two bugs: a patch named "name" or "values" falsely triggered the duplicate-patch error, and patchset["name"] returned {} instead of raising InvalidPatchLookup. Now initialized to {}.
  • pdf.py (Model.logpdf): Fix the except handler to use %r directly on data/pars instead of calling tensorlib.tolist(), which can itself raise (e.g. on ragged input) and mask the original exception.
  • pdf.py: Rename two typo local variables: finalizd_builder_datafinalized_builder_data and _prameter_objects_parameter_objects.
  • infer/test_statistics.py: Fix _qmu_like docstring: condition is muhat > mu, not muhat > 0.

Test plan

  • pytest tests/test_patchset.py tests/test_pdf.py tests/test_teststats.py -q — 105 passed, 6 skipped (backend-skip markers)
  • New parametrized test test_patchset_sentinel_keys_raise verifies that patchset["name"] and patchset["values"] raise InvalidPatchLookup
  • prek -a --quiet — clean

🤖 Generated with Claude Code

- patchset.py: remove vestigial sentinel keys from _patches_by_key so
  that looking up "name" or "values" correctly raises InvalidPatchLookup
  instead of returning {} or falsely triggering duplicate-patch errors
- pdf.py: fix logpdf except handler to log data/pars with %r instead of
  calling tensorlib.tolist(), which can itself raise and mask the original
  exception
- pdf.py: rename typo variables finalizd_builder_data → finalized_builder_data
  and _prameter_objects → _parameter_objects
- infer/test_statistics.py: fix _qmu_like docstring: "muhat > mu" not "muhat > 0"

Assisted-by: ClaudeCode:claude-sonnet-4.6
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@henryiii, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fa6af7d0-1531-403e-931f-922e123e3ddd

📥 Commits

Reviewing files that changed from the base of the PR and between 0e54a51 and 6d4e17f.

📒 Files selected for processing (4)
  • src/pyhf/infer/test_statistics.py
  • src/pyhf/patchset.py
  • src/pyhf/pdf.py
  • tests/test_patchset.py

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 and usage tips.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (0e54a51) to head (6d4e17f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2709      +/-   ##
==========================================
- Coverage   98.28%   96.42%   -1.86%     
==========================================
  Files          65       65              
  Lines        4305     4305              
  Branches      465      465              
==========================================
- Hits         4231     4151      -80     
- Misses         46      120      +74     
- Partials       28       34       +6     
Flag Coverage Δ
contrib ?
doctest ?
unittests-3.10 ?
unittests-3.11 96.42% <100.00%> (-0.05%) ⬇️
unittests-3.12 ?
unittests-3.13 96.42% <100.00%> (-0.05%) ⬇️
unittests-3.9 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@henryiii henryiii marked this pull request as ready for review June 12, 2026 17:56
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.

1 participant