Skip to content

Conversation

@JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Jan 12, 2026

NOTE: remember to revert the fast fail option after fixing everything Done

Shortly after release we should start investigating the new rng_salt along with the stochastic failures it would reveal and fix things up if necessary

[sc-107811]

@JerryChen97 JerryChen97 self-assigned this Jan 12, 2026
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@JerryChen97
Copy link
Contributor Author

This time, there are only 7 different stochastic failures

### Before submitting

Please complete the following checklist when submitting a PR:

- [ ] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      test directory!

- [ ] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [ ] Ensure that the test suite passes, by running `make test`.

- [ ] Add a new entry to the `doc/releases/changelog-dev.md` file,
summarizing the
      change, and including a link back to the PR.

- [ ] The PennyLane source code conforms to
      [PEP8 standards](https://www.python.org/dev/peps/pep-0008/).
We check all of our code against [Pylint](https://www.pylint.org/).
      To lint modified files, simply `pip install pylint`, and then
      run `pylint pennylane/path/to/file.py`.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Context:**

**Description of the Change:**

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
…_sqeuence` with torch (#8937)

First observed in the rng salt update of 0.45

A local run reveals that there's around 5% chance to fail this
stochastic test (50 out of 1000):
```
Tests failed for seeds: [np.int64(6), np.int64(22), np.int64(33), np.int64(46), np.int64(96), np.int64(130), np.int64(137), np.int64(180), np.int64(230), np.int64(243), np.int64(256), np.int64(263), np.int64(264), np.int64(266), np.int64(281), np.int64(328), np.int64(392), np.int64(408), np.int64(429), np.int64(432), np.int64(456), np.int64(470), np.int64(475), np.int64(510), np.int64(522), np.int64(540), np.int64(550), np.int64(554), np.int64(578), np.int64(614), np.int64(623), np.int64(649), np.int64(658), np.int64(712), np.int64(724), np.int64(757), np.int64(768), np.int64(790), np.int64(795), np.int64(801), np.int64(812), np.int64(840), np.int64(864), np.int64(872), np.int64(881), np.int64(908), np.int64(925), np.int64(942), np.int64(972), np.int64(974)]
Number of failed tests: 50
```
which is at the marginal rate for us to further investigate it deeper.
Hence I suggest we just salt it and leave note

[sc-107856]
Comment on lines +1589 to +1591
# Use 4-sigma tolerance to prevent flaky tests
# We use atol (absolute) because noise does not scale with the expectation value
assert np.allclose(res, expected, atol=3 * std_error)
assert np.allclose(res, expected, atol=4 * std_error)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My local testify turns out the std is basically OK, and indeed below 1% chance to fail. Seems like this test is extremely unlucky (could suffer from very usual actual distribution or something). Therefore bump to 4-sigma for a ~0.01% chance to fail

Copy link
Contributor

@astralcai astralcai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we also removed local_salt from the tests that don't need it to pass anymore?

@JerryChen97
Copy link
Contributor Author

Have we also removed local_salt from the tests that don't need it to pass anymore?

That's a good point. Let me scan it.

@JerryChen97
Copy link
Contributor Author

Have we also removed local_salt from the tests that don't need it to pass anymore?

A salt on qdrift test has been removed. Another salt from midmeasure will be removed by the other PR maintaining that file specifically.
The remaining salts are kinda backlogged test audit stories to do... 😓

@JerryChen97 JerryChen97 requested a review from astralcai January 23, 2026 17:53
@JerryChen97 JerryChen97 enabled auto-merge January 23, 2026 20:37
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.44%. Comparing base (803cbcd) to head (c9fa6c7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8908   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files         601      601           
  Lines       64762    64762           
=======================================
  Hits        64401    64401           
  Misses        361      361           

☔ 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.

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.

3 participants