Skip to content

Add regression tests for hooks, schedulers, and shared utilities#26

Draft
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/regression-test-coverage-622f
Draft

Add regression tests for hooks, schedulers, and shared utilities#26
cursor[bot] wants to merge 4 commits into
mainfrom
cursor/regression-test-coverage-622f

Conversation

@cursor

@cursor cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown

What does this PR do?

Adds fast, deterministic regression tests for high-blast-radius code paths that previously had weak or no direct unit coverage.

Also fixes utils/check_copies.py so copy consistency checks stylify both observed and theoretical blocks before comparing (avoids false drift when only one side was ruff-formatted).

Risky behavior now covered

  • FirstBlockCache skip logic — threshold-based tail-block skipping, tuple (Flux-style) outputs, and recomputation after input change
  • AmusedScheduler — Gumbel masking helpers, 2D tensor reshaping, intermediate/final timestep behavior, invalid schedule validation
  • CogVideoX schedulers — SNR shift, set_timesteps guards, multi-step DPM API
  • DDPMWuerstchenScheduler — float timestep schedule and add_noise
  • FlowMatchEulerDiscrete / Helios / LTXEulerAncestralRF — non-standard step APIs and multi-stage scheduling
  • loading_utils / remote_utils / state_dict_utils — path/URL validation, submodule resolution, remote decode guards
  • DDIM / DDPM — additional edge-case assertions from prior coverage pass

Test files added/updated

  • tests/hooks/test_first_block_cache.py (new)
  • tests/schedulers/test_scheduler_amused.py (new)
  • tests/others/test_loading_utils.py (new)
  • tests/others/test_remote_utils.py (new)
  • tests/others/test_state_dict_utils.py (new)
  • tests/schedulers/test_scheduler_cogvideox.py (new)
  • tests/schedulers/test_scheduler_ddpm_wuerstchen.py (new)
  • tests/schedulers/test_scheduler_flow_match_euler_discrete.py (new)
  • tests/schedulers/test_scheduler_helios.py (new)
  • tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py (new)
  • tests/schedulers/test_scheduler_ddim.py, test_scheduler_ddpm.py (extended)
  • utils/check_copies.py (comparison fix)

Why these tests materially reduce regression risk

  • FirstBlockCache is shared inference acceleration logic used across multiple pipelines; incorrect skip/recompute behavior silently changes outputs.
  • AmusedScheduler has a bespoke discrete-token API (not covered by SchedulerCommonTest); masking schedule bugs would break Amused pipelines entirely.
  • Utility loaders (load_image, get_submodule_by_name, remote decode) sit on critical paths for pipeline I/O; bad path handling or state-dict parsing causes hard-to-debug load failures.
  • Specialized schedulers (CogVideoX, Wuerstchen, Helios, LTX RF) have custom step signatures; pipeline tests alone do not lock in scheduler contract details.

Validation

PYTHONPATH=src python3 -m pytest \
  tests/hooks/test_first_block_cache.py \
  tests/schedulers/test_scheduler_amused.py \
  tests/others/test_loading_utils.py \
  tests/others/test_remote_utils.py \
  tests/others/test_state_dict_utils.py \
  tests/schedulers/test_scheduler_cogvideox.py \
  tests/schedulers/test_scheduler_ddpm_wuerstchen.py \
  tests/schedulers/test_scheduler_flow_match_euler_discrete.py \
  tests/schedulers/test_scheduler_helios.py \
  tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py \
  -q

90 tests passed locally.

  • Did you use an AI agent to help with this PR?
  • Did you write any new necessary tests?
Open in Web View Automation 

cursoragent and others added 4 commits June 29, 2026 02:03
Cover FlowMatchEulerDiscreteScheduler, HeliosScheduler, and
LTXEulerAncestralRFScheduler contract behavior, DDIM/DDPM
set_timesteps validation guards, state_dict LoRA conversion paths,
and remote_utils encode/decode helpers.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
…g_utils

Cover high-blast-radius code paths that previously only had indirect
pipeline coverage:
- CogVideoXDDIMScheduler SNR shift and set_timesteps guard
- CogVideoXDPMScheduler multi-step API (old_pred_original_sample)
- DDPMWuerstchenScheduler float timestep schedule and add_noise
- loading_utils path/URL validation and submodule resolution

Use python -m ruff in check_copies so the commit hook works when ruff
is installed as a Python package but not on PATH.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
- Unit-test FBC skip/recompute logic, tuple outputs, and threshold behavior
- Cover AmusedScheduler Gumbel masking, 2D reshaping, and schedule validation

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
Compare observed and theoretical copied blocks after applying the same
ruff formatting to each, avoiding false drift when only one side was
previously stylified. Also fix multi-line overwrite and use python -m ruff.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/regression-test-coverage-622f branch from 305046c to 97cdb2f Compare July 1, 2026 02:10
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