Repository navigation
Phase P1: mail categories, storage and migration - #2270
Merged
neuromechanist merged 11 commits intoNov 21, 2026
Merged
neuromechanist merged 11 commits into
neuromechanist merged 11 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2270Version: 🤖 Updated on each push. |
2 of 3 tasks
neuromechanist
merged commit Nov 21, 2026
d912386
into
feature/issue-2260-epic-mail-categories
29 of 31 checks passed
This was referenced Nov 21, 2026
Merged
This branch was previously deployed
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 #2261. Part of epic #2260.
Phase P1 declares the community mail categories once (
news,rfcs,maintenance,recall) inshared/contract/mail-categories.ts, with their labels as account copy, and stores the three switchable ones inusers.email_preferences. A recall has no stored key and no setter; preference responses report it as{on: true, locked: true}and any request namingrecallis refused by name.Migration 0146 carries each live account's
announcementsvalue intonews,rfcsandmaintenanceexplicitly and keeps theannouncementskey unchanged so the previous worker still honors opt-outs in the deploy window (phase P3 removes it); only strict JSONfalseis an opt-out, as the parser reads every key. It writes one summary audit row only when some account had stored preferences, so fresh test databases gain no audit row. It also addscategory,recall_referenceandskipped_counttobroadcast_emailsand rebuildsbroadcast_outcomesso it accepts askippedoutcome, which counts towarddone.The admin alerts are now their own type, and
getAdminEmailsForCategoryaccepts only those, so no community category can reach its first-admin fallback.communityRecipientsinmail-recipients.tsis the one place a categorized send selects people (audiences per the owner's D3, neverpending,test, deleted or the system account).saveEmailPreferenceswrites only the changed keys as a per-keyjson_setand onemail_category_changedaudit row per community category whose stored value actually changes, in the same batch, so a concurrent write to another key is never reverted.Owner answers applied (2026-11-20): news is on by default with opt-out (D1); owners and admins may turn a community category on or off for another account, audited, while another account's admin alerts stay the owner's (D8).
nemar admin email-preferencesgains--news,--rfcsand--maintenance;--announcementsis refused with the replacement flags. ADR 0132 records the decisions (0130 and 0131 are reserved by the RFC program and biosig branches, sotest/adr-index.unit.test.tstolerates those two gaps until they land).Deviations from the plan: the uncategorized group send keeps working through
getBroadcastRecipients, now requiring all three categories on, until P3 makescategoryrequired and retires it; a newservices/mail-preferences.tsholds the audited writer so P4 and P2 reuse it; the plan's "turn off only"?user=rule is replaced by D8.Website follow-up, not in this PR: the nine new
mail.*account-copy keys must be transcribed tonemarOrg/websitesrc/lib/account-copy.tsonstaging(ADR 0045), andtest/account-copy-parity.test.tsin theunit-purejob stays red until that lands; the keys aremail.category.{news,rfcs,maintenance,recall}.{label,description}andmail.recall.why, values inshared/contract/account-copy.ts.Tested:
bun run typecheckandbun run lintclean; targeted tests pass (110 in the new and changed files, 384 across the neighbors named in the plan);bun run migrations:d1-checkpasses on real local D1, and the migration's seeded cases were replayed on local D1 through cfman wrangler with the same results as the bun:sqlite test. Not run: the fullbun test(epic to dev gate) andtest/account-copy-parity.test.tsagainst an updated website, because the website copy is not transcribed yet.