Repository navigation
Chat lifecycle: archive, 6-month cleanup, restore, deleted Users (#98) - #107
Merged
Merged
Conversation
An Archived Project's chat is read-only and staff-only, with the day it will be deleted; a daily background job deletes it 6 months after archiving; restoring before then keeps the history; deleted Users' messages stay as "Deleted user". Completes spec #91. Co-Authored-By: Claude Opus 5.5 <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.
Closes #98 and with it spec #91 (Project chat).
What's new
projects.archived_atis set when a Project is archived and cleared on restore. An archived chat is read-only and only Teachers and the Superuser can open it. Former Members (Makers) and Guests get 403. Sending, editing, deleting, reacting, typing and Guest changes are refused (409).deleted_ononGET .../chat).chat.clean_up_forever, started in the app's lifespan) runs at startup and then once a day. It deletes the messages of chats whose Project was archived more than 182 days ago, using the database'snow(). Their files, reactions and mentions go along viaON DELETE CASCADE, together with the read marks and the files folder on thechat-filesvolume. It runs on its own instead of inside the daily-email loop, because that loop only starts when SMTP is configured.0019:projects.archived_at. Projects that were already archived get the migration day, so their chats are deleted 6 months from now.CONTEXT.md(Chat) and changelog updated.Tests
test_chat_lifecycle.py(archived chat read-only and staff-only, deletion date, write actions refused; restore keeps the history; cleanup at 181 vs 183 days with the database clock moved, the file removed from the volume, active chats untouched, restore after cleanup starts empty; deleting a User keeps "Deleted user" messages).test_chat_lifecycle.py(a Teacher reads an archived chat with its deletion date, no input, no menus or reactions).Note:
test_my_project.py::test_student_sees_their_projects_photoerrored once more locally at teardown ("Your session has expired"; during #96 it was a NiceGUIreconnect_timeouterror). It has nothing to do with the chat and passes on its own. It looks flaky and is worth a separate look. A first local run of the full suites also hung once and never finished; it ran cleanly on the rerun.🤖 Generated with Claude Code