mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-21 16:06:35 +00:00
feat: give Google, Microsoft, Yahoo and other providers an equal share of warmup recipients before splitting by mail host in pickWeightedPartner, and show counts with one square per receipt instead of placement shares below 10 classified receipts in the warmup provider breakdown and receipt cells
This commit is contained in:
@@ -93,6 +93,8 @@ Warmup's non-spam share includes inbox and category tabs among classified receip
|
||||
|
||||
Metric metadata specifies the population, numerator, denominator, missingness, unit, source, and classification policy. Warmup reports include their date range; the headline rate uses a seven-day window. The optional 95% Wilson interval assumes independent observations. Repeated mailboxes, seeds, routes, and timing violate that assumption, so this interval is not an efficacy claim or calibrated real-recipient inbox probability.
|
||||
|
||||
In the dashboard, a provider, a mail host or a window with fewer than 10 classified warmup receipts shows its counts instead of a share, and its bar draws one square per receipt, because one email moves a share that small by 10 points or more. The API still returns every rate.
|
||||
|
||||
Google, Microsoft, and Yahoo family totals are not interchangeable with their consumer and business services. Inspect the host-level breakdown when Gmail versus Google Workspace or Outlook.com versus Microsoft 365 matters. Hosts that cannot be distinguished remain unknown. Pool placement, organic recipient activity, opens, bounces, and complaints stay separate. A **rescue request** is an action attempt, not confirmed movement or proof that reputation recovered.
|
||||
|
||||
</Fold>
|
||||
|
||||
@@ -161,7 +161,7 @@ Outside-workspace partners broaden observations; unlinked self-hosted instances
|
||||
|
||||
Within that order, partners are picked by weight rather than at random. Three things move the weight:
|
||||
|
||||
- **Host and domain coverage.** Eligible mail hosts start with balanced total weight, so a host with many custom domains does not crowd out a consumer host sharing one domain, such as Gmail. Recently used domains are downweighted within each host; partner no-repeat rules and daily receiving caps still apply. Gmail and Google Workspace are distinct hosts, as are Outlook.com and Microsoft 365.
|
||||
- **Provider, host and domain coverage.** Google, Microsoft, Yahoo and other providers each start with an equal share of new threads, whatever number of smaller hosts the pool holds, so a long tail of small hosts cannot crowd out the providers your prospects use. Within a provider, each mail host starts with an equal share, so a host with many custom domains does not crowd out a consumer host sharing one domain, such as Gmail. Recently used domains are downweighted within each host; partner no-repeat rules and daily receiving caps still apply. Gmail and Google Workspace are distinct hosts, as are Outlook.com and Microsoft 365.
|
||||
- **Where you are landing.** Warmbly tracks your spam-placement rate separately for each recipient mail host over the last seven days: who actually runs that recipient's mail (Google Workspace, Microsoft 365, Zoho Mail, Hostinger and so on), read from the partner's mail servers rather than its address, so two custom domains on different hosts are judged apart. A mailbox landing in spam at one host but not the others is sent fewer partners on that host until the rate falls, without waiting for an overall health band to trip. A free Gmail or Outlook.com mailbox works the other way at Google, Microsoft and Yahoo: it is sent more partners where it lands in spam (up to twice as many), because the pool rescues its mail at the [recovery](#recovery-engagement) rate and that rescue is what repairs its standing with that provider. Other hosts still get fewer.
|
||||
- **Your routing rules**, when you have configured any. A rule's weight multiplies a partner's chance; a weight of `0` is not a weight but an exclusion, so that pairing never happens.
|
||||
|
||||
|
||||
@@ -869,10 +869,17 @@ func pickWeightedPartner(candidates []uuid.UUID, sig partnerSignals) uuid.UUID {
|
||||
|
||||
weights := make([]float64, len(candidates))
|
||||
hostTotals := make(map[string]float64)
|
||||
// Normalize only the coverage base; quality and customer rules still change host share.
|
||||
groupHosts := make(map[string]map[string]struct{})
|
||||
// Normalize only the coverage base (equal per provider group, then per host
|
||||
// within it); quality and customer rules still change the shares.
|
||||
for _, id := range candidates {
|
||||
if host := sig.hostsByID[id]; host != "" {
|
||||
hostTotals[host] += 1.0 / float64(1+sig.domainCounts[sig.domainsByID[id]])
|
||||
group := models.WarmupRecipientGroup(host, "")
|
||||
if groupHosts[group] == nil {
|
||||
groupHosts[group] = make(map[string]struct{})
|
||||
}
|
||||
groupHosts[group][host] = struct{}{}
|
||||
}
|
||||
}
|
||||
var total float64
|
||||
@@ -880,8 +887,9 @@ func pickWeightedPartner(candidates []uuid.UUID, sig partnerSignals) uuid.UUID {
|
||||
domain := sig.domainsByID[id]
|
||||
// Diversity base weight.
|
||||
w := 1.0 / float64(1+sig.domainCounts[domain])
|
||||
if hostTotal := hostTotals[sig.hostsByID[id]]; hostTotal > 0 {
|
||||
w /= hostTotal
|
||||
host := sig.hostsByID[id]
|
||||
if hostTotal := hostTotals[host]; hostTotal > 0 {
|
||||
w /= hostTotal * float64(len(groupHosts[models.WarmupRecipientGroup(host, "")]))
|
||||
}
|
||||
|
||||
// Per-host placement feedback.
|
||||
|
||||
@@ -67,6 +67,32 @@ func TestPickWeightedPartnerRetainsDomainDiversityWithinAHost(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A long tail of small hosts shares one provider group's weight, so it cannot outvote Google and Microsoft.
|
||||
func TestPickWeightedPartnerBalancesProviderGroupsBeforeHosts(t *testing.T) {
|
||||
google, microsoft := uuid.New(), uuid.New()
|
||||
candidates := []uuid.UUID{google, microsoft}
|
||||
sig := partnerSignals{
|
||||
domainsByID: map[uuid.UUID]string{google: "g.test", microsoft: "m.test"},
|
||||
hostsByID: map[uuid.UUID]string{google: "google_workspace", microsoft: "microsoft365"},
|
||||
}
|
||||
for i, host := range []string{"other", "ionos", "zoho", "ovh", "hostinger", "rackspace"} {
|
||||
id := uuid.New()
|
||||
candidates = append(candidates, id)
|
||||
sig.domainsByID[id] = fmt.Sprintf("small-%d.test", i)
|
||||
sig.hostsByID[id] = host
|
||||
}
|
||||
groups := map[string]int{}
|
||||
for range 6000 {
|
||||
host := sig.hostsByID[pickWeightedPartner(candidates, sig)]
|
||||
groups[models.WarmupRecipientGroup(host, "")]++
|
||||
}
|
||||
for _, group := range []string{models.WarmupRecipientGoogle, models.WarmupRecipientMicrosoft, models.WarmupRecipientOther} {
|
||||
if got := groups[group]; got < 1700 || got > 2300 {
|
||||
t.Errorf("%s drawn %d/6000, want about a third: %v", group, got, groups)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPickWeightedPartner_FallsBackToUniformWithoutDomains(t *testing.T) {
|
||||
a := uuid.New()
|
||||
b := uuid.New()
|
||||
|
||||
@@ -23,6 +23,8 @@ import {
|
||||
otherHostsNote,
|
||||
rateSentence,
|
||||
rescueSummary,
|
||||
sampledShare,
|
||||
shareWithheld,
|
||||
totals,
|
||||
utcWindow,
|
||||
viewDays,
|
||||
@@ -84,6 +86,8 @@ export default function MailboxPlacementTab({ mailboxId, poolHealth }: { mailbox
|
||||
const everDelivered = (report.summary.observed_receipts ?? report.summary.delivered) > 0 || rate.delivered > 0;
|
||||
const filtered = activeGroup !== "all";
|
||||
const otherNote = otherHostsNote(rate);
|
||||
const share = sampledShare(t.inboxRate, t.delivered);
|
||||
const spamShare = sampledShare(t.spamRate, t.delivered);
|
||||
|
||||
return (
|
||||
<div className="divide-y divide-slate-200/60">
|
||||
@@ -149,8 +153,8 @@ export default function MailboxPlacementTab({ mailboxId, poolHealth }: { mailbox
|
||||
{/* Window counts, narrowed by the provider filter */}
|
||||
<div className="grid grid-cols-3 divide-x divide-y divide-slate-200/60 [&>*:nth-child(-n+3)]:border-t-0">
|
||||
<Cell label="Classified receipts" value={fmtNum(t.delivered)} sub={filtered ? `at ${GROUP_LABEL[activeGroup]}` : `of ${fmtNum(t.sent)} submissions`} />
|
||||
<Cell label="Non-spam share" value={fmtPct(t.inboxRate)} sub={`${fmtNum(t.inbox)} primary inbox`} tone={BAND[bandForRate(t.inboxRate)].text} />
|
||||
<Cell label="Spam" value={fmtNum(t.spam)} sub={t.spamRate != null ? `${fmtPct(t.spamRate)} of classified receipts` : "no classified receipts"} tone={t.spam > 0 ? "text-rose-600" : undefined} />
|
||||
<Cell label="Non-spam share" value={fmtPct(share)} sub={share != null ? `${fmtNum(t.inbox)} primary inbox` : shareWithheld(t.delivered)} tone={BAND[bandForRate(share)].text} />
|
||||
<Cell label="Spam" value={fmtNum(t.spam)} sub={spamShare != null ? `${fmtPct(spamShare)} of classified receipts` : shareWithheld(t.delivered)} tone={t.spam > 0 ? "text-rose-600" : undefined} />
|
||||
<Cell label="Other tabs" value={fmtNum(t.tabs)} sub="Promotions, Updates…" />
|
||||
<Cell label="Confirmed out of spam" value={fmtNum(t.rescueConfirmed)} sub={rescueSummary(t)} wrap tone={t.rescueConfirmed > 0 ? "text-emerald-600" : undefined} />
|
||||
<Cell
|
||||
|
||||
@@ -38,3 +38,26 @@ describe("provider expansion browse persistence", () => {
|
||||
expect(screen.getByRole("button")).toHaveAttribute("aria-expanded", "false");
|
||||
});
|
||||
});
|
||||
|
||||
describe("provider rows below the share floor", () => {
|
||||
beforeEach(() => {
|
||||
sessionStorage.clear();
|
||||
useAppStore.setState({ currentOrganization: { id: "workspace", name: "Workspace", role: "owner" } });
|
||||
});
|
||||
|
||||
it("shows counts, not a 50% spam share, for two receipts", () => {
|
||||
const two = { ...counts, sent: 2, delivered: 2, inbox: 1, spam: 1, inbox_rate: 50, spam_rate: 50 };
|
||||
const profile = { user: { id: "account-user" } } as ComponentProps<typeof UserContext.Provider>["value"];
|
||||
render(<UserContext.Provider value={profile}><ProviderBreakdown browseScope="x" providers={[{ ...two, group: "google", hosts: [] }]} /></UserContext.Provider>);
|
||||
expect(screen.queryByText(/50%/)).toBeNull();
|
||||
expect(screen.getByText("1 spam")).toBeInTheDocument();
|
||||
expect(screen.getByText("1 inbox")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows shares once the floor is met", () => {
|
||||
const profile = { user: { id: "account-user" } } as ComponentProps<typeof UserContext.Provider>["value"];
|
||||
render(<UserContext.Provider value={profile}><ProviderBreakdown browseScope="y" providers={[{ ...counts, group: "google", hosts: [] }]} /></UserContext.Provider>);
|
||||
expect(screen.getByText("80%")).toBeInTheDocument();
|
||||
expect(screen.getByText("20% spam")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import ProviderLogo from "@/components/app/emails/ProviderLogo";
|
||||
import { mailHostLabel } from "@/lib/mailHost";
|
||||
import ScrollStrip from "@/components/ui/scroll-strip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { PlacementGroup, PlacementProvider, PlacementRate } from "@/lib/api/models/app/analytics/WarmupPlacement";
|
||||
import type { PlacementCounts, PlacementGroup, PlacementProvider, PlacementRate } from "@/lib/api/models/app/analytics/WarmupPlacement";
|
||||
import {
|
||||
BAND,
|
||||
GROUP_LABEL,
|
||||
@@ -23,7 +23,9 @@ import {
|
||||
fmtPct,
|
||||
observedCount,
|
||||
rateSentence,
|
||||
sampledShare,
|
||||
shortDate,
|
||||
SHARE_MIN_SAMPLE,
|
||||
type DayView,
|
||||
type GroupFilter,
|
||||
type RangeKey,
|
||||
@@ -324,16 +326,16 @@ export function ProviderBreakdown({ providers, browseScope }: { providers: Place
|
||||
<ChevronRightIcon className={cn("w-3 h-3 shrink-0 text-slate-300 transition-transform", expanded && "rotate-90", !canExpand && "invisible")} />,
|
||||
<ProviderLogo id={GROUP_LOGO[p.group]} size="sm" />,
|
||||
<span className="text-[12.5px] font-medium text-slate-900 w-24 sm:w-32 shrink-0 truncate">{GROUP_LABEL[p.group]}</span>,
|
||||
<PlacementBar inbox={p.inbox} tabs={p.tabs} spam={p.spam} unknown={p.unknown} archived={p.archived} custom={p.custom} />,
|
||||
<RateCells inbox={p.inbox_rate} spam={p.spam_rate} delivered={p.delivered} />,
|
||||
<PlacementBar counts={p} />,
|
||||
<RateCells counts={p} />,
|
||||
)}
|
||||
{expanded && (
|
||||
<div className="bg-slate-50/50 divide-y divide-slate-200/40">
|
||||
{hosts.map((h) => (
|
||||
<div key={h.host || "unknown"} className="min-h-9 pl-14 pr-5 py-1.5 flex items-center gap-3">
|
||||
<span className="text-[11.5px] text-slate-600 w-24 sm:w-32 shrink-0 truncate">{mailHostLabel(h.host) || "Host not detected"}</span>
|
||||
<PlacementBar inbox={h.inbox} tabs={h.tabs} spam={h.spam} unknown={h.unknown} archived={h.archived} custom={h.custom} height={4} />
|
||||
<RateCells inbox={h.inbox_rate} spam={h.spam_rate} delivered={h.delivered} />
|
||||
<PlacementBar counts={h} height={4} />
|
||||
<RateCells counts={h} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -345,9 +347,22 @@ export function ProviderBreakdown({ providers, browseScope }: { providers: Place
|
||||
);
|
||||
}
|
||||
|
||||
function PlacementBar({ inbox, tabs, spam, unknown, archived, custom, height = 6 }: { inbox: number; tabs: number; spam: number; unknown?: number; archived?: number; custom?: number; height?: number }) {
|
||||
// Below the share floor each receipt is its own square, with empty ones up to the floor, so two emails read as two emails.
|
||||
function PlacementBar({ counts, height = 6 }: { counts: PlacementCounts; height?: number }) {
|
||||
const { inbox, tabs, spam, unknown, archived, custom } = counts;
|
||||
const total = Math.max(1, inbox + tabs + spam + (unknown ?? 0) + (archived ?? 0) + (custom ?? 0));
|
||||
const title = `${inbox} inbox · ${tabs} other tabs · ${spam} spam` + (unknown != null ? ` · ${unknown} unknown · ${archived} archive · ${custom} custom` : " · unclassified evidence unavailable");
|
||||
if (counts.delivered < SHARE_MIN_SAMPLE) {
|
||||
const filled = LANDED.flatMap((l) => Array<string>(counts[l.key] ?? 0).fill(l.dot)).slice(0, SHARE_MIN_SAMPLE);
|
||||
const slots = [...filled, ...Array<string>(SHARE_MIN_SAMPLE - filled.length).fill("bg-slate-100")];
|
||||
return (
|
||||
<div className="flex-1 min-w-12 flex items-center gap-[3px]" title={`${title}. A share is shown after ${SHARE_MIN_SAMPLE} classified receipts.`}>
|
||||
{slots.map((dot, i) => (
|
||||
<span key={i} className={cn("flex-1 max-w-3 rounded-[1px]", dot)} style={{ height }} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="flex-1 min-w-12" title={title}>
|
||||
<DitherStack
|
||||
@@ -365,7 +380,21 @@ function PlacementBar({ inbox, tabs, spam, unknown, archived, custom, height = 6
|
||||
);
|
||||
}
|
||||
|
||||
function RateCells({ inbox, spam, delivered }: { inbox: number | null; spam: number | null; delivered: number }) {
|
||||
// Counts, not shares, until a share means something.
|
||||
function RateCells({ counts }: { counts: PlacementCounts }) {
|
||||
const { delivered } = counts;
|
||||
const inbox = sampledShare(counts.inbox_rate, delivered);
|
||||
const spam = sampledShare(counts.spam_rate, delivered);
|
||||
if (inbox == null || spam == null) {
|
||||
const note = `Shares are shown after ${SHARE_MIN_SAMPLE} classified receipts`;
|
||||
return (
|
||||
<span className="flex items-center gap-2 sm:gap-3 font-mono text-[11px] tabular-nums shrink-0 text-slate-500">
|
||||
<span title={note}>{fmtNum(counts.inbox + counts.tabs)} inbox</span>
|
||||
<span title={note} className="hidden sm:inline w-12 text-right">{fmtNum(counts.spam)} spam</span>
|
||||
<span title="Classified receipts" className="text-slate-400 w-10 text-right">{fmtNum(delivered)}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className="flex items-center gap-2 sm:gap-3 font-mono text-[11px] tabular-nums shrink-0">
|
||||
<span title="Non-spam share among classified receipts (includes tabs)" className={BAND[bandForRate(inbox)].text}>{fmtPct(inbox)}</span>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { EmptyBlock, SectionBar, Stat, StatStrip } from "@/components/layout/Pag
|
||||
import useWarmupPlacement from "@/lib/api/hooks/app/analytics/useWarmupPlacement";
|
||||
import type { PlacementGroup, PlacementMailbox } from "@/lib/api/models/app/analytics/WarmupPlacement";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { BAND, GROUP_LABEL, GROUP_ORDER, bandForRate, fmtNum, fmtPct, otherHostsNote, rateSentence, totals, utcWindow, viewDays, type GroupFilter } from "./placement";
|
||||
import { BAND, GROUP_LABEL, GROUP_ORDER, bandForRate, fmtNum, fmtPct, otherHostsNote, rateSentence, sampledShare, shareWithheld, totals, utcWindow, viewDays, type GroupFilter } from "./placement";
|
||||
import {
|
||||
BandChip,
|
||||
GroupFilterChips,
|
||||
@@ -72,6 +72,8 @@ export default function WarmupPlacementSection({ days }: { days: number }) {
|
||||
|
||||
const rate = report.rate;
|
||||
const filtered = activeGroup !== "all";
|
||||
const share = sampledShare(t.inboxRate, t.delivered);
|
||||
const spamShare = sampledShare(t.spamRate, t.delivered);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -87,14 +89,14 @@ export default function WarmupPlacementSection({ days }: { days: number }) {
|
||||
/>
|
||||
<Stat
|
||||
label="Non-spam share · window"
|
||||
value={<span className={BAND[bandForRate(t.inboxRate)].text}>{fmtPct(t.inboxRate)}</span>}
|
||||
sub={filtered ? `at ${GROUP_LABEL[activeGroup]}` : `${fmtNum(t.inbox)} primary · ${fmtNum(t.tabs)} tabs`}
|
||||
value={<span className={BAND[bandForRate(share)].text}>{fmtPct(share)}</span>}
|
||||
sub={share == null ? shareWithheld(t.delivered) : filtered ? `at ${GROUP_LABEL[activeGroup]}` : `${fmtNum(t.inbox)} primary · ${fmtNum(t.tabs)} tabs`}
|
||||
/>
|
||||
<Stat label="Classified receipts" value={t.delivered} sub={filtered ? "sends are not split by provider" : `of ${fmtNum(t.sent)} submissions`} />
|
||||
<Stat
|
||||
label="Spam"
|
||||
value={<span className={t.spam > 0 ? "text-rose-600" : undefined}>{fmtNum(t.spam)}</span>}
|
||||
sub={`${fmtPct(t.spamRate)} · ${fmtNum(t.rescueConfirmed)} of ${fmtNum(t.rescued)} confirmed out of spam`}
|
||||
sub={`${spamShare != null ? fmtPct(spamShare) : shareWithheld(t.delivered)} · ${fmtNum(t.rescueConfirmed)} of ${fmtNum(t.rescued)} confirmed out of spam`}
|
||||
/>
|
||||
<Stat label="Unconfirmed" value={filtered ? "—" : t.unconfirmed} sub="sent 24h+ ago, not seen yet" last />
|
||||
</StatStrip>
|
||||
|
||||
@@ -53,6 +53,19 @@ export const BAND: Record<PlacementBand, BandStyle> = {
|
||||
none: { label: "No classified receipts", text: "text-slate-400", dot: "bg-slate-200", chip: "bg-slate-50 text-slate-500 border-slate-200", tone: "slate" },
|
||||
};
|
||||
|
||||
// Below this many classified receipts one email moves a share by 10+ points, so counts are shown instead.
|
||||
export const SHARE_MIN_SAMPLE = 10;
|
||||
|
||||
/** A share over `delivered` classified receipts, or null below SHARE_MIN_SAMPLE. */
|
||||
export function sampledShare(rate: number | null | undefined, delivered: number): number | null {
|
||||
return rate != null && delivered >= SHARE_MIN_SAMPLE ? rate : null;
|
||||
}
|
||||
|
||||
/** What a withheld share says instead: how many receipts are in and how many it needs. */
|
||||
export function shareWithheld(delivered: number): string {
|
||||
return delivered === 0 ? "no classified receipts" : `${fmtNum(delivered)} of ${SHARE_MIN_SAMPLE} receipts for a share`;
|
||||
}
|
||||
|
||||
// Same thresholds as the backend bands, for per-day and per-provider rates.
|
||||
export function bandForRate(rate: number | null | undefined): PlacementBand {
|
||||
if (rate == null) return "none";
|
||||
|
||||
Reference in New Issue
Block a user