Commit Graph
89 Commits
Author SHA1 Message Date
inference-bot bd0746d197 panel: split read from write — any admitted Cloudron account reads, ADMIN_USERNAMES writes
The Cloudron access group alone was not enough: the app's own allowlist still
403'd every non-admin, so a steward with panel access saw nothing. Read is now
any authenticated identity Cloudron admitted to the app; write (balances,
credits, guest invites) stays with ADMIN_USERNAMES, enforced on every POST.
The page says which role you have and hides write controls when read-only.
2026-11-18 19:27:37 +00:00
inference-bot 2579e972f9 manifest: pin to 20261117-2ae9868
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-17 09:04:39 +00:00
inference-bot 2ae9868966 panel: Allowance shows what's left; Remaining becomes Dues
The Members table's Allowance column printed the uniform $15 balance, which
is the total, not what the member still has. It now computes
max(balance - spend, 0) client-side from the two served fields (no series
summed in the browser), keeps its allowance-only class so it still hides in
All-time mode, and reads "Allowance left" with a title saying it is a budget,
not OC dues.

The Remaining column (allowance + credits - spend, a credit figure) is
replaced by Dues: the member's current Open Collective contribution level,
rendered $10/mo / $120/yr and '—' when the portal has no readable level.
Dues sorts by dues_amount with unknowns last, and carries no balance-col, so
it stays visible in both modes.

tests/check-page-js.sh now stubs classList/parentElement so a harness can
observe the mode toggle; admin-panel-dues-harness.js pins the subtraction,
floor, dues text, null handling, sort and 10-cell column count in both modes;
tests/test_member_table_columns.py pins the header/row alignment.
2026-11-17 09:02:25 +00:00
inference-admin 3c3fb0b921 manifest: pin to 20261114-d329b05
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-14 21:54:53 +00:00
inference-admin d329b05fe3 panel: the Remaining header hides with its own column
ci/woodpecker/push/woodpecker Pipeline was successful
In All-time mode the Remaining *cell* carried remaining-only and hid, while its
header did not — so every column after it sat under the wrong heading and the
reset dates appeared under Remaining. The header now carries the same class its
cell does. Also widened the loading row's colspan to the real column count.
2026-11-14 21:54:35 +00:00
inference-admin 80e1eaea48 manifest: pin to 20261113-d440165
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 22:47:55 +00:00
inference-admin d4401651b6 portal_get kept the blanket 502 too
ci/woodpecker/push/woodpecker Pipeline was successful
Fixing portal_post only closed half of it: portal_get still turned any non-200
from the portal into a 502, so a refusal or a rate limit on a read path would
have arrived as a gateway error as well. Both helpers now pass the portal's own
status and detail through.
2026-11-13 22:47:39 +00:00
inference-admin 1239da192b manifest: pin to 20261113-b1cf76c
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 22:47:05 +00:00
inference-admin b1cf76c02d portal errors keep their own status instead of becoming 502
ci/woodpecker/push/woodpecker Pipeline was successful
portal_post collapsed every non-2xx upstream response into HTTPException(502), so
a plain rate limit ("Too many requests. Slow down.") reached the operator as
"Could not send guest access (502)": a gateway failure, for a condition that
clears in a minute and whose message said exactly that.

The status now passes through, so a 429 arrives as a 429 with the portal's own
words.
2026-11-13 22:46:50 +00:00
inference-admin a90f8fdb36 manifest: pin to 20261113-33ea1a7
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 22:34:41 +00:00
inference-admin 33ea1a732d panel: an OC-incognito chip, and the Admin column header stops misnaming the mode
ci/woodpecker/push/woodpecker Pipeline was successful
* source 'oc-incognito' gets its own chip. It read as plain "OC" — true as far as
  it goes (they are an OC subscriber) but it hides what matters operationally:
  email matching cannot see them, so their orders match by OC slug.
* The Admin section's spend column said "All-time spend" in BOTH modes, so in
  balance mode the header described data that was not in the table. Now "Spend".
