Conversation
…igration Co-authored-by: uwwint <25582125+uwwint@users.noreply.github.com>
Fix work_dir column type mismatch in initial migration
marius-mather
left a comment
There was a problem hiding this comment.
I think there are a few things to look at here, particularly with how the admin role is checked from the access token. It's important not to overcomplicate this, try to look at the specific claims we use in Auth0 to store roles and only look at that in your code.
There was a problem hiding this comment.
Pull request overview
Adds optional database admin/debug UI tooling to the FastAPI backend, mounted conditionally via an environment flag, along with docs/config and tests to validate mounting and access helpers.
Changes:
- Introduces Starlette Admin + admin-only debug endpoints (
/admin/debug/*) and mounts them fromcreate_app(). - Adds tests covering admin mounting/config gating and debug endpoint responses.
- Updates dependencies/config/docs for enabling the optional admin UI.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
app/db/admin.py |
New Starlette Admin + debug API mounting helpers, Auth0-based login/session handling, and admin access dependency. |
app/main.py |
Calls mount_db_admin(app) during app creation. |
tests/test_db_admin.py |
New tests for enabling logic, mounting behavior, claims role checks, and debug endpoints. |
tests/test_main.py |
Verifies admin debug routes are present when enabled via env vars. |
tests/conftest.py |
Forces ENABLE_DB_ADMIN=false for tests by default. |
pyproject.toml |
Adds starlette-admin dependency and excludes app/db/admin.py from mypy/coverage. |
uv.lock |
Locks starlette-admin (and jinja2) into the resolved dependency set. |
README.md |
Documents optional /admin UI and required env vars. |
.env.example |
Adds admin-related env vars and changes example DB port. |
app/services/job_utils.py |
Minor typing cleanup for prefixes. |
app/routes/workflows.py |
Removes/shortens a few placeholder comments/unused assignments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
marius-mather
left a comment
There was a problem hiding this comment.
This looks good overall, I just want to make sure we're not overcomplicating the admin login. I was able to implement this without having to render my own HTML etc., see: https://github.com/AustralianBioCommons/aai-backend/blob/08e8c0ca593844c5b176003d11b3601e9e6f86b9/db/st_admin.py#L321.
Where possible, I think you want to avoid creating HTML pages etc. where you could take the simpler route and just do a redirect.
marius-mather
left a comment
There was a problem hiding this comment.
looking good now, thanks!
64d1037 to
e49ade0
Compare
|
Hi @marius-mather , just solved conflicts due to previous PR, can you help to have a quick look and approve again? Thank you! |
marius-mather
left a comment
There was a problem hiding this comment.
all good - but try to avoid force-pushing in future as it can mess up history and do unexpected things. you can usually fix merge conflicts by merging main into your PR branch
Pull Request
Summary
SBP-255 Add optional DB admin/debug tooling
Changes
app/db/admin.py(new)app/main.pyviamount_db_admin(app)/admin/debug/*for S3 objects, run inputs, and run outputsworkflow_runs.binder_nameworkflow_runs.sample_idrun_metrics.final_design_count.env.exampleadmin-related env varsREADME.mdAPI/env/docs for optional DB admin UItests/test_db_admin.pytests/test_main.pytests/test_services_job_utils.pystarlette-admindependencyapp/db/admin.pyinpyproject.tomlHow to Test
uv sync --extra devuv run ruff check app testsuv run black --check app testsuv run mypy app --ignore-missing-importsuv run pytest --cov=app --cov-report=term-missing -qENABLE_DB_ADMIN=true/admin/admin/debug/s3-objects,/admin/debug/run-inputs,/admin/debug/run-outputstests/test_services_job_utils.pyand confirm sample-based ranker path coverageType of change
Checklist