Repository navigation
Purge collected people, authors and task transcripts with their project - #404
Merged
Merged
Conversation
Deleting a project kept the project and run rows for billing, and the purge didn't list the LinkedIn collection tables, project_authors or project_task_entries, so collected people, author bindings and task transcripts outlived it. A collection interrupted mid-lease made it worse: the job still referenced its extension device, so deleting the connections failed on that foreign key and the deletion never completed. The purge now removes those rows, collection jobs before the connections. A schema test fails whenever a table holding project data is neither purged nor listed as kept on purpose. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What and why
Deleting a project keeps the project and run rows for the billing ledger, so foreign-key cascades from
projectsandworkflow_runsnever fire.purge_project_datadidn't list these tables, so they outlived the project:connection_collection_jobs,connection_collection_pagesandconnection_collection_account_leases: the people LinkedIn collection gathered (names, headlines, up to 3,000 characters of page text each);project_authors: author bindings;project_task_entries: task transcripts.chat_messageswere already purged; these weren't.A collection interrupted mid-lease also stopped deletion from completing. The job still pointed at its extension device (
lease_device_id, noON DELETE). Deletingintegration_connectionscascades to the devices, so that foreign key failed and the purge transaction rolled back.The purge now deletes those rows, with collection jobs going before the connections.
tests/test_project_purge.pyadds two tests:KEPTwith a reason. A new table that forgets the purge fails CI.Verification
main: the guard names the missing tables, and the purge test hits theconnection_collection_jobs_lease_device_id_fkeyviolation. Both pass with the fix.ruff format --check,ruff checkandlint-importsare clean.test_project_purge,test_project_deletion,test_project_deletion_api,test_x_project_purge,test_connection_collection,test_run_lifecycle_regressions. All passed. Running them in parallel locally exhausted Postgres shared memory, which is an environment issue.Notes
paid_ads_campaignsandpaid_ads_proposalsare listed as kept. They hold no personal data, and whether Tin keeps its record of the Google Ads campaigns it created is a separate decision.🤖 Generated with Claude Code