2026-11-13 22:34:16 +00:00
inference-admin a63de0b2b2 manifest: pin to 20261113-825eff7
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 21:45:20 +00:00
inference-admin 825eff7053 card: read the portal's all-time spend, the number the dashboard shows too
ci/woodpecker/push/woodpecker Pipeline was successful
Kept the panel's own 'co-op's own share' line — that is the operator-account
breakdown only this app can see. The headline figure is now the shared one.
2026-11-13 21:44:14 +00:00
inference-admin 0a115d5838 manifest: pin to 20261113-e7eb34d
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 21:26:43 +00:00
inference-admin e7eb34d787 charts: Money lives in one place, and the menus are concise
ci/woodpecker/push/woodpecker Pipeline was successful
Money was both a tab and a metric of Trends — two doors to one chart, which is
what "not consistent" looks like from the outside. The tab is gone; the metric
stays, and the nav is Members · Model usage · Trends.

Period wording now matches the dashboard exactly: 30 days · 90 days · All time.
Titles come from the shared module (Members · Requests · Spend · Money · Energy ·
Carbon), so both apps offer the same six options in the same order.
2026-11-13 21:26:27 +00:00
inference-admin 92de0c25f0 manifest: pin to 20261113-b85cc93
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 21:18:59 +00:00
inference-admin b85cc93a6b page: Cache-Control no-store, so a reload can't run the previous deploy's JS
ci/woodpecker/push/woodpecker Pipeline was successful
The whole UI is one inline <script> with no ETag/Last-Modified and no cache
directive. After the 2026-11-13 fix deploy, a browser holding the previous copy
would keep running the dead script and make a fixed app look broken. The page is
cheap; serve it no-store.
2026-11-13 21:18:40 +00:00
inference-admin 59a34db9f7 manifest: pin to registry.inference.coop/code/admin-panel:20261113-c3f5a32
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 21:14:39 +00:00
inference-admin c3f5a326c2 fix: the panel served a page whose script never ran
ci/woodpecker/push/woodpecker Pipeline was successful
The metric buttons were built with an inline handler inside PAGE_HTML:

    + " onclick=\"setTrendMetric('" + def.id + "')">" + ...

