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