fix(invariants): the email-handle floor is zero now, because they are all retired - #780
Merged
Conversation
… all retired The ratchet was set to 77 — a live population that could not simply be renamed, because a username on OrangeCat is also a Lightning address and a public profile URL. scripts/rename-email-derived-usernames.sql retired every one of them on production, behind profile_username_history so nothing that pointed at an old handle broke: INSERT 0 53 history rows recorded first UPDATE 53 handles replaced with user_<12 hex> UPDATE 14 display names that were also the email local part cleared Verified against production afterwards, not assumed: email_derived_remaining 0 name_eq_localpart_remaining 0 history_rows 54, none orphaned count_email_derived_usernames() 0 And end to end on a real retired handle: the old profile URL returns 308 to the new one, and the LNURL endpoint resolves the owner through history (it answers under the NEW handle, which is what proves the lookup found the right account). The count of 53 rather than the 77 originally measured is test-account churn between the two readings — the population moved 108 -> 96 profiles while E2E accounts were created and deleted, and 16 accounts had already signed up under the fixed trigger. So the constant becomes 0 and stops being a ratchet. A violation now means a write path started minting them again; the three that used to — the handle_new_user trigger, ensureProfile(), and two profile form pre-fills — are each covered by a test, so a hit here means a fourth was added. The message says that instead of talking about a baseline that no longer exists. npm run verify green; 2385 tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The ratchet was set to 77 — a live population that could not simply be
renamed, because a username on OrangeCat is also a Lightning address and a
public profile URL.
They are now all retired, behind
profile_username_historyso nothing thatpointed at an old handle broke:
Verified against production, not assumed
username = split_part(email,'@',1)name = split_part(email,'@',1)profile_username_historyrowscount_email_derived_usernames()And end to end on a real retired handle:
That last detail is the proof: the LNURL endpoint replies about
user_a3eaa53c23cdwhen asked about the old handle, so the history lookup foundthe right account.
Why 53 and not 77
Test-account churn between readings — the population moved 108 → 96 profiles
while E2E accounts were created and deleted, and 16 accounts had already signed
up under the fixed trigger. Every remaining one was renamed.
The constant stops being a ratchet
A violation now means a write path started minting them again. The three that
used to — the
handle_new_usertrigger,ensureProfile(), and two profile formpre-fills — are each covered by a test, so a hit here means a fourth was
added. The message says that, instead of talking about a baseline that no longer
exists.
npm run verifygreen; 2385 tests pass.