In a plain triple-quoted Python string `\"` is just `"`, so the SERVED JS read
    + " onclick="setTrendMetric('" + ...
— the string closes at `onclick=` and the rest is a syntax error. The whole
script died at that line: no fetches, no tables, no charts. Just the shell.

Two failures compounded:
1. The line itself (a Python-escape mistake, from a patch script that turned
   `\\"` into `\"`).
2. The gate certified it. tests/check-page-js.sh sliced PAGE_HTML out of the
   SOURCE TEXT between the triple quotes, so it checked the escapes as typed
   while the app served them INTERPRETED — a page nobody was ever served.
   node --check on that text says OK.

Fixes:
* buildMetricButtons() emits data-metric attributes and the row gets ONE
  delegated click listener. No inline handlers, so no quote escape can break
  the page again — and the wiring is testable.
* The gate now reads PAGE_HTML with ast.literal_eval: the string Python
  actually serves. Proof it works: with the new gate, the pre-fix source FAILS
  node --check for both apps; the fixed tree passes.
* The stub element gained stateful attributes and addEventListener/__fire, so
  the harness can prove a click reaches setTrendMetric (and that a miss does
  nothing).
* The chart harness's "series name is the chart title" assertion now compares
  against the shared definition instead of a title that no longer exists.

Found by rendering the served page in a real browser, which is the only check
that could have caught it: the console said
  Uncaught SyntaxError: Unexpected identifier 'setTrendMetric' @802:24
2026-11-13 21:14:03 +00:00
inference-admin 88bf95ed27 manifest: pin to admin-panel:20261113-fba50e3
ci/woodpecker/push/woodpecker Pipeline failed
2026-11-13 21:02:58 +00:00
inference-admin fba50e3f93 Trends: one chart area for every metric, Money included, drawn by the shared module
ci/woodpecker/push/woodpecker Pipeline failed
Money was its own tab with its own renderers (renderMoney, renderMoneyCumulative,
renderMoneyDaily, renderMoneyLegend), its own period and spend-mode toggles, and
its own titles. It is now a metric of Trends like the others: the definitions come
from CoOpChart.CHART_METRICS, the chart is drawn by the shared renderChart(), and
the Money tab is a shortcut into Trends with that metric selected.

Removed: TREND_CONF, trendVal, trendLabel, the four money renderers, the
period/spend-mode toggles (the single Period row governs every metric now) — 5.1k
chars of duplicate chart code. Added: METRIC_SOURCE (which fetch each metric
needs), buildMetricButtons() (buttons rendered from the shared list, so the panel
and dashboard describe the same charts in the same order), and the metric-aware
renderTrends() that delegates.

The daily token-spend view is now the shared "spend" metric — the same numbers the
metrics endpoint already served, so nothing is lost by dropping the second source.
No caption under the money chart, as before.

Harness rewritten for the new path (it drove renderMoney): invariants preserved —
2 cumulative polylines + single-point balance marker, shared tooltip host, legend
that IS the definition's series list, 5 ascending ticks with the top clearing the
max, 30-day slice. New: every shared metric has a button, and a metric with no
source says so instead of drawing another chart. Tests green (page JS, pins,
guest guard).
2026-11-13 20:55:59 +00:00
inference-bot 79f3f00165 manifest: pin to 20261113-5ea2be7
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-13 16:32:21 +00:00
inference-bot 5ea2be7247 charts refactored onto the shared coop_chart.js module — rendering unchanged
ci/woodpecker/push/woodpecker Pipeline was successful
The tooltip machinery, axis steps, frames, bars, lines and hover targets move
to the canonical shared module (ops-docs scripts/shared/coop_chart.js,
byte-identical copy spliced into PAGE_HTML at import). PROOF of no visual
change: rendered innerHTML captured across 21 chart states (5 trend metrics x
3 ranges, 2 money modes x 3 periods) is byte-identical pre/post refactor.
CI: oidc + chart sync pins added to the pipeline; vendored check-page-js.sh
splices the module into the extracted page JS.
2026-11-13 16:11:23 +00:00
inference-bot c31f124bd1 manifest: pin to 20261111-80acfaed
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-11 05:23:09 +00:00
inference-bot 80acfaed3b oidc.py: single-sourced shared module; guest pill consumes the portal's state
- app/oidc.py is now a byte-identical copy of the canonical module
  (ops-docs: scripts/shared/oidc_client.py); this app's identity (logger
  name, session cookie, session salt) is set via oidc.configure() in
  main.py with the app's historical values, so existing sessions survive.
  tests/test_oidc_sync.py pins the copy to the canonical revision.
- Guests list: the pill CONSUMES the portal-served `state` (the single
  invited-vs-active derivation now lives in the portal and is tested
  there). The local active-flag re-derivation is deleted — the shim is
  first-served-field-wins (state → guest_status), so the previous payload
  shape renders identically during a portal rollback. Guests harness
  extended: invited-wins-over-ledger-active, served expired, and a
  payload with neither field renders NO derived pill text.
