Remove Jinja2 frontend (dead code after SvelteKit migration) #151
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-api!151
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "150-remove-jinja2-frontend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Removes the entire Jinja2 frontend (
/browse/*routes, HTML templates, rendering pipeline) now that SvelteKit (pal-e-app) serves all frontend routes. Cleans up 4,595 lines of dead code across 29 files.Changes
src/pal_e_docs/routes/frontend.py-- all/browse/*routes (323 lines)src/pal_e_docs/templates/-- 9 HTML template files (base, landing, login, note, projects, project_notes, repos, tags, tag_notes)src/pal_e_docs/autolink.py-- slug auto-linking, only used by frontend rendering pipelinesrc/pal_e_docs/sanitize.py-- HTML sanitization via nh3, only used by frontend rendering pipelinesrc/pal_e_docs/wrap_tables.py-- table scroll wrapper, only used by frontend rendering pipeline/browse/*routes (unit, integration, Playwright browser tests)src/pal_e_docs/main.py-- removedfrontend_routerimport/include andSessionMiddleware(only used by frontend session auth)pyproject.toml-- removeditsdangerous(SessionMiddleware),nh3(sanitize.py),pytest-playwright(browser tests) dependenciestests/conftest.py-- removedreset_slug_cacheimport,live_serverfixture, and unused importstests/test_project_schema.py-- kept API tests (page_note FK, is_public), removed/browse/frontend testsNot removed (verified still in use)
auth.py--hash_passwordstill used bymain.py_seed_user()jinja2dep -- still used byservices/template_renderer.py(create_note_from_template)beautifulsoup4dep -- still used by block parser and embedding workerTest Plan
ruff check src/ tests/-- all checks passedpytest tests/ -v-- 497 tests passed/notes/*,/blocks/*,/boards/*,/projects/*,/tags/*,/repos/*,/links/*) unaffectedReview Checklist
autolink.py,sanitize.py,wrap_tables.pyonly imported byfrontend.pybefore deletionjinja2dep kept (used byservices/template_renderer.py)beautifulsoup4dep kept (used by block parser + embedding worker)SessionMiddlewareonly used by frontend session auth (no API routes use sessions)auth.pykept (hash_passwordused by_seed_user)html_contentcolumn NOT removed (still used for search and revisions)Related
plan-pal-e-docsPhase 4bCloses #150
Self-Review
Reviewed all 4 modified files and verified the 25 deleted files are frontend-only.
Modified files (no issues found)
itsdangerous,nh3,pytest-playwright, andbrowsermarker. Keepsjinja2(used byservices/template_renderer.py),beautifulsoup4(used by block parser + embedding worker),bcrypt(used byauth.py).SessionMiddlewareandfrontend_router. All 8 API routers remain.reset_slug_cache(autolink.py deleted),live_serverfixture (browser tests deleted), unused imports (socket,threading,time,httpx,uvicorn), and browser-test teardown skip. Keepscreate_test_notehelper (still used bytest_blocks_api.pyandtest_compiled_page_api.py).Deleted files (25 total, all frontend-only)
autolink.py,sanitize.py,wrap_tables.py-- verified only imported byfrontend.pyroutes/frontend.pytemplates/directory/browse/*routes exclusivelyVerification
ruff check src/ tests/-- all checks passedpytest tests/ -v-- 497 passed in 7.03sNo issues found. PR is ready for human review.
PR #151 Review
BLOCKERS
None. This is a clean removal of dead frontend code. All API routes, models, and remaining services are unaffected.
NITS
Stale docstring in
blocks/compiler.py-- The module docstring still reads: "downstream transforms (sanitize, autolink, wrap_tables) run separately." Those three modules no longer exist. Should be updated or removed to avoid confusion.Dead code in
auth.py-- Three of the four functions are now unreachable:verify_password(),authenticate_user(), andget_current_user(). Onlyhash_password()is still called (by_seed_user()inmain.py). Thestarlette.requests.Requestimport is also unused. Consider trimmingauth.pyto justhash_password(), or file a follow-up issue.Orphan config field
secret_keyinconfig.py--settings.secret_keywas consumed only bySessionMiddleware, which is now removed. The field and its env-var binding (PALDOCS_SECRET_KEY) are dead. Low priority but worth cleaning up.SOP COMPLIANCE
150-remove-jinja2-frontendreferences #150)plan-pal-e-docsPhase 4b)Closes #150present in PR bodyDetailed Verification
main.pyfrontend_routerremovedinclude_routerboth goneSessionMiddlewareremovedadd_middlewareboth gonejinja2dependency retainedservices/template_renderer.pybeautifulsoup4retaineditsdangeroussafe to removeSessionMiddlewarenh3safe to removesanitize.pypytest-playwrightsafe to removetemplate_renderer.pyunaffectedjinja2,sqlalchemy,pal_e_docs.modelsnotes.pysearch/from-template unaffectedconftest.pycleanreset_slug_cache,live_server, Playwright fixtures all removedtest_project_schema.pycorrect/browse/*tests removed, all API tests retainedVERDICT: APPROVED
Clean, well-scoped removal of 4,595 lines of dead frontend code. No import breakage, no accidental API deletions, dependencies correctly triaged. The three nits (stale docstring, dead auth functions, orphan config field) are non-blocking and should be filed as a follow-up issue.