You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Admin delete-user destroys profile data on a path that then fails #653
.schema("core") applies to the statement it is written on. Every call after the first addresses public.
table
exists in
so the delete
user_certifications
core only
targets public — fails
applications
core only
targets public — fails
reviews
core only
targets public — fails
work_experience
nowhere (core.user_experience)
fails
education
nowhere (core.user_education)
fails
organization_members
nowhere at all
fails
No result is destructured, so every error is discarded. The endpoint deletes core.user_skills and core.profile, leaves the rest, and returns success.
Impact
An operator actioning a deletion request believes the data is gone. The user's certifications, job applications and reviews remain.
Acceptance
Every delete names its schema explicitly and an existing table
work_experience → core.user_experience, education → core.user_education; decide what organization_members was meant to be (org membership is modelled as core.role_assignments.scope_org_id)
Each delete's error is checked; the endpoint fails loudly rather than reporting success
A test deletes a seeded user with rows in every table and asserts none remain
Same root cause as the CCPA issue and #618. Guarded going forward by #651.
I claimed the six broken deletes leave certifications, applications and reviews behind while the endpoint reports success. They do not. Every one of those tables cascades from core.users, and core.users cascades from auth.users. Verified in a rolled-back transaction:
phase | edu | skills | certs | apps
BEFORE | 2 | 6 | 3 | 1
DELETE 1
AFTER | 0 | 0 | 0 | 0
I read the code and the catalogue and inferred the consequence instead of running it. The six statements are dead, but the deletion they appear to perform happens anyway.
What is actually wrong is worse
Ten references to core.users do not cascade — three NO ACTION, seven RESTRICT:
NO ACTION core.skill_evidence.verified_by
NO ACTION core.user_skills.verified_by
NO ACTION core.work_logs.verified_by_user_id
RESTRICT core.tasks.created_by_user_id
RESTRICT core.punchlists.created_by_user_id
RESTRICT core.organization_documents.created_by
RESTRICT core.organization_document_versions.uploaded_by
RESTRICT core.organization_document_shares.created_by
RESTRICT core.organization_folders.created_by
RESTRICT core.organization_locations.created_by
So for any user who has verified a work log or created a task, the final delete fails — after the two hand-written deletes that do work have already run:
delete from core.user_skills ... -- succeeds
delete from core.profile ... -- succeeds
delete from core.users ... -- ERROR: violates foreign key constraint
-- work_logs_verified_by_user_id_fkey
There is no transaction. The operator is told "Failed to delete user profile" while that user's skills and personal details are already destroyed, and retrying does nothing more.
Reproduced end to end against a live stack with user …0002 (18 tasks, 3 punchlists): old code returned 500 with the profile row gone; the fix returns 409 blockedBy: [{tasks:18},{punchlists:3}] with the profile intact.
So the title should read "destroys data on a path that then fails", not "leaves data behind and reports success". Fixed in #663, which also stops treating an unreadable count as zero — the same measurement error that produced #652.
changed the title [-]Admin delete-user leaves certifications, applications and reviews behind, and reports success[/-][+]Admin delete-user destroys profile data on a path that then fails[/+]on Aug 27, 2026
Activity
thinkclay commentedon Aug 27, 2026
Correction: what I filed here was wrong
I claimed the six broken deletes leave certifications, applications and reviews behind while the endpoint reports success. They do not. Every one of those tables cascades from
core.users, andcore.userscascades fromauth.users. Verified in a rolled-back transaction:I read the code and the catalogue and inferred the consequence instead of running it. The six statements are dead, but the deletion they appear to perform happens anyway.
What is actually wrong is worse
Ten references to
core.usersdo not cascade — three NO ACTION, seven RESTRICT:So for any user who has verified a work log or created a task, the final delete fails — after the two hand-written deletes that do work have already run:
There is no transaction. The operator is told "Failed to delete user profile" while that user's skills and personal details are already destroyed, and retrying does nothing more.
Reproduced end to end against a live stack with user
…0002(18 tasks, 3 punchlists): old code returned 500 with the profile row gone; the fix returns409 blockedBy: [{tasks:18},{punchlists:3}]with the profile intact.So the title should read "destroys data on a path that then fails", not "leaves data behind and reports success". Fixed in #663, which also stops treating an unreadable count as zero — the same measurement error that produced #652.
[-]Admin delete-user leaves certifications, applications and reviews behind, and reports success[/-][+]Admin delete-user destroys profile data on a path that then fails[/+]fix(api): the CCPA disclosure under-reported, and delete-user destroy…