2026-11-11 05:23:05 +00:00
inference-bot 267a573eda ci: Woodpecker pipeline runs guest-guard test + page-JS harnesses on push (gates merges); vendor check-page-js.sh
ci/woodpecker/push/woodpecker Pipeline was successful
2026-11-11 03:42:00 +00:00
Inferencebot dd63750871 manifest: pin to 20261108-b23cc67 2026-11-08 20:42:00 +00:00
Inferencebot b23cc67128 Guests list: invited guest reads 'invited' (awaiting setup), not active
Prefer the portal's derived state on the guest row: 'invited' (pale-blue
pill, awaiting-setup tooltip) while the Cloudron invite is un-accepted;
ledger status stays the fallback for older payloads. Display only.
2026-11-08 20:40:26 +00:00
inference-bot 0487b382cd manifest: pin to 20261108-f9c2ae6 2026-11-08 20:21:53 +00:00
inference-bot f9c2ae6417 Remove the pending guest-requests section — nothing to approve anymore
The portal provisions member invites immediately (approval gate removed
2026-11-08), so the panel drops the Guest requests tab (queue, decisions,
badge and their JS) and the approve/reject API hops. Kept: the Guests list
(member-invited guests show inviter, credits, expiry, status, same as
admin-created ones) and the duplicate-send guard, now fed by the portal's
GET /admin/guest-ledger (ledger only — no pending key). Test updated: the
guard no longer has a pending branch; a legacy pending-shaped payload is
inert.
2026-11-08 20:20:33 +00:00
inference-bot 74165f1957 manifest: pin to 20261108-7f48caf 2026-11-08 20:14:42 +00:00
inference-bot 7f48caf8fe Guest copy: $5 -> $2 credit in panel invite/requests/guest rows 2026-11-08 20:14:42 +00:00
inference-bot 3e83139393 manifest: pin to 20261108-aabee20 2026-11-08 03:13:20 +00:00
inference-bot aabee20534 Guest-invite form: outcome shown in the card, double-submit guard server-side
The operator could never tell what a submit did: the only outcome message was
the top flash, off-screen from the mid-page form, and a portal refusal left
the fields filled with nothing visible where the operator was looking.

- invite card now carries its own persistent status line (same palette as
  .flash): success 'Invite sent to <email> — expires <date>.' with the fields
  cleared; any refusal/failure shown plainly with the fields KEPT.
- button held disabled ('Sending…') for the whole request, restored after.
- flash(): clear the previous timer so a message shown soon after another is
  not hidden by the first message's timeout.
- SERVER-SIDE duplicate guard (guest_duplicate_refusal, pure + unit-tested):
  /api/provision-guest refuses 409 before any portal call when an ACTIVE
  guest for the email exists ('A guest account for <email> already exists')
  or a PENDING request awaits the decision ('awaits activation'). Holds for
  any client; the portal's own one-guest-per-recipient guard stays behind it.
