Skip to content

Coverage: vite + frontend/providers (vite, inertia, broadcasting, storage, loader)#160

Open
tmgbedu wants to merge 2 commits into
mainfrom
task/vite-frontend-providers-coverage-721
Open

Coverage: vite + frontend/providers (vite, inertia, broadcasting, storage, loader)#160
tmgbedu wants to merge 2 commits into
mainfrom
task/vite-frontend-providers-coverage-721

Conversation

@tmgbedu

@tmgbedu tmgbedu commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Raises unit-test coverage for the Vite asset helper, the Loader utility and the inertia / broadcasting / storage service providers. Tests mock the filesystem, Vite manifest and request/network layers — no live servers or network required.

Coverage impact

Module Before After
vite/vite.py 24% 100%
loader/Loader.py 24% 100%
inertia/provider.py 50% 100%
storage/providers/provider.py 28% 100%
broadcasting/provider.py 19% 98%

Total project coverage: 73.94% (threshold fail_under = 68).

What's covered

  • Vite — HMR (hot) vs manifest (production) modes, asset URLs (default / asset_url / custom resolver), tag + preload generation, CSP nonce, integrity, attribute resolvers, manifest caching & hashing, and the ViteException / ViteManifestNotFoundException error paths.
  • Loaderget_modules, find / find_all, get_object(s), get_parameters, and the not-found / raise paths.
  • Inertia provider — binding, middleware registration, and Jinja global injection (including the absent-templates branch and the page-markup helper).
  • Storage provider — manager/driver registration and the /storage/{path} route (serve, 404, no-FastAPI early return).
  • Broadcasting provider — manager/server bindings, stub publishing, the /broadcasting/auth handler across public/private channels and every user-resolution branch, routes/channels.py auto-loading, and the no-FastAPI fallbacks.

Notes

Two small pre-existing quirks were worked around in tests rather than changed (framework code left untouched): passing a plain dict to use_*_tag_attributes self-references the wrapping lambda, and the auth handler's Request annotation is an unresolved forward-ref under from __future__ import annotations, so its body is exercised directly.

Testing

uv run pytest --ignore=tests/masoniteorm/postgres — 1726 passed, 7 skipped.

Raise coverage for the Vite asset helper, the Loader utility and the
inertia/broadcasting/storage service providers with unit tests that mock
the filesystem, manifest and request/network layers.

- vite/vite.py 24% -> 100%
- loader/Loader.py 24% -> 100%
- inertia/provider.py 50% -> 100%
- storage/providers/provider.py 28% -> 100%
- broadcasting/provider.py 19% -> 98%
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tmgbedu

tmgbedu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Code review verdict: REQUEST CHANGES (Ruff CI red) — content otherwise approve-worthy

(Formal request-changes not possible — same-account PR — so filing as a comment.)

Verified locally on task/vite-frontend-providers-coverage-721:

  • Only 5 test files changed — no framework source touched. ✅
  • Coverage matches claims exactly: vite 100%, loader 100%, inertia 100%, storage 100%, broadcasting 98% (uncovered: lines 77, 107), total 73.94% ≥ 68; 1726 passed, 7 skipped. ✅
  • Tests assert real behavior, deps mocked, no live servers/network. ✅

Blocker — Ruff CI is failing (2 jobs). Reproduced locally:

  1. ruff check F401: tests/broadcasting/test_provider.py:3 imports TestClient but never uses it — remove it.
  2. ruff format --check reformats 3 files:
    • tests/broadcasting/test_provider.py (two over-wrapped await handler(...) calls)
    • tests/utils/test_loader.py ('''""" on MODULE_SOURCE)
    • tests/vite/test_vite.py ("rel=\"modulepreload\""'rel="modulepreload"')

Fix:

uv run ruff check --fix tests/broadcasting/test_provider.py
uv run ruff format tests/broadcasting/test_provider.py tests/utils/test_loader.py tests/vite/test_vite.py

Push and CI goes green — I'll re-approve immediately.

Follow-up bug tasks recommended (both correctly worked-around, not fixed — this is a test-only PR):

  1. LOW — Vite.use_*_tag_attributes self-references its wrapping lambda when given a plain dict.
  2. MEDIUM — broadcasting auth handler Request forward-ref (under from __future__ import annotations) can't be injected by FastAPI → 422 over real HTTP; endpoint effectively non-functional via normal request.

Remove unused `TestClient` import in broadcasting test (F401) and apply
`ruff format` to the broadcasting, loader and vite test files. Test-only
change; no framework source touched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tmgbedu

tmgbedu commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

✅ APPROVE (Code Reviewer)

Ruff blocker resolved in commit 51be36e2 (removed the unused TestClient import + ruff format on the 3 affected test files — test-only, no framework source touched, no stray files).

Final CI — all green:

  • Ruff ✅ (both jobs)
  • Pytest ✅ (3m14s)
  • codecov/patch ✅

Confirmed locally too: ruff check . clean, ruff format --check . clean, 1726 passed, 7 skipped. Coverage unchanged — vite/loader/inertia/storage 100%, broadcasting 98%, total 73.94% ≥ 68.

Formal GitHub approval is blocked on a same-account PR, so recording approval here. Do not merge per standing order — over to the PM.

(Two follow-up framework bug tasks still recommended, unchanged: LOW Vite use_*_tag_attributes dict self-ref; MEDIUM broadcasting auth Request forward-ref → 422 over real HTTP.)

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