unmapped backers: stop the phantom finding (the members query had no createdAt)
ci/woodpecker/push/woodpecker Pipeline was canceled
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:
1 parent
13b6131652
commit
bf1e5f013b
2 files changed
+18
-1
No files matched your search
+11
-1
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user