- admin-panel-invite-harness.js pins the whole behavior.
2026-11-08 03:12:30 +00:00
inference-bot c16d044113 manifest: pin to 20261108-575338a 2026-11-08 02:58:09 +00:00
inference-bot 575338a577 Guest-invite form: keep a name field, optional and clearly labelled
Final operator preference: the standard form is the guest's email
(required) plus an OPTIONAL display name, labelled 'Their name
(optional)'. The name passes through to provisioning as the initial
display name (the Cloudron path fills only empty names and never
overwrites one the guest sets at setup); an empty name is never derived
from the email.
2026-11-08 02:57:28 +00:00
inference-bot d6d960324a Standard guest-invite form: one email field, admin inviter, mobile-first
Replaces the tab-bar form (email + name + inviting-member inputs, which
overflowed a narrow frame) with the standard form: a card in the members
view — 'Invite a guest', a single required email input, a 'Send invite'
button. No name field (the guest chooses their own at Cloudron setup) and
no inviter field: the portal records the co-op's ADMIN account and applies
no monthly cap to admin invites. Form submits on Enter; full-width input
and button under 600px. Removed the dead member-email datalist.
2026-11-08 02:55:23 +00:00
inference-bot d5baffdb48 manifest: pin to 20261108-cf82ab5 2026-11-08 02:45:41 +00:00
inference-bot cf82ab55ea Pending-guests approval: the member self-serve trial gate in the panel
New Guest requests tab: the pending queue (inviter + recipient + name
visible, Approve/Reject per row with confirms), recent decisions, and the
guests ledger with every status pill — pending vs approved in one view.
Approve fires the portal's full guest pipeline through
/admin/guest-requests/{id}/approve (every guard re-runs); reject tells the
inviting member 'not approved' in their own dashboard trail. The tab badge
carries the pending count; the queue refetches on every visit and after
every decision so a row is never stale.
2026-11-08 02:44:46 +00:00
inference-bot a8674af611 Rename 'gift' to 'guest' throughout: guest pill, Guests list wording, provision-guest route and send form (pure rename, no behaviour change) 2026-11-08 02:31:07 +00:00
inference-bot 7b8a3f5654 manifest: pin to 20261108-4744a4f 2026-11-08 02:08:54 +00:00
inference-bot 4744a4fd31 panel: gifting action (provision-gift) + gift pill and datalist for member emails
The Send-gift control sits in the members-view toolbar: recipient email +
name + inviting member (datalist of member emails), proxied to the portal's
/admin/provision-gift which enforces the abuse rules and returns clear
refusals. Gift rows carry the 'gift' pill in the Source column (inviter +
expiry in the tooltip); the pre-built Guests section shows inviter, expiry,
credits and ledger status as columns once the portal payload carries
account_type.
2026-11-08 02:08:36 +00:00
inference-bot 2a6ec9301e manifest: pin to 20261108-2904a4c 2026-11-08 01:55:32 +00:00
inference-bot 2904a4c2f8 money chart: drop the caveat caption and the history-start legend note
The operator removed all caveats from the finance chart. Gone: the
money-caption element, the caveat/stale/errors caption rendering, the
.legend 'history begins' suffix and the orphaned CSS. Chart, legend keys,
series and toggles untouched; balance_history_start stays in the payload.
Harness now asserts no caveat text renders in any mode.
2026-11-08 01:55:23 +00:00
inference-bot 02fdd9f51c manifest: pin to 20261108-90294df 2026-11-08 01:50:28 +00:00
inference-bot 90294df4c6 money chart: cumulative OC revenue, token spend, and OC balance
New Money tab beside Trends, fed by the portal's /admin/money-series
(hourly-cached server-side). One fetch at full range; period (30/90/all)
and spend-mode (cumulative/daily) toggles re-render client-side.

- Cumulative mode: three lines — Revenue (OC contributions, green),
  Token spend (blue), OC balance (amber). NULL balance days render as a
  gap (the OC API exposes only the CURRENT balance; history accrues from
  daily snapshots from the deploy date onward — stated in the caption
  and in the balance legend key).
- Daily mode: token spend per day as bars (spend-only; the other series
  are cumulative and would need a second axis).
- Money ticks use the 1/2/5 x 10^k rule; tooltips reuse the shared
  chart-tip helper (all three series listed per day).
- The caption is a deliberate exception to the no-caption chart rule:
  the operator asked for the honest data-history limits in the UI.
- Harness: tests/money-chart-harness.js (axis invariants, gap handling,
  daily bars, period slice, single-point balance).
2026-11-08 01:50:26 +00:00
inference-bot bdb5a9c6eb manifest: pin to 20261108-254f701 2026-11-08 01:48:35 +00:00
inference-bot 254f701416 panel: exact-value hover tooltips on every chart
One shared, hand-rolled helper (no library, no CDN) replaces the native
SVG <title> tooltips: charts stamp data-tip-host/data-tip-i on their data
elements and register their exact values from the data arrays; one
delegated pointer listener set serves every chart, so re-renders need no
re-binding and new charts (the upcoming finance chart) join chart-by-chart
by following the two-step contract documented in the helper. The box is a
fixed-position div with pointer-events:none, clamped inside the viewport
(no edge flicker, never intercepts clicks); touch shows on tap/drag and
hides on release. Harness: admin-panel-chart-harness.js (exact values,
gap handling, clamping, multi-series contract) run via check-page-js.sh.
2026-11-08 01:47:56 +00:00
inference-bot 831569391b manifest: pin to 20261105-0713551 2026-11-05 16:30:11 +00:00
inference-bot 071355191e docs: the panel authenticates to the portal with ADMIN_TOKEN, not WEBHOOK_TOKEN (audit L5 — the webhook URL token cannot unlock /admin/*) 2026-11-05 16:26:16 +00:00