reconcile_allowances already matches every member's Open Collective orders;
it now records what those orders say the member currently pays:
dues_amount / dues_frequency / dues_updated_at (added via the lazy ALTER
pattern). Only a LIVE recurring order (MONTHLY/YEARLY, ACTIVE/PROCESSING)
counts — one-time orders are credit purchases, cancelled/errored ones are not
a current level, and anything unreadable is NULL rather than a guessed tier.
/admin/overview carries the three fields so the admin panel can show a real
Dues column instead of a credit figure. The write happens in report mode too:
it records OC's own truth and makes no membership decision.
tests/test_dues_level.py pins the extraction rules.
mmoya traced the false '$10 floor' to the stray-credit email: it said '($10-20/month,
sliding scale)' when Open Collective's flexible tier starts at $5 (suggested $10).
Copy now says 'from $5/month, suggested $10 — sliding scale'.
A person can hold two Open Collective profiles, one hiding its email. Purchases from
the hidden one have no email to match and no primary slug, so they land in held
credits. member_aliases maps extra slugs to a member email; the sweep's held-credit
pass resolves email -> slug -> alias before holding anything. Admin GET/POST
/admin/aliases manages rows; test covers grant and idempotency.
oc-incognito disables email matching by design, so a profile that later shows an
email leaves the member silently unmatched. The sweep now flips those to oc and
records oc_email; profiles still hiding an email are untouched. Test covers both.
New read-only /broker/membership-status, authenticated by the broker secret with a
verifier that admits a member row in ANY state (usage and keys still require active).
Returns active/state, the latest allowance_log decision with its evidence, the OC
minimum contribution (MIN_CONTRIBUTION, copy-only — OC stays the authority), credits,
allowance and the contribute URL.
MIN_CONTRIBUTION is deliberately NOT wired into deactivation: a number we half-know
should not cost anyone access.
A credit pack bought while the buyer's membership was inactive is held — correctly,
we must never mint credits for a non-member. The gap was what happened next: the hold
sat until a human noticed (mmoya's $10 waited from 01:45 until they wrote in).
Every sweep now grants any hold that resolves to an ACTIVE member (by email first, then
slug), reusing grant_held_credits() so held:<id> keeps it idempotent; holds with no
active member older than HELD_ALERT_HOURS are emailed to info@. Tests cover grant/hold/
no-double-apply.
The app is stopped (`com.openwebui.cloudronapp`, installed|stopped), so every call
to it failed with "Temporary failure in name resolution" — a stopped container has
no DNS entry. Four of the last four provisions logged exactly that; no new member
ever reached the group.
Its "members group" was never a Cloudron group: the id pointed at a group inside
Open WebUI's own database, which is why it appears nowhere in Cloudron's UI.
Removed: owui_add_to_members_group, both call sites (provision_member and guest
convert), the OWUI_* constants, and the signed-JWT identity path in inject_key.
That last one is the part that matters beyond tidiness: it accepted a
shared-secret-signed token as proof of identity for an integration nobody runs.
inject_key keeps its one live path (LibreChat: X-User-Email + X-Portal-Secret,
still verified).
First attempt at this cut too much — a greedy splice off the guest-convert call
took listmonk_sync and the held-credit grant with it, and test_guest_lifecycle.py
caught it before anything shipped. Redone with exact anchors.
Setting the source was not enough, and verification is what caught it: mmoya still
produced no allowance decision at all.
The reconciler gets a member's OC slug from the member INDEX — which is keyed by
email, and DROPS anyone whose profile hides its email. So `oc_slug` came back
empty, the member fell into "not in the live Open Collective member list — cannot
verify payment", and was counted as skipped. An oc-incognito member would have
been "not manual" and still not reconciled: a nicer label over the same hole.
For source oc-incognito the slug now comes from the member's own row, which is
the same key fetch_member_orders() groups orders by — the whole reason matching
can work for these people. The test pins the fallback, not just the source.
mmoya@mmoya.org sat in MANUAL_MEMBERS because OC hides the address on their
profile (incognito-5ad60182, email null since 2023), so email matching can never
find them. But "manual" means hand-provisioned, and the sweep SKIPS manual
members entirely: a paying subscriber had no lapse logic, no dues tracking and no
order attribution. Two different facts were sharing one word.
members.source now carries which one it is:
oc — OC-backed, matched by email (the default; NULL means this)
oc-incognito — OC-backed, profile hides the email, matched by the stored OC
SLUG — which the reconciliation already uses, since
fetch_member_orders() groups orders by the payer's slug and
members.slug holds exactly that for these people
manual — hand-provisioned; no contribution expected, nothing reconciles,
nobody lapses
So an oc-incognito member needs no exemption from reconciliation — they need to
stop being skipped, and the existing slug path does the rest.
Every decision that keyed on the raw MANUAL_MEMBERS list now keys on the source:
the reconciliation skip, the sweep's deactivation guard, and the shortfall-credit
exemption. An explicit source beats the list, so a member can be moved without
editing the env — and the env list can shrink toward deprecation. An
unrecognised or unreadable source falls back to 'oc', the direction that keeps
reconciling someone rather than quietly exempting them.
anchor_day_for_member also resolves by slug now: an incognito member is absent
from the member index (it drops anyone without an email), and falling back to
"today" would silently move their renewal day.
tests/test_oc_incognito.py pins all of it, including that the column is optional
(NULL = not stated) so this ships without a data migration.
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.
_oc_graphql_post returns the RESPONSE — it is a retrying wrapper around
client.post — so fetch_account_by_slug has to call .json() on it. My unit test
stubbed it as a dict, so the test passed and the first live call in the container
died with "Response object has no attribute get".
The test now stubs the real shape (a response wrapper with .json()). Folding it
in here rather than hiding it: a stub that does not match the real return shape
certifies nothing.
On 2026-11-13 21:59:43 Open Collective delivered order.processed for a live
$5/month membership (Conor W, conor.canaday@gmail.com, order
or_eU8gRkrPCvFsaYHrgiCfz). The portal answered 200 and did nothing.
The membership branch resolves the payer by SLUG against the collective's
members list:
members = await fetch_members()
member = next((m for m in members if m["slug"] == slug), None)
and a first-time contributor's account is not in that list yet — OC reports the
payer as guest-…/incognito-…. So `member` was None, the branch fell through, and
because the delivery had SUCCEEDED there was no error to record either: no
account, no welcome email, no credit, no log line. The sweep's unmapped-backers
check found it hours later, which is the wrong place to find it.
Now an unknown payer is resolved from the order's account slug
(`Individual.email`, which OC exposes for an ordinary guest checkout) and handed
to the same provisioning path a known member gets. When even that yields no
email — an incognito profile, hidden on purpose — the webhook logs at ERROR that
nobody was provisioned or credited, instead of shrugging.
The defect worth naming is the SHAPE: an `if` with no `else` on a money path,
where doing nothing leaves no trace. tests/test_resolve_payer.py pins the
resolution cases (guest with email, incognito, unknown account, read failure, no
token) and the fact that the branch can no longer fall through quietly.
mark@ofosos.org showed as in grace while his contribution was live. The sweep's
own trail says it plainly: reminded 2026-11-04 for the cycle that looked unpaid,
grace elapsed 2026-11-11, and `renewed` logged at 19:02 on 2026-11-13 (last
charge 2026-11-11, next reset 2026-11-26). The panel said grace anyway, because
member_membership_state() asked only "is there a row in payment_reminders?".
That table is a HISTORY — kept so the sweep does not re-remind inside a cycle. It
is not a state, and treating it as one broke two things: a reminder never
expired (grace is PAYMENT_GRACE_DAYS long), and a renewal never cleared it.
Now the LATEST reconciliation decision decides:
renewed / would_renew -> active (they are paying)
reminder inside the window -> in_grace
reminder past the window -> awaiting_contribution, saying grace elapsed
would_deactivate / deactivated -> awaiting_contribution
Ordered by decided_at, not id: the same member had id 2296 dated 2026-11-11 next
to id 2286 dated 2026-11-13, so "latest by id" reads the wrong decision.
Reads still fail safe: an unreadable DB reports active, never a payment problem.
tests/test_membership_state.py pins all of it, including the ordering trap.
The panel's card said $941.37 and the member dashboard's said $900.51 for the
same claim. The panel used its own per-team query; the dashboard summed the
chart series IN THE BROWSER, which disagrees with the server whenever a row is
null, capped or stale.
coop_spend_totals() is now the definition: one GROUP BY over SpendLogs joined to
the team table, so
spend_all_time = every row (members, operators, agent teams, sandboxes) —
the same universe litellm_spend_by_day() sums, so the
cards and the money chart agree by construction
own_all_time_spend = the part that is the co-op's own (non-member teams, plus
rows with no team)
and member_all_time_spend = the rest. Exposed through /admin/overview (the
panel's boot payload), the money payload, and /broker/metrics (the dashboard's).
_coop_spend_totals_safe() returns {} rather than a zero: a failed computation
must never read as "the co-op has spent nothing".
tests/test_coop_spend_totals.py pins the arithmetic (total == member + own ==
every row) and the no-fake-zero rule.
The member dashboard could not show the money chart because the broker exposed no
money series — the same payload /admin/money-series serves the panel is aggregate
and carries no member identities (cumulative revenue, cumulative token spend, the
OC balance), so it goes through the broker for the same reason /broker/metrics
does. One chart definition, drawn identically for members and stewards.
The second live run FAILED again, correctly and informatively: portal $935.52
all-time vs LiteLLM $827.89 — and the $107.63 'drift' was the WINDOW. LiteLLM's
per-day view reaches back a fixed number of days (31 on 2026-11-13); our table
holds 69. Over the days both sides cover the two agree to $0.07, with no day
differing by more than $0.022 (the API rounds to cents).
So the check now compares DAY BY DAY over the shared window, which localises drift
instead of hiding it in a sum, with a per-day tolerance ($0.10) plus a window-total
tolerance ($5). It reads /global/spend/teams rather than /global/spend/keys: the
per-key figure follows each key's own budget cycle, so summing it is not an all-time
number at all (and /global/spend/report, the all-time one, is Enterprise-gated).
Degenerate reads are judged BEFORE the window overlap, because in the failure this
check exists for the portal's aggregate comes back EMPTY — there would be no shared
days to compare, and the overlap logic would report 'cannot compare' instead of the
stale-credential signature. All failure reporting goes through one helper that mails
info@ once per episode and advances the marker only after a notice is sent.
23 checks; all 20 suites green.
The first live run FAILED with api $0.00 over 306 keys against the portal's $935.35.
The disagreement was real, the verdict was right, and the cause was mine: LiteLLM's
/global/spend/keys returns each key's all-time spend as `total_spend`, not `spend`.
A checker that trusts its own parse then reports "the portal is wrong" — the exact
mirror of the failure this check exists to catch, which is why the guard now names
both possibilities when the independent side reads zero against real portal spend.
Parser accepts either field name; a regression test exercises the real function
against a stubbed httpx (the module attribute is stubbed for the other checks, so
the real one is captured at import). 24 checks; all 20 suites green.
The failure this exists for (2026-11-05): the portal's own all-time-spend aggregate
failed SOFT when its copy of the gateway's LiteLLM DB credential went stale — the
query returned nothing, every surface showed $0, and nothing looked wrong, because
the portal WAS the thing that was wrong. The guard ran as a daily script on the
bot's host.
It now runs in the portal, and keeps two genuinely independent reads: the portal's
SpendLogs aggregate over its own DB credential, and LiteLLM's own HTTP API
(/global/spend/keys) over the master key — a different transport AND a different
credential, which is the point, since the DB copy is what goes stale.
It adds the signature guard the host script could only infer from outside: an
EMPTY//usr/bin/bash portal aggregate while LiteLLM reports real spend is a FAILURE, named as
the stale-credential case; an API side that returns no keys is a failure too, not
agreement. A read that cannot be made is skipped — never a clean bill. Silent when
they agree; info@ once per failing episode, marker cleared on recovery.
POST /admin/spend-check runs it on demand. 23 checks; all 20 suites green.
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.
Three fixes to the 'email only when there is a problem' rule, found by testing it:
1. The marker recorded the CURRENT set, so a set that SHRANK looked changed — one
purchase granted dropped out, the remaining hold looked new, and it was mailed
about twice. What a human has been TOLD is now a growing SET of keys
(order:grant / order:hold, slug:class for backers): only keys not in it are
mailed, and the union is stored.
2. A notify=False run advanced the marker, so a verification look CONSUMED the
only alert a finding gets. The marker now advances only when the notice was
actually sent (a failed send retries next sweep), and a clean pass clears it so
a recurrence is news again.
3. The credit reconcile had the same shape of bug.
Tests updated to pin the new semantics: a smaller set re-mails nobody, a silent
look does not swallow the alert, a clean run clears the marker and a recurrence
speaks. 26 + 40 checks in those suites; all 19 suites green.