Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
# OpenSpec Change: network-libp2p-server
- **Change ID**: network-libp2p-server
- **Package**: `@suaveplan/network-libp2p-server`
- **Category**: server (Node-only)
- **Target path**: `packages/network/network-libp2p-server`
- **Status**: PROPOSED
- **Date**: 2026-05-11
- **Parent**: `network-transport-family` (2026-05-11) — Wave 5
- **Migration source**: `../suaveplan/packages/server/network-libp2p-server` + `../suaveplan/enterprise/network-libp2p-server.md`
---
## Summary
Migrate `@suaveplan/network-libp2p-server` into genesis as a server-tier daemon. Hosts a libp2p server node (bootstrap + circuit-relay-v2) that browser-tier clients dial via `@suaveplan/network-transport-libp2p`. Pairs with the Wave-4 client to provide a complete libp2p mesh deployment story.
---
## Current-state audit
Upstream source layout (`../suaveplan/packages/server/network-libp2p-server/src/`): see `../suaveplan/enterprise/network-libp2p-server.md` for full inventory.
---
## Parity Checklist
| Capability | Upstream | Migrated | Notes |
|---|---|---|---|
| Server daemon (Node) | ✅ | ✅ | |
| libp2p node factory | ✅ | ✅ | |
| Bootstrap-node role | ✅ | ✅ | |
| Circuit-relay-v2 role | ✅ | ✅ | |
| TLS / Noise encryption | ✅ | ✅ | |
| Auto-relay | upstream feature | ✅ | |
| Structured errors | 🚫 | ⬆️ | `defineCodes` registry. |
| Zod boundary validation | 🚫 | ⬆️ | Every public option struct. |
| OTel instrumentation | 🚫 | ⬆️ | Spans + counters + histograms. |
| AbortSignal | 🚫 | ⬆️ | Threaded everywhere. |
| Health / readiness / liveness | 🚫 | ⬆️ | Via `@suaveplan/health-check` once that lands; otherwise inline endpoints. |
| `export *` barrels | check | ⬆️ | Convert to explicit named exports per §6a. |
| Test-runner imports | direct vitest | ⬆️ | Rewrite to `@suaveplan/testing/runner` per §7. |
| 100% test coverage | 🚫 | ⬆️ | Bring to 100/100/100/100. |
| Integration tests | partial | ⬆️ | Use `@suaveplan/testing-integration` for real-process tests; no mocks. |
---
## Available workspace deps on genesis
- `@suaveplan/network` ✅
- `@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, `@suaveplan/logger`, `@suaveplan/retry`, `@suaveplan/timing` ✅
- `@suaveplan/testing` + `@suaveplan/testing-integration` ✅
- `@suaveplan/network-transport-libp2p` ⬅ Wave 4 (shared type definitions + protocol versions)
- External: `libp2p, @libp2p/tcp, @libp2p/websockets, @libp2p/circuit-relay-v2, @libp2p/identify, @chainsafe/libp2p-noise, @chainsafe/libp2p-yamux, @multiformats/multiaddr`.
`package.json` declares `"engines": { "node": ">=20" }` and omits the `browser` field; server-tier marker comment in main entry point.
---
## Acceptance gate
1. `bunx turbo lint typecheck test --filter=@suaveplan/network-libp2p-server` green.
2. `bunx turbo test:coverage --filter=@suaveplan/network-libp2p-server` 100/100/100/100.
3. `bun run docs:check` green.
4. Integration test boots the server in-process and exercises the client-server round trip.
5. `STATUS.md` row flipped.
---
## Out of scope
- Production deployment infrastructure (Docker, k8s manifests, TLS termination) — deployment concern.
- Cross-cluster federation across multiple server instances.