server/course: preserve accepted student access during reconfigure - #304
Conversation
Course email invite acceptance can update the authoritative student project before the collaborative course roster observes the account id. A stale reconfiguration snapshot previously erased that binding and removed the newly accepted student. Preserve a valid authoritative student account binding, defer destructive collaborator cleanup while an active student's identity is unresolved, and carry explicit deletion intent so deliberate roster removals still take effect. Add regression coverage for accepted, unresolved, and deleted student states.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17e569efb4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Resolve student identity directly from the requested or authoritative course binding instead of inferring it from non-manager desired collaborators. Reject conflicting or multiple student bindings and prevent current course managers from being assigned to student projects. Also reject course student invitation acceptance by an account that already manages the course project, directing instructors to use a separate student account.
Validate account- and email-based student additions against the current course project managers before writing any student records to the collaborative course document. Resolve exact submitted emails in bounded batches and fail closed while collaborator state is unavailable. When an instructor enters their own address, explain that student testing requires a separate CoCalc account and provide a plus-address example derived from their current email.
|
Added the frontend prevention layer in 4ba06f5. Student enrollment now checks current course-project managers before writing any student row to the collaborative |
Summary
account_idRoot cause
A student accepted a course email invitation, which added them to the authoritative student project and recorded their account in
projects.course. Before the collaborative.coursedocument observed that account ID, a course reconfiguration submitted a stale snapshot without it. The worker treated the student as absent, erased the authoritative binding, and removed their collaborator access. A subsequent direct course purchase then failed its authoritative collaborator check.This restores the legacy safety invariant that unresolved identity must not cause destructive collaborator cleanup. Once identity resolves, normal cleanup resumes; explicit roster deletion remains destructive.
Remediation scope
This prevents future removals. It intentionally does not bulk-restore historical missing collaborators because some students may have intentionally left their projects.
Validation
src/packages/conatsrc/packages/serverNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.