Skip to content

feat(atlas): end-of-semester PM close-out with program-lead sign-off - #364

Merged
UgaTheDev merged 4 commits into
mainfrom
atlas-closeout
Dec 3, 2026
Merged

UgaTheDev merged 4 commits into
mainfrom
atlas-closeout

Conversation

@UgaTheDev

Copy link
Copy Markdown
Contributor

What

End-of-semester close-out for project PMs, built on upload_requests (the magic-link table).

  1. Admin → /admin/closeout (linked from the Uploads page header; the rail is unchanged). Pick a term to list the org's projects with a run that term, along with the run's PM, the PM's email (people directory, aliases included) and the status: not sent / sent / submitted / approved / sent back / expired. Send links creates kind='closeout' requests and emails the PMs through the existing batch send machinery with a new template. Resend reuses the live link and its draft. An expired link gets a fresh one. A project with no PM email still comes back as a row with the link to copy. It is never skipped silently.
  2. PM → /contribute/<token> (closeout kind): a form pre-filled from the project. It has the description, tech tags, topics (from settings.topics), repo and demo URLs, screenshots (the same token upload endpoint and ImageSlot), that term's contributors as an editable table, and a program lead picked from settings. Save draft and Submit for sign-off both validate on the server, and problems show inline per field. Blockers stop a submit. The token only ever writes the request's draft column. The page works at phone width and has a sticky footer.
  3. Sign-off → /admin/closeout/<token>, reached from Approvals (new closeout kind). It shows old → new per field, contributors as added / removed / changed, a picker for which screenshots to keep, and the checks. Approve and Send back with a note work only for the chosen lead's email or a super admin. Everyone else sees the page read-only with "Waiting on …". Approve runs as one transaction. It writes blurb, tech, topics, repo and prod URLs, and images, sets status complete, replaces that term's contributors and marks the request approved. It never writes visibility, published, owner_org, surfaces or featured. Send back reopens the link and emails the PM the note.
  4. Settings: a ProgramLeadsEditor component (the settings page change is two lines). The list is validated server-side: trimmed, email-shaped, deduped, at most 20. It defaults to [] in code.

Security

  • Lead names and emails are not in the public GET /api/settings payload or in getGallerySettings(), whose result reaches public pages. They load only from GET /api/settings?programLeads=1, which needs an admin session.
  • The draft is untrusted. Every read goes through coerceDraft, and every save, submit and approve re-validates on the server. The request body is capped at 100KB, and the existing rate limiter now covers draft save and submit too.
  • The PM sees only their own project's contributors for that term.
  • Screenshot paths now filter on kind='screenshots': the outreach lists, the review queue, the counts, the per-project links, approve, and the screenshot reject route. Without that filter, a close-out could be approved or sent back through the screenshot endpoints and skip the lead check.

Migration

atlas/db/migrations/008_closeout_requests.sql is idempotent, and lib/db.ts lazy DDL adds the same columns, so the migration and the deploy can go in either order. The rollback refuses to run while any close-out row exists. Not applied.

Reviewer, please check

  • PD re-sync vs approved blurbs: approve does not set blurb_locked, because the spec whitelisted only the listed fields. A later PD sync could overwrite a description a lead just approved.
  • Lead emails reach the PM's browser as the <select> values, since the draft stores the lead's email. Names-only would need a server-side name→email map.
  • Contributors are matched to a term with termsEqual and deleted by id, because stored terms predate the canonical spelling.
  • The approve-time checks skip the "lead is in the list" rule, so removing a lead from Settings can't strand a submitted close-out.
  • publishBlockers blocks a PM whose project has no course & term. The PM can't fix that, so the message tells them to reply to the email.
  • The weekly Slack digest does not count close-outs yet. DigestInput.waiting has fixed keys.
  • A program lead must also be an Atlas admin in the project's org (or a super admin) to sign off.

Tests

lib/closeout.test.ts covers coerce, validate, diff, can-approve and lead cleaning. lib/email.test.ts covers the close-out template and note escaping. npx vitest run passes (237 tests) and npx tsc --noEmit is clean. The UI has not been clicked through against a database.

🤖 Generated with Claude Code

https://claude.ai/code/session_0152aazG7AAEF6rWPWCedVgY

PMs get an emailed private link to a pre-filled close-out form (description,
tech, topics, repo/demo links, screenshots, this term's contributors, program
lead). The token only writes the request's draft. The chosen program lead (or
a super admin) signs off from Approvals; only then are the whitelisted fields,
the term's contributors and screenshots written and status set to complete.

- 008_closeout_requests: upload_requests gains kind/term/program_lead/draft
  (lazy DDL kept in step; rollback refuses while close-out rows exist)
- lib/closeout.ts: pure coerce/validate/diff/canApprove/cleanProgramLeads + tests
- /admin/closeout: pick a term, see PM + email + status, send/resend links;
  PMs with no email are listed with the link to copy
- /admin/closeout/<token>: old -> new per field, contributors diff, keep-images
  picker, approve / send back with a note (emails the PM)
- Settings: program leads editor; leads never in the public settings payload
- Screenshot flows filter kind='screenshots' so close-out tokens can't leak in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152aazG7AAEF6rWPWCedVgY
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 577efd3b-017e-4b14-9ef1-8b9cd4b15943
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

UgaTheDev and others added 3 commits December 3, 2026 16:32
…ption

The table headers carry .lab (display:block), which broke the table layout on
desktop: headers stacked and the last-name column collapsed. Approving a
close-out now sets blurb_locked so the next PD sync can't overwrite it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152aazG7AAEF6rWPWCedVgY
The sign-off page sends the submission time it showed; approveCloseout's claim
requires it, so a PM resubmitting while the lead reviews makes approve fail with
"reload" instead of applying edits the lead never saw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152aazG7AAEF6rWPWCedVgY
# Conflicts:
#	atlas/app/admin/settings/page.tsx
@UgaTheDev
UgaTheDev merged commit 62d1e9e into main Dec 3, 2026
4 checks passed
@UgaTheDev
UgaTheDev deleted the atlas-closeout branch December 3, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant