Merge branch 'docs/claude-md-accuracy' into 'master'
docs: correct the integration test path, note two things easy to get wrong See merge request riftenlabs/lib/wizardconnect!34
This commit is contained in:
commit
dbb2616689
2 changed files with 23 additions and 3 deletions
18
CLAUDE.md
18
CLAUDE.md
|
|
@ -21,8 +21,12 @@ This codebase communicates over a live relay with timing-sensitive handshakes an
|
||||||
**Integration tests** (`npm run test:integration` in a package):
|
**Integration tests** (`npm run test:integration` in a package):
|
||||||
- Hit the real relays at `wss://relay.riften.net:443` and `wss://relay.cauldron.quest:443`
|
- Hit the real relays at `wss://relay.riften.net:443` and `wss://relay.cauldron.quest:443`
|
||||||
- Test the full protocol handshake end-to-end
|
- Test the full protocol handshake end-to-end
|
||||||
- Located in `src/__tests__/*.integration.test.ts`
|
- Located in `src/integration/*.test.ts` (wallet is the only package with them today)
|
||||||
- Run with generous timeouts (60s per test) via `vitest.integration.config.ts`
|
- Run with generous timeouts (60s per test) via `vitest.integration.config.ts`, serially
|
||||||
|
(`singleFork`) to avoid relay contention, and with `retry: 2` — these hit third-party
|
||||||
|
relays, so a dropped connection is an environment failure rather than a regression
|
||||||
|
- A failure that reproduces locally is real; one that does not is usually the relay.
|
||||||
|
Check whether the same test passed on an earlier pipeline before assuming a regression
|
||||||
- Must pass before any release
|
- Must pass before any release
|
||||||
|
|
||||||
### Running tests
|
### Running tests
|
||||||
|
|
@ -87,3 +91,13 @@ npm run build # builds all packages in dependency order
|
||||||
```
|
```
|
||||||
|
|
||||||
Packages must be built before integration tests run (tests import from `dist/`).
|
Packages must be built before integration tests run (tests import from `dist/`).
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
The `publish` CI job runs on `master` only, via `contrib/auto-publish.js`.
|
||||||
|
|
||||||
|
**The `version` in each `package.json` is a floor, not the shipped version** — all declare
|
||||||
|
`0.2.0` while npm carries higher patches. Use `npm view @wizardconnect/<pkg> version`.
|
||||||
|
|
||||||
|
The lockfile is not published, so clearing a dependency advisory means bumping the declared
|
||||||
|
range in `package.json`, not just `package-lock.json`.
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,12 @@ connect(): Promise<void>
|
||||||
// NDK connect, subscribe to GiftWrap events, start waiting for relays.
|
// NDK connect, subscribe to GiftWrap events, start waiting for relays.
|
||||||
|
|
||||||
disconnect(): Promise<void>
|
disconnect(): Promise<void>
|
||||||
// Stop subscription, mark queue not-ready, update lastProcessedTimestamp.
|
// Stop subscription, close the relay pool, mark queue not-ready, update
|
||||||
|
// lastProcessedTimestamp. Kills any in-flight publish — see below.
|
||||||
|
|
||||||
relay(message: ProtocolMessage): Promise<void>
|
relay(message: ProtocolMessage): Promise<void>
|
||||||
// Send a message. Enqueues if relays not ready. Throws if paired key not set.
|
// Send a message. Enqueues if relays not ready. Throws if paired key not set.
|
||||||
|
// Resolves only once the publish has settled against every configured relay.
|
||||||
|
|
||||||
setPairedPublicKey(key: Uint8Array): void
|
setPairedPublicKey(key: Uint8Array): void
|
||||||
// Called after key exchange. Enables outbound messages and incoming peer filtering.
|
// Called after key exchange. Enables outbound messages and incoming peer filtering.
|
||||||
|
|
@ -78,6 +80,10 @@ regardless (avoiding silent message loss on slow connections).
|
||||||
On `disconnect()`, the queue is marked not-ready so messages sent during a reconnect gap are
|
On `disconnect()`, the queue is marked not-ready so messages sent during a reconnect gap are
|
||||||
held rather than dropped.
|
held rather than dropped.
|
||||||
|
|
||||||
|
Because `disconnect()` closes the pool, it kills any publish still in flight — so anything
|
||||||
|
sending a final message before tearing down must await the `relay()` first. See
|
||||||
|
[wallet.md § Sending disconnect](wallet.md#sending-disconnect).
|
||||||
|
|
||||||
### Replay protection
|
### Replay protection
|
||||||
|
|
||||||
`lastProcessedTimestamp` is set to `now - 2` on the first connection. On reconnect it is updated
|
`lastProcessedTimestamp` is set to `now - 2` on the first connection. On reconnect it is updated
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue