feat: Phase 1 crude bridge — add node from explorer by mycelium IP (#72) #1

Merged
mik-tf merged 1 commit from development_mik02 into development 2026-04-11 02:20:56 +00:00
Member

Summary

Phase 1 of the scaling architecture initiative (#72) — adds a "crude bridge" endpoint so farmers can register a hero_compute node by mycelium IP instead of hand-entering capacity.

Changes

  • POST /api/dashboard/nodes/from-explorer (dashboard/resource_provider.rs:754-975) — looks the node up in hero_compute_explorer by mycelium_ip, extracts hostname/capacity/slice_count/sid, calls the existing add_node path, patches grid_data with compute_node_sid + explorer_raw for Phase 5 linkage, and best-effort-calls marketplace.listing_create on hero_ledger.
  • ComputeClient::lookup_by_mycelium_ip — client-side filter over explorer.node_list() until upstream adds node_get_by_mycelium_ip (Phase 2 follow-up).
  • ServiceProvider now carries an optional compute_client field populated in the two compute-enabled variants.

Scope

Deliberately crude and isolated — the whole handler + route gets deleted in Phase 5 when POST /api/nodes/pair replaces manual discovery with signed pairing from the node itself.

Validation (dev-app.projectmycelium.org)

Deployed as :development_mik02 via docker-compose override on the dev VM. Real smoke test against hero_compute explorer node 0001 (mycelium_ip 46a:52b7:d2c2:4416:ff0f:5892:d922:50dc, hostname devpmmarketplace):

  • 200 OK, FarmNode 016i created, grid_data.compute_node_sid = "0001", capacity pulled from heartbeat (7GB RAM, 100GB disk)
  • Error paths: empty ip → 400, bogus ip → 404, no auth → 307 (SessionUser redirect)
  • listing: null — best-effort hero_ledger listing_create failed silently as designed (will be replaced in Phase 5)

Test results

All regression suites green except 2 pre-existing failures unrelated to this change:

  • 7 API suites: 235/235
  • Playwright SPA: 54/54
  • Playwright admin: 41/41
  • Playwright content regression: 55/55
  • Visual parity: 35/35
  • Ledger integration: 11/11
  • Onboarding integration: 16/18 (2 pre-existing — DEMO_KYC auto-verifies email/TOS, old test predates the flag)
  • MCP integration: 8/13 (5 pre-existing — unix-socket tests require local marketplace, cannot run against remote)
## Summary Phase 1 of the scaling architecture initiative (#72) — adds a "crude bridge" endpoint so farmers can register a hero_compute node by mycelium IP instead of hand-entering capacity. ## Changes - `POST /api/dashboard/nodes/from-explorer` (dashboard/resource_provider.rs:754-975) — looks the node up in hero_compute_explorer by mycelium_ip, extracts hostname/capacity/slice_count/sid, calls the existing add_node path, patches `grid_data` with `compute_node_sid` + `explorer_raw` for Phase 5 linkage, and best-effort-calls `marketplace.listing_create` on hero_ledger. - `ComputeClient::lookup_by_mycelium_ip` — client-side filter over `explorer.node_list()` until upstream adds `node_get_by_mycelium_ip` (Phase 2 follow-up). - `ServiceProvider` now carries an optional `compute_client` field populated in the two compute-enabled variants. ## Scope Deliberately crude and isolated — the whole handler + route gets deleted in Phase 5 when `POST /api/nodes/pair` replaces manual discovery with signed pairing from the node itself. ## Validation (dev-app.projectmycelium.org) Deployed as `:development_mik02` via docker-compose override on the dev VM. Real smoke test against hero_compute explorer node `0001` (mycelium_ip `46a:52b7:d2c2:4416:ff0f:5892:d922:50dc`, hostname `devpmmarketplace`): - 200 OK, `FarmNode 016i` created, `grid_data.compute_node_sid = "0001"`, capacity pulled from heartbeat (7GB RAM, 100GB disk) - Error paths: empty ip → 400, bogus ip → 404, no auth → 307 (SessionUser redirect) - `listing: null` — best-effort hero_ledger `listing_create` failed silently as designed (will be replaced in Phase 5) ## Test results All regression suites green except 2 pre-existing failures unrelated to this change: - 7 API suites: 235/235 ✅ - Playwright SPA: 54/54 ✅ - Playwright admin: 41/41 ✅ - Playwright content regression: 55/55 ✅ - Visual parity: 35/35 ✅ - Ledger integration: 11/11 ✅ - Onboarding integration: 16/18 (2 pre-existing — DEMO_KYC auto-verifies email/TOS, old test predates the flag) - MCP integration: 8/13 (5 pre-existing — unix-socket tests require local marketplace, cannot run against remote) ## Related - Issue: https://forge.ourworld.tf/mycelium_code/home/issues/72 - Closes (pending merge): https://forge.ourworld.tf/mycelium_code/home/issues/71 - Spec: https://forge.ourworld.tf/mycelium_code/projectmycelium_marketplace_deploy/src/branch/development_mik02/docs/scaling_architecture.md
feat: Phase 1 crude bridge — add node from explorer by mycelium IP (#72)
Some checks failed
Build and Test / build (push) Failing after 2m6s
Build and Test / build (pull_request) Failing after 2m5s
a698839ab1
Phase 1 of the scaling architecture initiative (docs/scaling_architecture.md).

Farmer pastes the mycelium IPv6 of a running node; backend queries
hero_compute_explorer.node_list, filters by mycelium_ip, and
auto-populates a FarmNode + best-effort hero_ledger listing. No manual
capacity entry required.

Changes:
- ServiceProvider: new optional compute_client field, populated in the
  two compute-enabled variants (local_with_compute,
  local_with_ledger_and_compute). Gives controllers clean access to
  the explorer client without going through ComputeSliceRentalManager.
- ComputeClient::lookup_by_mycelium_ip: client-side filter over
  node_list() until we add ExplorerService.node_get_by_mycelium_ip
  upstream (Phase 2 follow-up).
- New controller POST /api/dashboard/nodes/from-explorer:
  - Validates mycelium_ip
  - Looks up in explorer, extracts hostname/capacity/slice_count/sid
  - Builds NodeCreationData, calls existing add_node service method
  - Patches grid_data with compute_node_sid + explorer_raw for Phase 5
    linkage
  - Best-effort hero_ledger marketplace.listing_create (synthetic
    node_id derived from mycelium_ip hash — Phase 1 hack, replaced in
    Phase 5 by hosting.node_register)
  - Logs NodeAdded activity

This is deliberately crude and isolated — the whole handler + route
will be deleted in Phase 5 when the auto-pairing endpoint
(POST /api/nodes/pair) replaces manual discovery with signed pairing.

Relates to: mycelium_code/home#72
Closes:     mycelium_code/home#71 (pending deploy + verify)

Tests: cargo check clean, 25 unit tests pass. Integration + E2E
against dev VM to follow.
mik-tf merged commit 92444316dd into development 2026-04-11 02:20:56 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coopcloud_code/projectmycelium_marketplace_backend!1
No description provided.