5 Commits
Author SHA1 Message Date
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 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 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 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 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