Repository navigation
Repair a missing profile, and don't say "Profile saved" when nothing was saved - #55
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtKM4TZ917FEo7VwVUDwjU
✅ Deploy Preview for swim-events ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BtKM4TZ917FEo7VwVUDwjU
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.
During testing on 28 Nov, a sign-in user existed without a profile row: the profile had been deleted by hand, but the account was kept. Saving the name and organisation then updated nothing, yet the page said "Profile saved."
Changes
public.ensure_profile()(supabase/migrations/20261128000000_ensure_profile.sql). It's security definer and callable by signed-in users only. It creates the caller's own profile with the default values if it's missing, and does nothing otherwise.levelandblockedstay out of users' reach, andanoncan't call it.loadProfile()(src/lib/auth.ts) callsensure_profile()when no profile is found, then loads the profile again. This covers the account and submit pages. Normal accounts never make the call.supabase/tests/database/ensure_profile.test.sqlchecks that anon is refused, that a deleted profile comes back with the defaults, and that a repeat call changes nothing.Tested
authschema:anongets "permission denied".level = standardandblocked = false.astro check, eslint and prettier pass.Deploy order
Apply the migration to Supabase before or together with the merge. Without it, only the rare missing-profile case would show the "couldn't load" notice instead of repairing itself.
Test on live after merging
🤖 Generated with Claude Code
https://claude.ai/code/session_01BtKM4TZ917FEo7VwVUDwjU