77 lines
3.0 KiB
Markdown
77 lines
3.0 KiB
Markdown
# Tasks: enterprise-browser-network-discovery-trystero
|
|
|
|
**Change ID**: enterprise-browser-network-discovery-trystero
|
|
**Package**: `@suaveplan/network-discovery-trystero`
|
|
**Target path**: `browser/network/network-discovery-trystero`
|
|
**Prerequisite packages on Verdaccio**: `@suaveplan/network`, `@suaveplan/error`, `@suaveplan/types`, `@suaveplan/crypto`, `@suaveplan/retry`
|
|
|
|
---
|
|
|
|
## 1. Scaffold
|
|
|
|
- [x] Create directory tree per `proposal.md`.
|
|
- [x] `package.json` v0.0.0, `"sideEffects": false`.
|
|
- `dependencies`: `@suaveplan/network workspace:^`, `@suaveplan/error workspace:^`, `@suaveplan/types workspace:^`, `@suaveplan/crypto workspace:^`, `@suaveplan/retry workspace:^`, `trystero`, `zod catalog:forms`, `@opentelemetry/api catalog:observability`, `tslib catalog:build`
|
|
- `devDependencies`: `vitest catalog:testing`, `@vitest/coverage-istanbul catalog:testing`, `@suaveplan/testing workspace:^`, `react catalog:browser`, `@types/react catalog:browser`
|
|
- [x] `tsconfig.json`, `vitest.config.ts` (pool: forks).
|
|
|
|
---
|
|
|
|
## 2. Error codes + schema
|
|
|
|
- [x] `TRYSTERO_RELAY_UNREACHABLE`, `TRYSTERO_ROOM_JOIN_FAILED`. Register eagerly.
|
|
- [x] `TrysteroMessageSchema` per variant; register in `@suaveplan/schema-registry`.
|
|
|
|
---
|
|
|
|
## 3. Supporting modules
|
|
|
|
For `event-emitter`, `intervals`, `room-config`, `trystero-room-manager`, `message-handlers`:
|
|
|
|
- [x] Implement each module; validate messages with Zod in `message-handlers`.
|
|
- [x] Write `*.test.ts` and `*.md`.
|
|
|
|
---
|
|
|
|
## 4. Presets (`src/presets/`)
|
|
|
|
- [x] Export `TORRENT_TRACKERS`, `NOSTR_RELAYS` with `{ url, addedAt, lastVerified }` freshness metadata.
|
|
- [x] Write `presets.md`.
|
|
|
|
---
|
|
|
|
## 5. TrysteroDiscovery (`src/trystero-discovery/`)
|
|
|
|
- [x] Strict-mode: reject public default relay lists without `strict: false`.
|
|
- [x] Encrypted rooms: if `config.encrypt`, wrap messages with `@suaveplan/crypto` AES-GCM.
|
|
- [x] Signed announcements: if `config.sign`, sign metadata with `@suaveplan/crypto` ed25519.
|
|
- [x] Fallback via `@suaveplan/retry` (replace any ad-hoc fallback logic).
|
|
- [x] Wire OTel metrics per strategy.
|
|
- [x] Write `trystero-discovery.test.ts`, `trystero-discovery.md`, `trystero-discovery.types.ts`.
|
|
|
|
---
|
|
|
|
## 6. Story
|
|
|
|
- [x] `src/trystero-discovery/trystero-discovery.stories.tsx` with React devDep.
|
|
|
|
---
|
|
|
|
## 7. Tests (≤500 lines each)
|
|
|
|
- [x] `tests/core.test.ts` — config, strict-mode, start/stop.
|
|
- [x] `tests/messaging.test.ts` — message send/receive per strategy, Zod validation.
|
|
- [x] `tests/messaging-advanced.test.ts` — encrypted round-trip, signed announcement verification.
|
|
|
|
---
|
|
|
|
## 8. Verify + publish
|
|
|
|
- [x] `bunx turbo lint typecheck test --filter=@suaveplan/network-discovery-trystero` — green.
|
|
- [x] `bunx turbo test:coverage` — 100%.
|
|
- [x] Strict-mode blocks public defaults.
|
|
- [x] Encrypted-room round trip verified.
|
|
- [x] Fallback transition produces typed event with `from`/`to`.
|
|
- [x] `bun scripts/publish.ts --package @suaveplan/network-discovery-trystero`.
|
|
- [x] Archive to `openspec/archive/2026-04-24-enterprise-browser-network-discovery-trystero/`.
|