unmapped backers: stop the phantom finding (the members query had no createdAt)
ci/woodpecker/push/woodpecker Pipeline was canceled

The first production run reported a null-account node as an uncredited payer. The
cause was in my port, not the data: the members query selected id-less,
date-less nodes, so every null-account node fell into the date "" bucket, matched
no same-day order, and was reported as unattributable — while the host-side script
(correctly) said clean.

Two fixes: select id + createdAt in fetch_all_member_nodes, and never emit a
null-account finding when the node carries no date — there is nothing to attribute
it against, and guessing is what produced the phantom. 27 checks in the suite.
This commit is contained in:
inference-admin committed 2026-11-13 20:35:28 +00:00
1 parent 13b6131652
commit bf1e5f013b
2 files changed
+18 -1

No files matched your search

+11 -1
View File
@@ -1440,7 +1440,7 @@ async def fetch_all_member_nodes() -> list[dict]:
for _ in range(20): # hard cap: 20 pages × 100 = 2000 members
query = (
'{ collective(slug: "%s") { members(limit: 100, offset: %d) { '
"totalCount nodes { role tier { name } account { name slug type ... on Individual { email } } } } } }"
"totalCount nodes { id role createdAt tier { name } account { name slug type ... on Individual { email } } } } } }"
% (OC_COLLECTIVE_SLUG, offset)
)
r = await _oc_graphql_post(
@@ -8143,6 +8143,16 @@ async def reconcile_unmapped_backers(notify: bool = True) -> dict:
# incognito-hidden). Attribute via same-day current orders; stay
# silent when every same-day payer is already mapped.
day = str(n.get("createdAt") or "")[:10]
if not day:
# Without the node's date there is nothing to attribute it
# against, and guessing here is how a phantom finding appears:
# the first run of this check reported a null-account node as
# uncredited while the node's day was unknown to us (the
# members query did not select createdAt at all).
logger.warning("unmapped-backer check: a member node carries no "
"createdAt; cannot attribute it (role=%s tier=%s)",
n.get("role"), (((n.get("tier") or {}) or {}).get("name")))
continue
current = [o for o in orders
if str(o.get("createdAt") or "")[:10] == day
and (o.get("status") or "") in CURRENT_ORDER_STATUS]
+7
View File
@@ -121,6 +121,11 @@ async def main():
node("BACKER", "Membership", account=False, created="2026-11-01T00:00:00Z"),
# null-account node on a day with an UNMAPPED payer -> finding
node("BACKER", "Membership", account=False, created="2026-11-02T00:00:00Z"),
# null-account node with NO date -> NOT a finding: there is nothing to
# attribute it against, and reporting it is how a phantom appears (the
# members query did not select createdAt, so every such node looked like an
# uncredited payer on the day "").
{"role": "BACKER", "tier": {"name": "Membership"}, "createdAt": None, "account": None},
]
ORDERS[:] = [
order("alice", day="2026-11-01"),
@@ -134,6 +139,8 @@ async def main():
classes = sorted(res.get("classes") or [])
check(f"four findings in three classes (got {res.get('findings')} {classes})",
res.get("findings") == 4 and classes == ["hidden", "null-account", "org", "visible"])
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)
slugs = sorted(f["slug"] or "(null-account)" for f in res["detail"])
check(f"exactly the unmapped member-ish nodes are findings (got {slugs})",
slugs == ["(null-account)", "gammaorg", "han", "vic"])