feat: consolidate local privacy and admin updates - #2455
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba70793a16
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const isPrivacyProfileComplete = data !== null && isPrivacyProfileStatusAllowed(data.status); | ||
|
|
||
| if (error || !isPrivacyProfileComplete) { | ||
| clearSupabaseAuthCookies(request, supabaseResponse); |
There was a problem hiding this comment.
Provision privacy profiles before enforcing eligibility
For any new user—or any existing user without an eligible/guardian_verified row—this condition clears the authentication cookies and redirects or returns 403. A repository-wide search finds no migration defining privacy_age_profiles and no flow that creates or updates these rows; the OAuth callback also requires the row immediately after exchanging the login code. Consequently, users cannot establish the profile needed to pass this check and authenticated routes become inaccessible. Add the schema/enrollment flow before making this a mandatory session gate.
Useful? React with 👍 / 👎.
| const supabaseAdmin = createSupabaseServiceRoleClient(); | ||
| const { data, error } = await supabaseAdmin.rpc('preview_account_deletion', { | ||
| p_actor_user_id: targetUserId, | ||
| p_target_user_id: targetUserId, | ||
| p_reauthenticated_at: verifiedUser.last_sign_in_at, | ||
| }); |
There was a problem hiding this comment.
Add the required account-deletion RPCs
On a database provisioned from this repository's migrations, every deletion attempt stops at this mandatory preview because preview_account_deletion is not defined anywhere in the tree. The new G028 migration similarly calls an absent begin_account_deletion_apply function (its test even states that G014 must already exist), while this commit removes the prior direct deletion implementation. Include the prerequisite migration/worker RPCs so fresh and test deployments do not return account_deletion_preview_not_available for every user.
Useful? React with 👍 / 👎.
| # [PERF] 안전 타임아웃: 최대 90분 (월 3000분 한도 보호) | ||
| timeout-minutes: 90 | ||
| if: ${{ github.event_name != 'workflow_dispatch' || github.ref_name == github.event.repository.default_branch }} | ||
| if: ${{ (github.event_name != 'workflow_dispatch' || github.ref_name == github.event.repository.default_branch) && vars.G037_WRITE_FREEZE != 'active' }} |
There was a problem hiding this comment.
Apply the write freeze to every scheduled writer
When G037_WRITE_FREEZE is set to active, this guard stops only the daily crawler and the GDrive backfill. I also checked .github/workflows/restaurant-refresh-cron.yml, whose scheduled non-dry-run path passes --allow-db-write with the Supabase service-role key, and .github/workflows/youtube-kpi-snapshot.yml, whose scheduled capture writes snapshots with the same key; neither job checks the freeze variable. Those production writes therefore continue during a declared repository-wide freeze, so add the admission guard to the remaining scheduled writer jobs as well.
Useful? React with 👍 / 👎.
| const privacyHashKey = process.env.PRIVACY_AUDIT_HASH_KEY?.trim(); | ||
| if ( | ||
| process.env.VERCEL !== '1' | ||
| || !privacyHashKey | ||
| || Buffer.byteLength(privacyHashKey, 'utf8') < 32 | ||
| ) { | ||
| return 'unknown'; |
There was a problem hiding this comment.
Configure the hash key before enforcing the client quota
In a Vercel deployment without the newly referenced PRIVACY_AUDIT_HASH_KEY, every request is assigned to the same unknown bucket. The new database policy limits that bucket to 20 requests per minute, so the 21st shortening request across the entire deployment rate-limits every client even though the intended global ceiling is 200. A repository-wide search finds this variable only here and in a source test—not in .env.example or deployment configuration—so provision and document the key, or avoid applying the per-client ceiling to the shared fallback bucket.
Useful? React with 👍 / 👎.
Summary
Verification
bun run test:unit: 1218 passedpython3 -m unittest backend.utils.tests.test_run_daily_regression backend.pipeline.test_data_contracts_unittest backend.pipeline.test_validators_unittest: 85 passedBackup
Production backup remains encrypted outside the repository; no credentials or data are included in this PR.