feat(admin): founding member audit trail#4016
Closed
bokelley wants to merge 1 commit into
Closed
Conversation
Adds four nullable columns to member_profiles to record who granted founding member status, when, and why. Migration 465 backfills all auto-granted rows (source=auto_pre_cutoff) and the one known manual grandfather. Admin PUT route now captures granted_by/granted_at server-side and blocks auto_pre_cutoff from being written via the API. https://claude.ai/code/session_01Gd19avtPzkW362ahfkpfhe
4 tasks
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 #4014
Adds an audit trail for
member_profiles.is_founding_membermanual overrides so future admins can distinguish auto-grants (migration-driven) from manual grandfathering decisions.What changed
Migration 465 adds four nullable columns to
member_profiles:founding_member_sourceTEXT CHECK IN ('auto_pre_cutoff', 'manual_grandfather')founding_member_granted_atTIMESTAMPTZfounding_member_granted_reasonTEXTfounding_member_granted_byTEXTBackfills on migration run:
is_founding_member = TRUE AND created_at < 2026-04-01→source = 'auto_pre_cutoff',granted_at = created_atsource = 'manual_grandfather',granted_at = 2026-05-03T18:22:35Z, reason setBoth UPDATE statements are guarded with
AND founding_member_source IS NULLfor idempotency.Admin PUT route (
server/src/routes/member-profiles.ts:1851):founding_member_granted_byandfounding_member_granted_atstripped from request body (prevent spoofing)is_founding_member: trueis set: defaultssourceto'manual_grandfather'(backward compat for existing callers), blocks'auto_pre_cutoff'via API (migrations only), capturesgranted_by = req.user!.idandgranted_at = new Date()server-sideNon-breaking justification: All four new columns are nullable with no DEFAULT; existing INSERT/UPDATE paths are unaffected. The route-level validation is backward-compatible (missing source defaults to
'manual_grandfather').Notes (from pre-PR review)
founding_member_granted_bystores a WorkOS user ID, consistent with theset_by_user_idpattern used elsewhere in this codebase (e.g.type_reclassification_log). If cross-referencing by email is needed, that's a follow-up.is_founding_member: false) is not in scope for this issue — the issue asks only about grant provenance. Follow-up if needed.founding_member_sourceis deferred per the issue ("optional, but cheap once the data is there").SELECT id, founding_member_source FROM member_profiles WHERE is_founding_member = TRUE AND founding_member_source IS NULLshould return 0 rows after migration 465 runs.Pre-PR review
new Date()not.toISOString())Session: https://claude.ai/code/session_01Gd19avtPzkW362ahfkpfhe
Generated by Claude Code