Skip to content

perf(people): what making newsletter-only senders bots costs cli-core's people list - #414

Merged
leemour merged 1 commit into
mainfrom
perf/newsletter-bots
Nov 25, 2026
Merged

leemour merged 1 commit into
mainfrom
perf/newsletter-bots

Conversation

@leemour

@leemour leemour commented Nov 25, 2026

Copy link
Copy Markdown
Member

Measures cli-core feat/newsletter-bots (owner's ruling of 2026-11-25: a sender of a newsletter only is a bot). Page: performance/people/newsletter-bots/README.md, linked from performance/people/README.md.

Headline numbers, 20,000 synthetic newsletter senders and 20,000 humans, machine at load 15 to 52:

  • the give-back check under the write lock on each kept list: 31–51 ms;
  • the first people list: 3.2–13 s (one 91 s outlier at load 48);
  • warm pages under 40 ms.

🤖 Generated with Claude Code

…'s people list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leemour added a commit to WireCatLabs/cli-core that referenced this pull request Nov 25, 2026
…too (#3370)

## Task
Owner's ruling of 2026-11-25 (contact-kinds plan, #3323, "The model"): a
sender who only sends a newsletter is a bot, even when a human writes
it. This replaces the rule of #3339/#3356, which kept a human-written
newsletter as a person with reach `broadcast`.

## What changed
- **The rule.** A person becomes a bot with reason `newsletter-only` on
the next people list when all of these hold:
- all their mail came from a list: List-Id, List-Unsubscribe, one-click
unsubscribe, Feedback-ID, bulk `Precedence`, or the bulk box;
- they have no tie (chat, mail from the owner, meeting, CRM, phone book,
task);
  - they have no messenger identity and no two-way chat;
- none of their mail came through a discussion list (3+ senders on a
List-Id).

`kindSignals` names `newsletter-only`. `KIND_RULES` 9 → 10, so every
kind is worked out again once.
- **Give-back.** #3356 gives a rule's bot back once the owner writes to
it. A newsletter bot now also goes back once a 1-to-1 mail comes from
it: no list headers, not in the bulk box, 1 to `SMALL_GROUP_MEMBERS` in
To and Cc. No trigger makes a kind stale for such a mail. So
`storeKinds` checks the mail added since the last check (email id
watermark in `store_settings`) and runs the give-back when a newsletter
bot sent some. No migration.
- **Mail types.** A newsletter bot is not a program for `mailTypeOf`.
Its mail stays `newsletter` and is not turned into `promotion`. After a
give-back, only the newsletter mail keeps reach `broadcast`.
- **The owner's choice wins.** `moveToPerson` / `moveToBot`, and the
sorting rules of #3366 that go through them, win over the rule.

## Judgment calls
- **Bcc mail alone does not count.** Mail with no recipients (Bcc,
undisclosed recipients) has per-mail reach `broadcast`, but it does not
count as list mail here. One Bcc from a human would otherwise make them
a bot.
- **Any tie keeps a person.** The ruling defines a direct exchange
narrowly, but a phone-book entry or a meeting also keeps the sender a
person.
- **Only newsletter bots go back after a 1-to-1 mail.** A no-reply bot
sends 1-to-1 transactional mail all the time, so it does not.
- **Header trust.** List-Id, List-Unsubscribe and Precedence are stored
without the DKIM check that `List-Unsubscribe-Post` and `Feedback-ID`
get. A forged List-Id can make a human with no tie a bot, until a reply
or a 1-to-1 mail gives them back.

## Testing
- New `src/store/newsletter-bots.test.ts`, through `syncMail` with a
fake source:
- a sender with no exchange becomes a bot, and its mail stays
`newsletter`;
- after the owner replies, the bot goes back to a person; reach is
`direct`, and only the newsletter mail keeps `broadcast`;
  - a 1-to-1 mail alone gives the bot back;
- a person the owner writes to who also sends a newsletter stays a
person, and so do a discussion list's members;
  - the owner's `moveToPerson` wins.
- `people-list.test.ts`: in the bulk-box test, the sender now has one
mail outside the bulk box. All of it in the bulk box would make her a
bot.
- Full suite passed locally. Typecheck, biome and `docs:check` pass.
- Timing on 20,000 synthetic newsletter senders + 20,000 humans, machine
at load 15 to 52 (WireCatLabs/cli-testing#414):
  - the give-back check under the write lock: 31–51 ms per kept list;
  - the first people list: 3.2–13 s (one 91 s outlier at load 48);
  - warm pages under 40 ms.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit 9967034 into main Nov 25, 2026
1 check passed
@leemour
leemour deleted the perf/newsletter-bots branch November 25, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant