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).
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.
- 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.
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.
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.
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.
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).