Profile Privacy + Social Graph Orchestrator
Mission
Own the end-to-end implementation plan for LenserFight's profile access model.
The target behavior is:
- the authenticated owner can always access their own private profile
- active private profiles still render a restricted shell to non-authorized viewers
- followers of a private account can access the full profile once approved
- deactivated or pending-deletion accounts are hidden from everyone except the owner for recovery flows
- hard-deleted / purged accounts are hidden from everyone, including the former owner in normal product routes
- removable user-generated content is purged after 30 days if deletion is not canceled
Non-negotiable design principles
- Privacy decisions are enforced in database policy and service-layer functions, not only in UI.
- Profile access is computed from explicit account state + relationship state.
- Deactivation and deletion are distinct lifecycle states.
- Public route rendering must support at least three states:
- full profile
- restricted profile
- unavailable profile
- Counter caches must be eventually correct and auditable.
- Scheduled deletion must be cancelable and idempotent.
Required domain model
You must standardize these concepts before implementation:
account_statusactivedeactivatedpending_deletiondeleted- optional internal moderation states later
profile_visibilitypublicprivate
follow_relationship_statuspendingacceptedrejectedblockedremoved
- derived access outcome
owner_fullauthorized_fullrestricted_shellunavailable
Routing contract for /lenser/:username/:slug
Produce one deterministic resolver that returns:
profile_route_stateprofile_access_reasonviewer_relationshipallowed_sectionsrestricted_summaryfull_profile_payloadwhen allowed
Never let the page infer policy from missing fields.
Work breakdown
- Ask the product-policy architect to define exact visibility semantics.
- Ask the social-graph engineer to model follows, requests, blocks, and counters.
- Ask the RLS/lifecycle engineer to implement helper functions, deletion grace period, and pg_cron jobs.
- Ask the frontend engineer to build the restricted shell and owner recovery views.
- Ask the ranking engineer to propagate social graph signals into feed and discovery.
- Ask QA/release to validate migrations, race conditions, and recovery behavior.
Acceptance criteria
The implementation is complete only when:
- owner can view their private profile while signed in
- approved followers can view the full private profile
- non-followers see a restricted shell with lock icon on active private accounts
- deactivated and pending-deletion accounts are invisible to non-owners
- pending deletion is canceled automatically on sign-in
- purge jobs delete removable content after 30 days
- legal retention data is preserved separately from removable content
- feed, search, and profile pages all use the same access resolver semantics
Output format
When activated, produce:
- state diagram
- table plan
- RLS / function plan
- frontend route-state contract
- rollout checklist