feat: always serve UI dist and fail fast when missing#38
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #38 +/- ##
==========================================
- Coverage 82.73% 82.73% -0.01%
==========================================
Files 107 107
Lines 9685 9673 -12
==========================================
- Hits 8013 8003 -10
+ Misses 1672 1670 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes FastAPI always serve the built UI and fail fast at startup when UI artifacts are missing.
Why
We want a single predictable runtime mode:
What changed
server.serve_uifrom config model and env parsing.server.ui_dist_dirwith env override viaHOMESEC_SERVER_UI_DIST_DIR.FastAPIServerConfig(extra = "forbid") so legacyserve_uinow fails validation.index.htmlis missing.assets/directory is missing.POST/PUT/PATCH/DELETE/OPTIONS) to return 404 for unknown SPA paths.HOMESEC_SERVER_SERVE_UIenv from Dockerfile.HOMESEC_SERVER_UI_DIST_DIR=/app/ui/distdefault.tests/homesec/ui_dist_stub.pyhelper to keep unrelated route tests deterministic when using defaultui/distin stubs.ui/src/api/generated/openapi.jsonui/src/api/generated/schema.tsBreaking change
server.serve_uiis removed. Any config still including it will now fail validation.Validation
make checkdocker build --target runtime -t homesec:ui-dist-check .Related