resolve payer: authenticate the lookup — without the token OC hides the email
ci/woodpecker/push/woodpecker Pipeline was canceled

Second live-only bug in the same helper. Sent unauthenticated, OC answers the
public view of an account: name comes back, email does not. A hand query with the
Personal-Token header returned conor.canaday@gmail.com for the very slug the
helper reported as email=None — so the fix would have resolved nobody, silently,
while looking like it worked.

The test now pins the header (the stub records what it was called with), because
the failure mode here is an absence, and an absence is exactly what a stub
forgets to check.
This commit is contained in:
inference-admin committed 2026-11-13 22:14:36 +00:00
1 parent 0458e8e5a5
commit 2cde368c1e
2 files changed
+18 -1

No files matched your search

+10 -1
View File
@@ -7418,7 +7418,16 @@ async def fetch_account_by_slug(slug: str) -> dict | None:
# around client.post), so the JSON is read here. Getting this wrong
# is invisible to a stubbed test and fatal in the container: the
# first live run raised 'Response object has no attribute get'.
resp = await _oc_graphql_post(client, {"query": query, "variables": {"slug": slug}})
resp = await _oc_graphql_post(
client,
{"query": query, "variables": {"slug": slug}},
# WITHOUT the personal token OC answers the unauthenticated view,
# which hides every email — the lookup then returns name='Conor W'
# and email=None while a hand query with the header returns
# conor.canaday@gmail.com. The header is the whole point.
headers={"Content-Type": "application/json",
"Personal-Token": OC_PERSONAL_TOKEN},
)
data = resp.json()
except Exception as e: # read failure: report, never raise
logger.warning("OC account lookup failed for slug %s: %s", slug, e)