Skip to content

refactor: changed dlib to run in another project - #114

Merged
DiFronzo merged 4 commits into
mainfrom
release/0.10.0
Sep 25, 2026
Merged

DiFronzo merged 4 commits into
mainfrom
release/0.10.0

Conversation

@DiFronzo

@DiFronzo DiFronzo commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

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:

  • Added two new jobs to .github/workflows/ci.yml to 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:

  • Refactored .github/workflows/deploy.yml to deploy two Toolforge tools in sequence (face service and main app), with clear separation and improved environment validation.
  • Added a step to publish a source tag for the face service, ensuring the deployed code matches the release and supporting reproducible builds.
  • Split deployment scripts into modular, uploaded shell scripts (lib.sh, deploy-face.sh, deploy.sh) for easier maintenance and clearer separation of face service and main app deployment logic.
  • Added preflight checks and improved error handling: verifies required environment variables before deployment, waits for the face service to become healthy, and only starts workers if the face service is reachable, preventing silent failures in image processing.

Copilot AI lite review requested due to automatic review settings September 25, 2026 15:41
Comment thread tests/test_app.py Fixed
Comment thread tests/test_worker.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 5 Medium severity

Open (8)
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 thread .github/workflows/deploy.yml
Comment thread app.py
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,
Comment thread face_client.py
Raises FaceServiceRejected if the server reported a per-image error, or
FaceServiceUnavailable if the payload is structurally wrong.
"""
status = prediction.get("status")
Comment thread face_client.py
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.
Comment thread jobs.yaml Outdated
image: tool-wikivisage/tool-wikivisage:latest
continuous: true
mem: 3Gi
mem: 1Gi
Comment thread templates/base.html
<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 thread worker.py
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."
)
@DiFronzo
DiFronzo merged commit a0bc575 into main Sep 25, 2026
9 checks passed
@DiFronzo
DiFronzo deleted the release/0.10.0 branch September 25, 2026 16:04
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.

3 participants