8000 Website: live P&L page fed from the guard's public endpoint by tashdroid · Pull Request #2 · tashfeenahmed/cashmaxx · GitHub
[go: up one dir, main page]

Skip to content

Website: live P&L page fed from t 8000 he guard's public endpoint - #2

Open
tashdroid wants to merge 1 commit into
tashfeenahmed:mainfrom
tashdroid:feat/live-pnl-page
Open

tashdroid wants to merge 1 commit into
tashfeenahmed:mainfrom
tashdroid:feat/live-pnl-page

Conversation

@tashdroid
Copy link
Copy Markdown

What

A live P&L page at cashmaxx.neu.so/pnl/ — the site stops asserting the experiment and starts showing it. The page fetches a running guard's /public/pnl.json straight from the browser and renders income, costs, and net by window and by category, with income split into verified (written by the chain and Stripe watchers) vs agent-reported.

  • cashmaxx/guard/ledger.py — pnl() now carries verified_income per window; new verified_income() helper.
  • cashmaxx/guard/public.py — the guard's own P&L HTML gained a Verified column; both public endpoints answer Access-Control-Allow-Origin: * (they already expose totals only, so cross-origin reads leak nothing new).
  • cashmaxx/guard/app.py — CORS headers on /public/pnl and /public/pnl.json.
  • site/public/pnl/ — the new static page + app.js. No build step. Guard URL resolves from ?guard=, localStorage, or a baked window.CASHMAXX_GUARD_URL; graceful empty / offline / 404 (public_pnl off) states; 60s auto-refresh.
  • Home page links it (nav + final CTA), sitemap and docs updated.

Why

Wallet V publishes its agent performance openly and Freysa has $103k+ of documented payouts; Cashmaxx's whole claim is "can it earn more than it costs?" but the site only showed a simulated wallet with demo data. The guard already keeps the honest ledger — this feeds it into a public page so the experiment is verifiable instead of asserted.

Testing

  • tests/cashmaxx/guard/test_guard_app.py::test_public_pnl extended: verified vs unverified income split in the JSON, CORS header on both endpoints, Verified column in the HTML.
  • ruff check clean, basedpyright 0 errors, pytest tests/cashmaxx 342 passed. Full pytest tests: 6714 passed; the 2 failures in tests/tools/test_tool_validation.py::test_exec_guard_allows_public_urls are pre-existing on main (network-dependent; verified by stashing this change).
  • End-to-end: ran a real guard (public_pnl: true, FakeWallet, seeded verified/unverified rows) against the page served from site/public/ under jsdom — data state renders $13.50 income / $12.50 verified / −$10.75 net with the negative-net class; empty state with no guard URL; and the "guard has no public P&L" error state when public_pnl is off.

Deploy note (owner, after merge): cd site && npx wrangler pages deploy public --project-name cashmaxx --branch main, and on the live guard set public_pnl: true + public_base_url and expose the guard (e.g. cloudflared); optionally bake CASHMAXX_GUARD_URL into the page so it loads the owner's ledger with no URL entry.

Board card #827

cashmaxx.neu.so/pnl/ reads a running guard's /public/pnl.json straight
from the browser: income (split into verified-from-chain/Stripe vs
agent-reported), costs, net, per window and per category. The page is
static; the guard URL comes from ?guard=, localStorage, or a baked
window.CASHMAXX_GUARD_URL.

- ledger.pnl now carries verified_income per window (sum of verified
  income rows), so the page can show how much of the income is backed
  by chain or Stripe evidence.
- /public/pnl and /public/pnl.json answer with Access-Control-Allow-
  Origin: * (totals only, so cross-origin reads expose nothing new),
  and the guard's own HTML page gained the Verified column.
- Home page links the Live P&L (nav + final CTA); sitemap updated.

Board card #827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0