fix(photo-approval): resolve group photo lifecycle gaps#49
Open
wailbentafat wants to merge 1 commit into
Open
Conversation
- Auto-approve group photos as public when no face matches any user - Add ExpireStaleApprovals SQL + service method to unblock photos where users never respond (default 7-day timeout via config) - Wire hourly expiry background task into FastAPI lifespan
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
_handle_group_photonow tracks how many approval records were created. If zero faces matched any enrolled user, the photo is auto-approved and made public — same behaviour as the no-faces path.ExpireStaleApprovalsSQL query (atomic CTE: marks pending approvals →approved, photo →approved), aPhotoApprovalService.expire_stale()method, and a background task in the FastAPI lifespan that runs the expiry every hour. Timeout defaults to 7 days and is configurable viaPHOTO_APPROVAL_TIMEOUT_DAYSin.env.Files changed
app/worker/photo_worker/main.pydb/queries/photo_approvals.sqlExpireStaleApprovalsquerydb/generated/photo_approvals.pyexpire_stale_approvalsapp/service/photo_approval.pyexpire_stale(timeout_days)app/core/config.pyPHOTO_APPROVAL_TIMEOUT_DAYS: int = 7app/main.pyTest plan
make lint— passesmake check_type— passes (137 files, 0 issues)approved+publicpendingPHOTO_APPROVAL_TIMEOUT_DAYSdays,expire_stalemarks photosapproved