Skip to content

Update e2e/lifecycle harnesses + setup for URL-scoped bundles#101

Merged
AquiGorka merged 5 commits into
mainfrom
feat-provider-dashboard-rework
May 28, 2026
Merged

Update e2e/lifecycle harnesses + setup for URL-scoped bundles#101
AquiGorka merged 5 commits into
mainfrom
feat-provider-dashboard-rework

Conversation

@AquiGorka
Copy link
Copy Markdown
Contributor

Summary

Updates local-dev to match the upcoming provider-platform changes:

  • e2e and lifecycle harnesses register Alice/Bob as APPROVED entities (POST /api/v1/entities) before any deposit/send so the new SUBMITTER_NOT_APPROVED gate doesn't reject them. e2e/setup.sh writes E2E_PP_PUBLIC_KEY so lib/client can compose the URL-scoped bundle path.
  • lib/client/* targets /providers/:ppPublicKey/bundles. send() now returns the bundle id and supports waitForCompletion: false (used by send-loop's expire injection).
  • setup-c.ts / setup-pp.ts spin up 3 councils (Mercado Libre Mercosur, Amazon Europe, Amazon North America) and 12 country-bound PPs derived from a single operator's masterSeed via HKDF, so dashboards have real fleet-wide variety.
  • send-loop.ts now walks every country in one invocation, each cycle: deposit → N sends → one FAILED bundle (2× overspend) → one EXPIRED bundle (admin force-expire) → withdraw. Sender/receiver names sampled from per-country pools. Opt out per cycle with FAIL=false / EXPIRE=false.

CI note

Provider-platform main does not yet have the URL-scoped routes or /entities endpoint that the updated client targets, so this PR's e2e + lifecycle CI will be red until the matching provider-platform PR lands (https://github.com/Moonlight-Protocol/provider-platform branch feat-provider-dashboard-rework). Per the iterate-provider-dashboard work this is the deliberate unblock order — landing this first lets provider-platform's CI use the new client on its own e2e run.

Test plan

  • deno fmt --check passes in e2e/, lifecycle/, testnet/, e2e/pos-instant/, e2e/governance/
  • deno lint passes in those dirs
  • deno check main.ts passes in e2e and lifecycle
  • Full Docker e2e once provider-platform PR is merged
  • Full Docker lifecycle once provider-platform PR is merged

AquiGorka added 5 commits May 28, 2026 14:22
Bundles are now submitted to /providers/:ppPublicKey/bundles instead
of the channel-only route. The client config requires E2E_PP_PUBLIC_KEY
and submitBundle / waitForBundle / send all encode the PP in the URL.
send also returns the bundle id and accepts waitForCompletion: false
so callers can detect or expire a bundle before it settles.
Replaces the single-council / single-PP setup with a 3-council fleet
(Mercosur, Europe, North America) and 12 country-bound PPs (one per
region's countries). The Council Admin owns all 3 councils; one
operator authenticates once, derives 12 PP keypairs from
HKDF(masterSeed, "pp" || index), and registers each PP on its
council via /dashboard/pp/register + admin approve + add_provider.

State file records COUNCIL_COUNT, PP_COUNT, per-PP jurisdiction and
councilIndex, plus OPERATOR_PK/SK so send-loop and demo scripts can
authenticate as the operator without re-deriving.
One invocation walks every country in the fleet, running a full cycle
per country: deposit → COUNT sends → one FAILED bundle → one EXPIRED
bundle → withdraw. Sender / receiver names are sampled from a per-
country pool (Mariana BR, Carmen AR, Sophie DE, ...) so dashboards see
entity variety instead of two stock names. Each pair is registered
via POST /api/v1/entities before submitting any bundles.

- FAIL injection: deposit 0.5 XLM, then submit a SPEND for that UTXO
  with a CREATE for 2× the amount. Server admits, executor sim rejects
  on the unbalanced operation, bundle settles as FAILED.
- EXPIRE injection: submit a bundle without waiting, then call
  /api/v1/dashboard/bundles/expire with the bundle id; settles as
  EXPIRED.
- Demo wrapper (network-dashboard-demo.ts) shells out to send-loop.sh
  per country.

Opt out per cycle with FAIL=false / EXPIRE=false. Removes the older
TARGET_COUNTRY env (the loop now always covers the whole fleet).
Bundles are now URL-scoped to /providers/:pp/bundles and require the
submitter to be an APPROVED entity. The two existing harnesses needed
two small updates to keep passing CI against the new provider-platform:

- e2e/setup.sh writes E2E_PP_PUBLIC_KEY=$PROVIDER_PK to contracts.env
  so lib/client/config.ts can resolve a PP for every submission.
- e2e/main.ts registers Alice and Bob via POST /api/v1/entities right
  after authenticate, before the deposit / send flow.
- lifecycle/main.ts sets ppPublicKey on the built Config and registers
  Alice and Bob the same way before deposit and send.
@AquiGorka AquiGorka merged commit 617a206 into main May 28, 2026
6 of 7 checks passed
@AquiGorka AquiGorka deleted the feat-provider-dashboard-rework branch May 28, 2026 19:40
AquiGorka added a commit that referenced this pull request May 29, 2026
…nstant (#103)

## Summary

Follow-up to #101 — fixes the harnesses that were missed because they
live next to (but aren't) the runners that the first PR touched:

- **`lifecycle/ci-test.ts`** is what the lifecycle Docker compose
actually invokes (`lifecycle/main.ts` is local-only). Now wires
`ppPublicKey` on Config and registers Alice/Bob via /api/v1/entities
before deposit/send. This is what unblocks **provider-platform's**
lifecycle CI.
- **`e2e/governance/uc2-approve-reject.ts`** still read
`.councilMembership` (singular) on the dashboard /pp/list response;
provider-platform PR #103 had renamed it to `.councilMemberships`
(plural array) months ago. Updated reads to `[0]?.status` / `.length ===
0`.
- **`e2e/pos-instant/main.ts`** registers `keys.payService` as APPROVED
before the instant payment flow, since pay-platform authenticates to
provider-platform under that key and otherwise trips the
SUBMITTER_NOT_APPROVED gate.
- **`test/setup-e2e.ts`** writes `E2E_PP_PUBLIC_KEY` to
/config/contracts.env. (`e2e/setup.sh` already had this in the CI flow;
the local `./test.sh e2e` flow uses the test/ setup script and needs the
same line.)

## Test plan

Locally (`./test.sh all`), all 5 suites green: e2e, otel, governance,
lifecycle, pos-instant.

After this merges, re-running provider-platform's PR CI
(Moonlight-Protocol/provider-platform#106)
should flip lifecycle from red to green.
AquiGorka added a commit to Moonlight-Protocol/provider-platform that referenced this pull request May 29, 2026
)

## Summary

Three bundled changes for the provider-dashboard work:

1. **`feat(entities)`** — rename `users` → `entities`, add POST
/api/v1/entities for KYC/KYB-style approval, gate bundle submission on
the submitter's entity being APPROVED (`SUBMITTER_NOT_APPROVED`).
2. **`feat(bundles)`** — bundles submitted to
`/api/v1/providers/:ppPublicKey/bundles` instead of channel-only. Each
bundle row carries `pp_public_key`. channel-resolver requires explicit
PP, returns the PP-bound signer/channel client.
`bundle.jurisdiction_from/to` dropped (now derived from the submitter's
entity). dashboard `listRecentBundles` is PP-scoped and returns
entityName / jurisdictions / aggregated amount. Event emission moves
from `emitForChannel` (every PP on the channel) to `emitForBundles` /
`emitForPp` so dashboards only see events for bundles that belong to
them.
3. **Version bump** to 0.7.0 (minor — new surface area).

Migrations: 0014 (rename users→entities), 0015 (drop bundle
jurisdictions), 0016 (bundle pp_public_key).

## CI note

Cross-repo deadlock with `local-dev` and `pay-platform`:
- This PR's e2e + lifecycle CI uses `local-dev@main` which still calls
the old `/api/v1/bundle` route — will be red until local-dev's PR
(Moonlight-Protocol/local-dev#101) merges.
- Pay-platform PR
(Moonlight-Protocol/pay-platform#35) also needs
to merge to fix the same old-URL call from production payment flow.

Locally, with all three branches checked out, `./test.sh all` is green
across e2e + otel + governance + lifecycle + pos-instant.

## Test plan

- [x] deno fmt --check (288 files)
- [x] deno lint (248 files)
- [x] deno task test:unit (64 passed)
- [x] deno task test:pay (136 passed)
- [x] Local `./test.sh all` against local-dev + pay-platform branches —
all 5 suites green
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