Skip to content

Add regression tests for high-blast-radius schedulers and utilities#20

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-a06e
Draft

Add regression tests for high-blast-radius schedulers and utilities#20
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-a06e

Conversation

@cursor

@cursor cursor Bot commented Jun 28, 2026

Copy link
Copy Markdown

What does this PR do?

Adds targeted regression tests for production code paths that previously had weak or no direct unit test coverage. No production behavior changes.

Risky behavior now covered

  • FlowMatchEulerDiscreteScheduler — shared by SD3, Flux, Wan, and 100+ flow-matching pipelines; validates set_timesteps guards (dynamic shifting, custom sigma/timestep mismatch), step contract, scale_noise, duplicate timestep indexing, and full denoising loop.
  • HeliosScheduler — multi-stage set_timesteps(stage_index=...), UniPC corrector invocation on step 2, flow_prediction conversion, and dynamic shifting.
  • LTXEulerAncestralRFScheduler — LTX long-form i2v scheduler contract: explicit sigmas, eta=0 determinism, invalid input rejection, and denoising loop.
  • DDIMScheduler / DDPMScheduler — guards against inverted num_inference_steps > num_train_timesteps validation (regression-prone comparison bug).
  • state_dict_utils — LoRA format conversions (DIFFUSERS ↔ PEFT ↔ KOHYA_SS), including Kohya te1/te2/unet prefix remapping and alpha generation.
  • remote_utils — encode/decode payload preparation, image type detection, input validation, and response postprocessing.

Test files added/updated

  • 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 (2 tests added)
  • tests/schedulers/test_scheduler_ddpm.py (2 tests added)
  • tests/others/test_state_dict_utils.py (new)
  • tests/others/test_remote_utils.py (new)

Why these tests materially reduce regression risk

These components sit on critical inference paths with large blast radius but were only exercised indirectly through heavy pipeline tests. Direct scheduler contract tests catch step/sigma/timestep API regressions before they propagate across dozens of pipelines. Utility tests lock in LoRA key remapping and remote encode/decode wire format — both are easy to break silently and expensive to debug in integration.

Validation

All 49 targeted tests pass locally:

python3 -m pytest -n auto --dist=loadfile -s -v \
  tests/schedulers/test_scheduler_flow_match_euler_discrete.py \
  tests/schedulers/test_scheduler_helios.py \
  tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py \
  tests/schedulers/test_scheduler_ddim.py::DDIMSchedulerTest::test_set_timesteps_num_inference_steps_exceeds_train_timesteps_raises \
  tests/schedulers/test_scheduler_ddim.py::DDIMSchedulerTest::test_set_timesteps_num_inference_steps_at_limit_succeeds \
  tests/schedulers/test_scheduler_ddpm.py::DDPMSchedulerTest::test_set_timesteps_num_inference_steps_exceeds_train_timesteps_raises \
  tests/schedulers/test_scheduler_ddpm.py::DDPMSchedulerTest::test_set_timesteps_num_inference_steps_at_limit_succeeds \
  tests/others/test_state_dict_utils.py \
  tests/others/test_remote_utils.py

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
  • Did you write any new necessary tests?
Open in Web View Automation 

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