Skip to content

improve workflow stability - #22

Merged
ConnorStoneAstro merged 8 commits into
mainfrom
betterchunk
Sep 15, 2026
Merged

ConnorStoneAstro merged 8 commits into
mainfrom
betterchunk

Conversation

@ConnorStoneAstro

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings September 15, 2026 15:22
@codecov-commenter

codecov-commenter commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.51485% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.38%. Comparing base (73f46f8) to head (9094887).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pted/utils.py 98.39% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
+ Coverage   96.84%   98.38%   +1.54%     
==========================================
  Files           4        4              
  Lines         317      621     +304     
==========================================
+ Hits          307      611     +304     
  Misses         10       10              

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

@ConnorStoneAstro
ConnorStoneAstro merged commit 54999ff into main Sep 15, 2026
13 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical and moderate findings affect statistical correctness, JAX backend behavior, and public API compatibility.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request improves workflow stability by reworking PTED around batched permutation testing, containment diagnostics, backend support, and CI stabilization.

Changes:

  • Adds landmark allocation, batching, reproducible RNG, and subgroup enumeration.
  • Adds directional containment tests and lattice-aware PIT bands.
  • Expands tests and documentation while stabilizing plotting and optional Torch CI.
File summaries
File Reviewed changes and final findings
tests/test_utils.py Tests utility, batching, PIT, and enumeration behavior.
tests/test_pted.py Tests public APIs, backends, calibration, and containment.
tests/conftest.py Configures headless plotting.
src/pted/utils.py Core implementation. Critical (3 votes): diagnostic curves omit tied y-points at lines 822/899. Critical (1 vote): JAX seed exceeds the uint32 PRNGKey range at line 461. Moderate (1 vote): lattice subsampling can invalidate exact band coverage at line 1217. Moderate (1 vote): exported utility names and chunk_size compatibility were removed at line 95.
src/pted/tests.py Stabilizes package smoke tests.
src/pted/pted.py Public PTED and containment APIs. Moderate (2 votes): chunk_size and pted_chunk compatibility was removed without an alias or deprecation path at line 25.
src/pted/__init__.py Exports containment testing.
README.md Documents updated APIs and methods.
pyproject.toml Separates optional Torch dependencies.
.github/workflows/ci.yml Updates CI matrix and plotting stability configuration.
Review details

Suppressed comments (3)

src/pted/utils.py:902

  • This cumulative count only includes y points that sort before the x point. For equal depths, however, the p-value definition uses >=, so all tied y points must count; when all pooled points coincide, an x point can be assigned 1/(n_y + 1) and the valid identical-distribution null can be rejected. Please make the rank/count tie-inclusive here and keep the plot helper consistent.
    order = (-depth).argsort(0)
    ranked_x = _take_along0(Xs.T, order, backend)
    ranked_y = _take_along0((1.0 - Xs).T, order, backend)
    p = (1.0 + ranked_y.cumsum(0)) / (prep["n_y"] + 1.0)

src/pted/utils.py:99

  • This removes the previously exported pted and pted_chunk utility entry points, while the public wrappers also drop the chunk_size keyword. Existing callers importing these names or passing that keyword will now fail without a compatibility or deprecation path. Please retain forwarding aliases/keyword compatibility, or explicitly version and document this breaking API change.
__all__ = (
    "is_torch_tensor",
    "is_jax_array",
    "permutation_energy_test",
    "PermutationResolutionWarning",

src/pted/utils.py:1221

  • When lattice > max_points (for example, 1001 points from the default 1000 permutations), this keeps only 512 evaluation points, but _band_accept_probability calibrates coverage only at those selected points. The ECDF can jump at an omitted lattice value and leave the displayed band before returning inside at the next selected point, so the claimed simultaneous confidence and achieved level are not guaranteed. Calibrate over every attainable point, or construct a conservative envelope that covers the omitted points before reporting this as exact.
        k = (
            np.arange(1, lattice + 1)
            if lattice <= max_points
            else np.unique(np.round(np.linspace(1, lattice, max_points)).astype(int))
        )
  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/pted/utils.py
return U

elif backend == "jax":
key = jax.random.PRNGKey(int(rng.integers(0, 2**62)))
Comment thread src/pted/utils.py
Comment on lines +822 to +829
order = (-depth).argsort(0)
ranked_x = _to_numpy(_take_along0(Xs.T, order, backend), backend)
ranked_y = _to_numpy(_take_along0((1.0 - Xs).T, order, backend), backend)

n_y, rows = int(prep["n_y"]), ranked_x.shape[1]
# y points at least as peripheral as each ranked point; this is the count
# that turns into p = (1 + count) / (n_y + 1).
above = ranked_y.cumsum(0).astype(np.int64)
Comment thread src/pted/pted.py
permutations: int = 1000,
return_all: bool = False,
chunk_size: Optional[int] = None,
n_landmarks: Optional[int] = None,
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