unmapped backers: a plain donation is not a member finding
ci/woodpecker/push/woodpecker Pipeline was canceled
ci/woodpecker/push/woodpecker Pipeline was canceled
A no-tier BACKER is only a member when it predates the tier system (LEGACY_NO_TIER_BEFORE). Treating every no-tier BACKER as memberish made the $75 Workers.VC donation mail info@ as a paid contributor with no account. Mirror fetch_members() exactly; donations stay silent, and only unattached credit packs keep the hold-and-notify path.
This commit is contained in:
1 parent
ac39740acb
commit
b761136dd9
2 files changed
+35
-7
No files matched your search
+18
-2
@@ -9087,12 +9087,28 @@ UNMAPPED_BACKERS_MARKER = "unmapped_backers_fingerprint"
|
|||||||
|
|
||||||
|
|
||||||
def _oc_memberish(node: dict) -> bool:
|
def _oc_memberish(node: dict) -> bool:
|
||||||
"""Mirror fetch_members()'s member definition (ADMIN, or Membership/legacy tier)."""
|
"""Mirror fetch_members()'s member definition exactly.
|
||||||
|
|
||||||
|
ADMIN, a BACKER on the Membership tier, or a LEGACY no-tier BACKER who
|
||||||
|
joined before LEGACY_NO_TIER_BEFORE. A no-tier BACKER who joined after that
|
||||||
|
cutoff is a plain DONATION: OC grants BACKER role for any one-time
|
||||||
|
contribution, but a donation is not a membership and has no account to
|
||||||
|
provision. Treating every no-tier BACKER as memberish made a $75 donation
|
||||||
|
from Workers.vc (2026-11-21) mail info@ as "a paid contributor with no
|
||||||
|
account" — a notice about a missing account that was never supposed to
|
||||||
|
exist. Only unattached credit packs keep a hold-and-notify path; a donation
|
||||||
|
is silent.
|
||||||
|
"""
|
||||||
role = node.get("role") or ""
|
role = node.get("role") or ""
|
||||||
if role not in ("BACKER", "ADMIN"):
|
if role not in ("BACKER", "ADMIN"):
|
||||||
return False
|
return False
|
||||||
|
if role == "ADMIN":
|
||||||
|
return True
|
||||||
tier = (((node.get("tier") or {}) or {}).get("name") or "").strip()
|
tier = (((node.get("tier") or {}) or {}).get("name") or "").strip()
|
||||||
return role == "ADMIN" or not tier or "membership" in tier.lower()
|
if "membership" in tier.lower():
|
||||||
|
return True
|
||||||
|
joined = (node.get("createdAt") or "")[:10]
|
||||||
|
return bool(joined) and joined < LEGACY_NO_TIER_BEFORE
|
||||||
|
|
||||||
|
|
||||||
async def reconcile_unmapped_backers(notify: bool = True) -> dict:
|
async def reconcile_unmapped_backers(notify: bool = True) -> dict:
|
||||||
|
|||||||
@@ -107,6 +107,14 @@ async def main():
|
|||||||
node("ADMIN", "Membership", "adminco", "admin@x.org", name="Co-op"),
|
node("ADMIN", "Membership", "adminco", "admin@x.org", name="Co-op"),
|
||||||
# NOT a member: a credit-pack-only BACKER takes the held-credits path
|
# NOT a member: a credit-pack-only BACKER takes the held-credits path
|
||||||
node("BACKER", "Credit pack", "packbuyer", "pack@x.org", name="Pack Buyer"),
|
node("BACKER", "Credit pack", "packbuyer", "pack@x.org", name="Pack Buyer"),
|
||||||
|
# NOT a member: a plain DONATION (no tier, joined after the legacy cutoff).
|
||||||
|
# OC grants BACKER role for any one-time contribution; a donation must stay
|
||||||
|
# silent instead of mailing info@ about a "missing account".
|
||||||
|
node("BACKER", None, "donor", "donor@x.org", name="Donor",
|
||||||
|
created="2026-11-21T15:10:00Z"),
|
||||||
|
# FINDING: a LEGACY no-tier BACKER (before the tier system) IS a member
|
||||||
|
node("BACKER", None, "legacy", "legacy@x.org", name="Legacy",
|
||||||
|
created="2026-01-01T00:00:00Z"),
|
||||||
# not a member role
|
# not a member role
|
||||||
node("MEMBER", "Membership", "roleonly", "role@x.org", name="Role Only"),
|
node("MEMBER", "Membership", "roleonly", "role@x.org", name="Role Only"),
|
||||||
# FINDING: visible email -> the sweep should have provisioned this
|
# FINDING: visible email -> the sweep should have provisioned this
|
||||||
@@ -137,15 +145,19 @@ async def main():
|
|||||||
res = await m.reconcile_unmapped_backers()
|
res = await m.reconcile_unmapped_backers()
|
||||||
check(f"the check runs (got {res.get('status')})", res.get("status") == "ok")
|
check(f"the check runs (got {res.get('status')})", res.get("status") == "ok")
|
||||||
classes = sorted(res.get("classes") or [])
|
classes = sorted(res.get("classes") or [])
|
||||||
check(f"four findings in three classes (got {res.get('findings')} {classes})",
|
check(f"five findings in four classes (got {res.get('findings')} {classes})",
|
||||||
res.get("findings") == 4 and classes == ["hidden", "null-account", "org", "visible"])
|
res.get("findings") == 5 and classes == ["hidden", "null-account", "org", "visible"])
|
||||||
check("a node with no createdAt is NOT reported (nothing to attribute it against)",
|
check("a node with no createdAt is NOT reported (nothing to attribute it against)",
|
||||||
sum(1 for f in res["detail"] if f["class"] == "null-account") == 1)
|
sum(1 for f in res["detail"] if f["class"] == "null-account") == 1)
|
||||||
slugs = sorted(f["slug"] or "(null-account)" for f in res["detail"])
|
slugs = sorted(f["slug"] or "(null-account)" for f in res["detail"])
|
||||||
check(f"exactly the unmapped member-ish nodes are findings (got {slugs})",
|
check(f"exactly the unmapped member-ish nodes are findings (got {slugs})",
|
||||||
slugs == ["(null-account)", "gammaorg", "han", "vic"])
|
slugs == ["(null-account)", "gammaorg", "han", "legacy", "vic"])
|
||||||
check("a Credit-pack-only BACKER is not a member finding",
|
check("a Credit-pack-only BACKER is not a member finding",
|
||||||
not any(f["slug"] == "packbuyer" for f in res["detail"]))
|
not any(f["slug"] == "packbuyer" for f in res["detail"]))
|
||||||
|
check("a post-cutoff no-tier BACKER (a plain donation) is not a finding",
|
||||||
|
not any(f["slug"] == "donor" for f in res["detail"]))
|
||||||
|
check("a LEGACY no-tier BACKER is still a member finding",
|
||||||
|
any(f["slug"] == "legacy" for f in res["detail"]))
|
||||||
check("a MEMBER-role node is not a member finding",
|
check("a MEMBER-role node is not a member finding",
|
||||||
not any(f["slug"] == "roleonly" for f in res["detail"]))
|
not any(f["slug"] == "roleonly" for f in res["detail"]))
|
||||||
vis = {f["slug"]: f["email_visibility"] for f in res["detail"]}
|
vis = {f["slug"]: f["email_visibility"] for f in res["detail"]}
|
||||||
@@ -170,7 +182,7 @@ async def main():
|
|||||||
# Same set again: a report, but NO second email.
|
# Same set again: a report, but NO second email.
|
||||||
res2 = await m.reconcile_unmapped_backers()
|
res2 = await m.reconcile_unmapped_backers()
|
||||||
check(f"the same finding set is not re-emailed (got {len(SENT)} emails)",
|
check(f"the same finding set is not re-emailed (got {len(SENT)} emails)",
|
||||||
res2.get("findings") == 4 and res2.get("reported") is False and len(SENT) == 1)
|
res2.get("findings") == 5 and res2.get("reported") is False and len(SENT) == 1)
|
||||||
|
|
||||||
# The set CHANGES (one finding resolved): mail again.
|
# The set CHANGES (one finding resolved): mail again.
|
||||||
NODES[:] = [n for n in NODES
|
NODES[:] = [n for n in NODES
|
||||||
@@ -181,7 +193,7 @@ async def main():
|
|||||||
# got shorter. Only genuinely NEW keys speak.
|
# got shorter. Only genuinely NEW keys speak.
|
||||||
check(f"a smaller set re-mails nobody (got {res3.get('findings')} findings, "
|
check(f"a smaller set re-mails nobody (got {res3.get('findings')} findings, "
|
||||||
f"{res3.get('new')} new, {len(SENT)} emails)",
|
f"{res3.get('new')} new, {len(SENT)} emails)",
|
||||||
res3.get("findings") == 3 and res3.get("new") == 0 and len(SENT) == 1)
|
res3.get("findings") == 4 and res3.get("new") == 0 and len(SENT) == 1)
|
||||||
|
|
||||||
# Fully clear: silent, and the marker is cleared so a recurrence speaks up.
|
# Fully clear: silent, and the marker is cleared so a recurrence speaks up.
|
||||||
NODES[:] = [node("BACKER", "Membership", "alice", "alice@x.org", name="Alice")]
|
NODES[:] = [node("BACKER", "Membership", "alice", "alice@x.org", name="Alice")]
|
||||||
|
|||||||
Reference in new issue
Block a user