Repository navigation
refactor: changed dlib to run in another project - #114
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (8)
Validate token length before destructive face service restart · New Old face service is deleted before replacement readiness · New Update health endpoint tests for the changed JSON response · New Validate prediction item types before accessing fields · New Reject oversized images before requests exceed server limits · New Increase worker memory or reduce concurrent image processing · New Retain Apple standalone web app meta tag · New Prevent false completion when retryable downloads fail · New
What changed in this PR
Refactors face detection into a standalone KServe/dlib service accessed by the web app and worker over HTTP.
Changes:
- Adds the face service, client, authentication guard, Docker/buildpack deployment, and CI contract tests.
- Refactors worker batching, retries, and manual face encoding.
- Updates deployment, documentation, dependencies, and thumbnail handling.
| File | Description |
|---|---|
| tests/test_worker.py | Updated as part of this pull request. |
| tests/test_security_round2.py | Updated as part of this pull request. |
| tests/test_face_service_guard.py | Updated as part of this pull request. |
| tests/test_face_service_contract.py | Updated as part of this pull request. |
| tests/test_face_client.py | Updated as part of this pull request. |
| tests/test_app.py | Updated as part of this pull request. |
| tests/conftest.py | Updated as part of this pull request. |
| TESTING.md | Updated as part of this pull request. |
| test-local.md | Updated as part of this pull request. |
| templates/base.html | Updated as part of this pull request. |
| static/wikivisage-common.js | Updated as part of this pull request. |
| SECURITY.md | Updated as part of this pull request. |
| requirements.txt | Updated as part of this pull request. |
| README.md | Updated as part of this pull request. |
| pyproject.toml | Updated as part of this pull request. |
| project.toml | Updated as part of this pull request. |
| model-server/requirements.txt | Updated as part of this pull request. |
| model-server/project.toml | Updated as part of this pull request. |
| model-server/Procfile | Updated as part of this pull request. |
| model-server/model.py | Updated as part of this pull request. |
| model-server/make_input.py | Updated as part of this pull request. |
| model-server/guard.py | Updated as part of this pull request. |
| model-server/Dockerfile | Updated as part of this pull request. |
| model-server/docker-compose.yml | Updated as part of this pull request. |
| model-server/blubber.yaml | Updated as part of this pull request. |
| model-server/.python-version | Updated as part of this pull request. |
| model-server/.dockerignore | Updated as part of this pull request. |
| jobs.yaml | Updated as part of this pull request. |
| how-to-run-it.md | Updated as part of this pull request. |
| face_client.py | Updated as part of this pull request. |
| CONTRIBUTING.md | Updated as part of this pull request. |
| CLAUDE.md | Updated as part of this pull request. |
| app.py | Updated as part of this pull request. |
| .gitignore | Updated as part of this pull request. |
| .github/workflows/deploy.yml | Updated as part of this pull request. |
| .github/workflows/ci.yml | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+182
to
186
| # Toolforge requires a token; fail fast before touching the live service. | ||
| if ! toolforge envvars show WIKIVISAGE_FACE_SERVICE_TOKEN >/dev/null 2>&1; then | ||
| echo "::error::WIKIVISAGE_FACE_SERVICE_TOKEN is not set on tool ${FACE_TOOL}." | ||
| exit 1 | ||
| fi |
Comment on lines
+4251
to
+4252
| "face_service": "reachable" if face_service_ok else "unreachable", | ||
| "degraded": not _LIMITER_REDIS_OK or not face_service_ok, |
| Raises FaceServiceRejected if the server reported a per-image error, or | ||
| FaceServiceUnavailable if the payload is structurally wrong. | ||
| """ | ||
| status = prediction.get("status") |
Comment on lines
+288
to
+289
| A single item larger than the byte budget still gets its own batch — the | ||
| server enforces its own per-image ceiling and will reject it cleanly. |
| image: tool-wikivisage/tool-wikivisage:latest | ||
| continuous: true | ||
| mem: 3Gi | ||
| mem: 1Gi |
| <meta name="theme-color" content="#090e17"> | ||
| <link rel="apple-touch-icon" href="{{ url_for('static', filename='icon-192.png') }}"> | ||
| <meta name="apple-mobile-web-app-capable" content="yes"> | ||
| <meta name="mobile-web-app-capable" content="yes"> |
Comment on lines
+2605
to
+2610
| if pending_images > 0: | ||
| logger.warning( | ||
| f"Project {project_id}: image processing stopped early with {pending_images} image(s) " | ||
| f"still pending ({total_faces} faces so far). NOT auto-completing — the project stays " | ||
| f"active and will retry next cycle. Check images.error_message for the cause." | ||
| ) |
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.


This pull request makes significant improvements to the CI and deployment workflows for the face service and main application. The CI now includes comprehensive contract tests for the face service, both as a Docker build and using the Toolforge buildpack, ensuring wire-format compatibility and catching deployment issues early. The deployment workflow is refactored to support dual-tool deployments (face service and main app), adds robust validation and preflight checks, and splits deployment into clear, auditable steps. This greatly improves reliability, traceability, and safety of releases.
CI workflow enhancements:
.github/workflows/ci.ymlto build and test the face service: one using Docker and one using the Toolforge buildpack, each running contract tests to ensure client-server compatibility and catch build or dependency issues early.Deployment workflow improvements:
.github/workflows/deploy.ymlto deploy two Toolforge tools in sequence (face service and main app), with clear separation and improved environment validation.lib.sh,deploy-face.sh,deploy.sh) for easier maintenance and clearer separation of face service and main app deployment logic.