Skip to content

feat: multisig events, pytest infra, WASM sizes, propose withdrawal UI#242

Merged
codebestia merged 4 commits into
codebestia:mainfrom
vic-Gray:feature/multisig-events-pytest-wasm-sizes-propose-withdrawal
Jun 26, 2026
Merged

feat: multisig events, pytest infra, WASM sizes, propose withdrawal UI#242
codebestia merged 4 commits into
codebestia:mainfrom
vic-Gray:feature/multisig-events-pytest-wasm-sizes-propose-withdrawal

Conversation

@vic-Gray

Copy link
Copy Markdown
Contributor

Summary

This PR implements four tracked issues across the backend, AI agent, contracts CI, and frontend.


Changes

#130 — Extend Stellar event listener to sync multisig events

Files: apps/backend/src/services/stellarListener.ts, apps/backend/src/db/schema.ts, apps/backend/src/index.ts

  • Added treasury_proposals DB table with idempotent upsert on (contractId, proposalId)
  • Introduced TreasuryProposalEvent type covering all five event types: proposal_created, proposal_approved, proposal_rejected, proposal_executed, proposal_expired
  • Extended StellarListenerDeps with optional fetchTreasuryEvents / persistTreasuryEvent hooks — fully backwards-compatible
  • defaultPersistTreasuryEvent upserts status + vote counts and emits treasury_proposal_updated Socket.IO event to the conversation room (or a treasury:<contractId> fallback room)
  • treasury_proposal_updated payload: { proposalId, status, approvalsCount, rejectionsCount }
  • Added buildTreasuryRpcFetcher for production RPC wiring
  • GROUP_TREASURY_CONTRACT_ID env var activates the treasury sub-loop in index.ts
  • Listener errors are caught per-event and logged; cursor only advances on successful persistence — fully idempotent

#142 — Set up pytest infrastructure for ai_agent

Files: apps/ai_agent/pyproject.toml, apps/ai_agent/tests/conftest.py, apps/ai_agent/tests/__init__.py

  • Added [project.optional-dependencies] dev with pytest>=8.0.0, httpx>=0.27.0, pytest-mock>=3.14.0, pytest-cov>=5.0.0
  • Configured [tool.pytest.ini_options] with testpaths = ["tests"], coverage via --cov, and pythonpath = ["."]
  • Added [tool.coverage.run] omitting the tests/ directory itself
  • tests/conftest.py provides four shared fixtures importable from any test file:
    • set_openai_key (autouse) — sets OPENAI_API_KEY via monkeypatch so no test hits a real key check
    • client — FastAPI TestClient for the main app
    • mock_openai — patches main.OpenAI
    • mock_weaviate — patches main.weaviate.connect_to_local
  • Run with: uv sync --extra dev && uv run pytest

#140 — Track and report WASM binary sizes on pull requests

Files: .github/workflows/contracts-ci.yml

  • Added a Report WASM binary sizes step after the release WASM build in the test-and-build job
  • Iterates all *.wasm files in target/wasm32-unknown-unknown/release/ and builds a size table
  • Writes the table to $GITHUB_STEP_SUMMARY (visible in every run's Actions summary)
  • On pull_request events, posts the table as a PR comment using <!-- wasm-size-report --> as a sentinel — subsequent pushes update the existing comment in-place (no duplicates)
  • Size gate: fails CI with ::error annotation if any WASM exceeds 100 KB (configurable via THRESHOLD_BYTES)
  • Size is measured on the post-strip release build (opt-level = "z", strip = "symbols" per Cargo.toml)

#131 — Build "Propose Withdrawal" UI on the Treasury page

Files: apps/web/src/app/app/treasury/page.tsx, apps/web/src/components/treasury/ProposeWithdrawalModal.tsx, apps/backend/src/routes/treasury.ts, apps/backend/src/app.ts

Frontend

  • Added a Propose Withdrawal button in the Treasury page header
  • ProposeWithdrawalModal with four fields:
    • Amount<input type="number" min="0.0000001"> blocks <= 0 client-side
    • Token — select (XLM / USDC / AQUA)
    • Recipient — validated against /^G[A-Z2-7]{55}$/; inline error shown before submit
    • TTL — 24 h / 72 h / 7 days (resolved to Stellar ledger counts on the server)
  • Submit button shows "Submitting..." and is disabled during the request
  • On success: shows a success toast, closes the modal, and triggers onSuccess for list refresh

Backend

  • POST /treasury/propose route with Zod validation (amount > 0, valid Stellar address, valid TTL)
  • Returns { proposer, amount, token, recipient, ttlLedgers }; ready for Soroban multisig wiring

Testing

  • Backend TypeScript: pnpm --filter backend tsc --noEmit — zero new errors
  • Frontend TypeScript: pnpm --filter web tsc --noEmit — clean
  • AI agent pytest infra: uv sync --extra dev && uv run pytest — no collection errors

Closes #130
Closes #142
Closes #140
Closes #131

codebestia#130 - Extend Stellar listener to sync multisig proposal events
codebestia#142 - Set up pytest infrastructure for ai_agent
codebestia#140 - Track and report WASM binary sizes on PRs
codebestia#131 - Build Propose Withdrawal UI on treasury page
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@vic-Gray Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@codebestia

Copy link
Copy Markdown
Owner

Hello @vic-Gray
Please fix the failing CI

@codebestia codebestia left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thank you for your contribution.

@codebestia codebestia merged commit 67acc90 into codebestia:main Jun 26, 2026
6 checks passed
codebestia added a commit that referenced this pull request Jun 26, 2026
…wasm-sizes-propose-withdrawal

feat: multisig events, pytest infra, WASM sizes, propose withdrawal UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants