Skip to content

test(backend): cover the six zero-coverage modules — ratchet moves up#178

Merged
eren23 merged 1 commit into
mainfrom
test/backend-quick-wins
Jul 19, 2026
Merged

test(backend): cover the six zero-coverage modules — ratchet moves up#178
eren23 merged 1 commit into
mainfrom
test/backend-quick-wins

Conversation

@eren23

@eren23 eren23 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

PR C of the coverage campaign. Honest scope note: three of the six "zero-coverage" targets already had tests (breaker's core state machine, moderation's fail-open, _env's truth table) — this adds only what was missing:

  • video.py 0% → 100%: tier/model precedence ladder, FAL_KEY guard, LTX-2 duration snapping, Wan frame clamps, payload fallbacks (all provider calls mocked; new env pins in _SCRUB).
  • breaker.py: the untested wall-clock leg — cooldown half-open, failed probe re-opens instantly, good probe clears (monotonic clock monkeypatched).
  • moderation.py: the empty-reason default branch.
  • ltxf.py (new suite): envelope round-trip against the raw wire layout, truncation/wrong-magic rejects, split_fmp4 on synthetic boxes incl. 64-bit largesize; local_server.py: import smoke pinning the re-exposed routes (dotenv/modal stubbed).

Ratchet: 84.68% → 85.72%, fail_under 83 → 84. Gate output in CI shows the floor being enforced. 953 tests + ruff + mypy green.

🤖 Generated with Claude Code

Coverage (pytest -m "not paid" --cov=providers --cov=generate):
84.68% -> 85.72% TOTAL; fail_under 83 -> 84 (floor(85.72) - 1).

Per target:
- providers/video.py: 0% -> 100%. New tests/test_video.py — tier/model
  precedence ladder, animate_image orchestration with to_fal_url +
  _fal_subscribe mocked (FAL_KEY guard, LTX-2 string-enum duration snap,
  Wan num_frames clamp, no-payload/no-url raises, content-type/duration
  fallbacks), data_url_from_bytes. Video env pins added to conftest _SCRUB.
- providers/breaker.py: threshold/close/skip were already pinned in
  test_provider_fallback.py; added the untested wall-clock leg — cooldown
  expiry half-opens, failed probe re-opens instantly, good probe clears
  the count (time.monotonic monkeypatched).
- providers/moderation.py: allow/block/off/FAIL-OPEN already pinned in
  test_deploy_safety.py; added the empty-reason -> "blocked by moderation"
  default branch.
- ltxf.py: new tests/test_ltxf.py — envelope round-trip against the wire
  layout, short/wrong-magic/truncated-header rejects, split_fmp4 on
  synthetic boxes incl. 64-bit largesize and size-0 open box, no-moov
  raise. (Outside the providers+generate cov scope, so no TOTAL effect.)
- local_server.py: new tests/test_local_server.py — import smoke with
  dotenv stubbed (host .env stays out) + modal stubbed; asserts the module
  re-exports generate.fastapi_app and the expected routes exist. No
  server start. (Outside cov scope.)
- _env.py: already fully covered by tests/test_env_flag.py (truth table,
  defaults, garbage) — nothing added, duplication avoided.

Gates: pytest 84.0% floor reached at 85.72%; ruff clean; mypy clean
(46 files).
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@eren23
eren23 merged commit 2a54a8d into main Jul 19, 2026
9 checks passed
@eren23
eren23 deleted the test/backend-quick-wins branch July 19, 2026 08:47
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