Skip to content

Reliable release - #25

Merged
lappalainenj merged 2 commits into
mainfrom
reliable-release
Aug 6, 2026
Merged

Reliable release#25
lappalainenj merged 2 commits into
mainfrom
reliable-release

Conversation

@lappalainenj

Copy link
Copy Markdown
Contributor

No description provided.

lappalainenj and others added 2 commits August 5, 2026 22:55
Five tests failed sporadically, together on roughly one run in four. All of
them share one cause: they assert on unseeded randomness. The augmentations
draw from the global numpy stream, the mock Sintel data is generated fresh
every run, and several assertions only hold for most draws rather than all of
them. In CI a sporadic failure is indistinguishable from a real regression.

Seed the global generators before every test, and seed the session-scoped mock
data fixtures with their own generator, since those are built before the
per-test fixture runs. FLYVIS_TEST_SEED re-runs the suite under a different
seed; an assertion that only holds for the default seed is a broken assertion,
and sweeping the seed is how to find one.

Seeding alone only makes a wrong assertion fail reproducibly, so fix the five
assertions that were true by luck:

- test_sintel::test_getitem (8.1%) and test_sintel::test_apply_augmentation
  (10%) asserted that augmentation changes the target. Targets are only
  rotated, flipped and cropped -- they are neither jittered nor noised -- so a
  sampled augmentation leaves them untouched whenever it draws neither a
  rotation nor a flip: (1-p_rot)*(1-p_flip) = 1/12. Request a rotation
  explicitly instead of asserting on the draw.
- test_ensemble::test_rank_by_validation_error (4.2%) shuffled the model names
  and asserted the order changed. A shuffle reproduces the sorted order once in
  len(ensemble)! draws, 1 in 24 here. Rotate instead, which is a derangement.
- test_rendering::test_call (2.3%) compared the mean of a median-filtered
  uniform sample against 5 with atol=0.05, about 2.4 sigma of that statistic.
  Widen to ~7 sigma and say why; a seeded draw also differs between CPU and
  GPU, so a tight tolerance would pass locally and fail in CI.
- test_augmentation::test_random_crop (~0.1%) asserted a random crop differs
  from the crop at frame 0, which fails when the sampled start is 0. Assert
  that the sampled start is the one applied, which is exact and stronger.

Found and verified by sweeping the seed rather than repeating runs: repeating
the suite 15 times missed two of these, while sweeping 40 seeds found both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Releasing is fully manual today: build locally, then twine upload. Automate it
so that a release is a tag plus a GitHub Release and nothing else.

Every push to main builds the sdist and the wheel and checks them, so a
packaging mistake surfaces at merge time. Nothing is uploaded on a merge --
PyPI versions are immutable and cannot be reused, so publishing is tied to a
version tag rather than to every commit that lands on main.

Before uploading, the workflow refuses to continue if the version derived by
setuptools_scm does not match the release tag, if twine check fails, or if
flyvis/data/responses_norm.h5 is missing from either distribution. That last
check matters because the constants are loaded from inside the installed
package: a wheel without them would silently fall back to simulating 30
minutes of naturalistic stimuli per model. It then installs the wheel in a
clean virtualenv and reads the constants back before publishing.

Uploads use PyPI trusted publishing, so no API token is stored in the
repository. The one-time PyPI-side setup is documented in docs/release.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lappalainenj
lappalainenj merged commit daea8e6 into main Aug 6, 2026
4 checks passed
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.68%. Comparing base (6fde329) to head (c1fe74a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #25   +/-   ##
=======================================
  Coverage   38.68%   38.68%           
=======================================
  Files          75       75           
  Lines        9738     9738           
=======================================
  Hits         3767     3767           
  Misses       5971     5971           
Flag Coverage Δ
unittests 38.68% <ø> (ø)

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.

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